157 lines
2.9 KiB
TypeScript

export interface ProductMedia {
id: string;
productId: string;
url: string;
mediaType: 'IMAGE' | 'VIDEO';
sortOrder: number;
createdAt: string;
}
export interface ProductCategory {
name: string;
}
export interface ProductMerchant {
name: string;
}
export interface ProductAttributes {
featured?: boolean;
[key: string]: any;
}
export interface ProductDimensions {
[key: string]: any;
}
export interface Products {
id: string;
merchantId: string;
categoryId: string;
sku: string;
barcode: string | null;
name: string;
brand: string | null;
description: string;
imageUrl: string;
productType: string;
price: string;
compareAtPrice: string;
currency: string;
weightKg: string | null;
weightGm: string | null;
dimensions: ProductDimensions;
attributes: ProductAttributes;
stockQuantity: number;
isTrackStock: boolean;
isActive: boolean;
createdAt: string;
deletedAt: string | null;
category: ProductCategory;
merchant: ProductMerchant;
media: ProductMedia[];
avgRating: string;
totalRatings: number;
}
export interface PaginationMeta {
total: number;
page: number;
limit: number;
totalPages: number;
}
export interface Product {
id: string;
merchantId: string;
categoryId: string;
sku: string;
barcode: string | null;
name: string;
brand: string | null;
description: string;
imageUrl: string;
productType: ProductType;
price: string;
compareAtPrice: string;
currency: string;
weightKg: string | null;
weightGm: string | null;
dimensions: ProductDimensions;
attributes: ProductAttributes;
stockQuantity: number;
isTrackStock: boolean;
isActive: boolean;
createdAt: string;
deletedAt: string | null;
category: ProductCategory;
merchant: ProductMerchant;
media: ProductMedia[];
avgRating: string;
totalRatings: number;
recentRatings: ProductRating[];
}
export interface ProductCategory {
id: string;
name: string;
slug: string;
}
export interface ProductMerchant {
id: string;
name: string;
merchantCode: string;
rating: string;
}
// export interface ProductMedia {
// id: string;
// productId: string;
// url: string;
// mediaType: MediaType;
// sortOrder: number;
// createdAt: string;
// }
// export interface ProductAttributes {
// featured: boolean;
// }
// export interface ProductDimensions {
// [key: string]: unknown;
// }
export interface ProductRating {
id: string;
userId: string;
rating: number;
review: string;
createdAt: string;
}
export enum ProductType {
FOOD = 'FOOD',
GROCERIES = 'GROCERIES',
PHARMACY = 'PHARMACY',
ELECTRONICS = 'ELECTRONICS',
}
export enum MediaType {
IMAGE = 'IMAGE',
VIDEO = 'VIDEO',
}
//catagories
export type CategoriesResponse = Categories[];
export interface Categories {
id: string;
parentId: string | null;
name: string;
slug: string;
imageUrl: string | null;
isActive: boolean;
// children: Categories[];
}