103 lines
1.9 KiB
TypeScript
103 lines
1.9 KiB
TypeScript
export interface Photo {
|
|
photo?: string;
|
|
video?: string;
|
|
url: string;
|
|
type?: string;
|
|
}
|
|
|
|
export interface DescriptionField {
|
|
key: string;
|
|
value: string;
|
|
}
|
|
|
|
export interface Comment {
|
|
id?: string;
|
|
text: string;
|
|
author?: string;
|
|
stars?: number;
|
|
createdAt?: string;
|
|
}
|
|
|
|
export interface ItemTranslation {
|
|
name?: string;
|
|
simpleDescription?: string;
|
|
description?: DescriptionField[];
|
|
}
|
|
|
|
export interface Review {
|
|
rating?: number;
|
|
content?: string;
|
|
userID?: string;
|
|
answer?: string;
|
|
timestamp?: string;
|
|
}
|
|
|
|
/** @deprecated Use {@link Review} instead */
|
|
export type Callback = Review;
|
|
|
|
export interface Question {
|
|
question: string;
|
|
answer: string;
|
|
upvotes: number;
|
|
downvotes: number;
|
|
}
|
|
|
|
/** Localized name entry from backend */
|
|
export interface ItemName {
|
|
language: string;
|
|
value: string;
|
|
}
|
|
|
|
/** Localized description entry from backend */
|
|
export interface ItemDescription {
|
|
language: string;
|
|
value: string;
|
|
}
|
|
|
|
/** Key-value attribute pair */
|
|
export interface ItemAttribute {
|
|
key: string;
|
|
value: string;
|
|
}
|
|
|
|
export interface Item {
|
|
categoryID: number;
|
|
itemID: number;
|
|
name: string;
|
|
photos: Photo[] | null;
|
|
description: string;
|
|
currency: string;
|
|
price: number;
|
|
discount: number;
|
|
remainings?: string;
|
|
rating: number;
|
|
callbacks: Review[] | null;
|
|
questions: Question[] | null;
|
|
quantity?: number;
|
|
|
|
// Backend API fields
|
|
colour?: string;
|
|
size?: string;
|
|
language?: string;
|
|
names?: ItemName[];
|
|
descriptions?: ItemDescription[];
|
|
attributes?: ItemAttribute[];
|
|
|
|
// BackOffice API fields
|
|
id?: string;
|
|
visible?: boolean;
|
|
priority?: number;
|
|
imgs?: string[];
|
|
tags?: string[];
|
|
badges?: string[];
|
|
simpleDescription?: string;
|
|
descriptionFields?: DescriptionField[];
|
|
subcategoryId?: string;
|
|
translations?: Record<string, ItemTranslation>;
|
|
comments?: Comment[];
|
|
}
|
|
|
|
export interface CartItem extends Item {
|
|
quantity: number;
|
|
}
|