Files
marketplaces/src/app/models/item.model.ts

103 lines
1.9 KiB
TypeScript
Raw Normal View History

2026-01-18 18:57:06 +04:00
export interface Photo {
photo?: string;
video?: string;
url: string;
type?: string;
}
2026-02-20 10:44:03 +04:00
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[];
}
2026-02-26 21:54:21 +04:00
export interface Review {
2026-01-18 18:57:06 +04:00
rating?: number;
content?: string;
userID?: string;
answer?: string;
timestamp?: string;
}
2026-02-26 21:54:21 +04:00
/** @deprecated Use {@link Review} instead */
export type Callback = Review;
2026-01-18 18:57:06 +04:00
export interface Question {
question: string;
answer: string;
upvotes: number;
downvotes: number;
}
2026-03-24 00:09:11 +04:00
/** 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;
}
2026-01-18 18:57:06 +04:00
export interface Item {
categoryID: number;
itemID: number;
name: string;
photos: Photo[] | null;
description: string;
currency: string;
price: number;
discount: number;
remainings?: string;
rating: number;
2026-02-26 21:54:21 +04:00
callbacks: Review[] | null;
2026-01-18 18:57:06 +04:00
questions: Question[] | null;
2026-02-20 10:44:03 +04:00
quantity?: number;
2026-03-24 00:09:11 +04:00
// Backend API fields
colour?: string;
size?: string;
language?: string;
names?: ItemName[];
descriptions?: ItemDescription[];
attributes?: ItemAttribute[];
2026-02-20 10:44:03 +04:00
// 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[];
2026-01-18 18:57:06 +04:00
}
export interface CartItem extends Item {
quantity: number;
}