Files
SadmMontime/src/api/types.ts
T

111 lines
2.1 KiB
TypeScript

export type UserRole = 'customer' | 'business_owner' | 'admin';
export type User = {
id: string;
mobile: string;
fullName: string | null;
role: UserRole;
isActive: boolean;
hasPassword?: boolean;
createdAt?: string;
updatedAt?: string;
};
export type BusinessCategory = {
id: string;
slug: string;
title: string;
isActive: boolean;
createdAt?: string;
updatedAt?: string;
};
export type BusinessImage = {
id: string;
businessId: string;
url: string;
originalName: string | null;
sortOrder: number;
isCover: boolean;
};
export type Business = {
id: string;
title: string;
slug: string;
description: string | null;
contactPhone: string | null;
address: string | null;
latitude: number | null;
longitude: number | null;
isActive: boolean;
categoryId: string;
ownerId: string | null;
category?: BusinessCategory;
images?: BusinessImage[];
owner?: User | null;
createdAt?: string;
updatedAt?: string;
};
export type CreateBusinessPayload = {
title: string;
slug: string;
categoryId: string;
description?: string;
contactPhone?: string;
address?: string;
latitude?: number;
longitude?: number;
isActive?: boolean;
};
export type UpdateBusinessPayload = Partial<CreateBusinessPayload> & {
description?: string | null;
contactPhone?: string | null;
address?: string | null;
latitude?: number | null;
longitude?: number | null;
ownerId?: string | null;
};
export type CreateCategoryPayload = {
title: string;
slug: string;
isActive?: boolean;
};
export type UpdateCategoryPayload = Partial<CreateCategoryPayload>;
export type UpdateUserPayload = {
fullName?: string | null;
role?: UserRole;
isActive?: boolean;
};
export type AssignOwnerPayload = {
mobile: string;
fullName?: string | null;
};
export type BookingStatus =
| 'pending'
| 'confirmed'
| 'cancelled'
| 'completed';
export type Booking = {
id: string;
customerId: string;
businessId: string;
businessServiceId: string;
scheduledAt: string;
status: BookingStatus;
note: string | null;
customer?: User;
business?: Business;
businessService?: {
serviceTemplate?: { title: string };
};
};