121 lines
2.4 KiB
TypeScript
121 lines
2.4 KiB
TypeScript
/**
|
|
* Per-language translation content for an item.
|
|
*/
|
|
export interface ItemTranslation {
|
|
name?: string;
|
|
simpleDescription?: string;
|
|
description?: ItemDescriptionField[];
|
|
}
|
|
|
|
/** Localized name entry */
|
|
export interface ItemName {
|
|
language: string;
|
|
value: string;
|
|
/** Backend typo — some responses use 'valuue' instead of 'value' */
|
|
valuue?: string;
|
|
}
|
|
|
|
/** Localized description entry */
|
|
export interface ItemDescription {
|
|
language: string;
|
|
value: string;
|
|
valuue?: string;
|
|
}
|
|
|
|
/** Key-value attribute pair */
|
|
export interface ItemAttribute {
|
|
key: string;
|
|
value: string;
|
|
}
|
|
|
|
/** Item variant detail (price, size, colour per variant) */
|
|
export interface ItemDetail {
|
|
color?: string;
|
|
colour?: string;
|
|
size?: string;
|
|
price: number;
|
|
currency: string;
|
|
remaining: number;
|
|
}
|
|
|
|
/** Photo entry with type (photo or video) */
|
|
export interface Photo {
|
|
type?: string;
|
|
url: string;
|
|
}
|
|
|
|
/** Question on an item */
|
|
export interface Question {
|
|
question: string;
|
|
answer: string;
|
|
like?: number;
|
|
dislike?: number;
|
|
}
|
|
|
|
/** Review / callback on an item */
|
|
export interface Review {
|
|
rating?: number;
|
|
content?: string;
|
|
userID?: string;
|
|
answer?: string;
|
|
timestamp?: string;
|
|
}
|
|
|
|
export interface Item {
|
|
id: string;
|
|
name: string;
|
|
visible: boolean;
|
|
priority: number;
|
|
quantity: number;
|
|
price: number;
|
|
discount: number;
|
|
currency: string;
|
|
imgs: string[];
|
|
tags: string[];
|
|
badges?: string[];
|
|
colour?: string;
|
|
size?: string;
|
|
simpleDescription: string;
|
|
description: ItemDescriptionField[];
|
|
subcategoryId: string;
|
|
names?: ItemName[];
|
|
descriptions?: ItemDescription[];
|
|
attributes?: ItemAttribute[];
|
|
comments?: Comment[];
|
|
/** Optional translations keyed by language code: { ru: { name: '...', simpleDescription: '...', description: [...] } } */
|
|
translations?: { [lang: string]: ItemTranslation };
|
|
|
|
// Fields from Go backend struct
|
|
itemID?: number;
|
|
categoryID?: number;
|
|
rating?: number;
|
|
visits?: number;
|
|
itemDetails?: ItemDetail[];
|
|
photos?: Photo[];
|
|
questions?: Question[];
|
|
callbacks?: Review[];
|
|
partnerID?: string;
|
|
remaining?: number;
|
|
}
|
|
|
|
export interface ItemDescriptionField {
|
|
key: string;
|
|
value: string;
|
|
}
|
|
|
|
export interface Comment {
|
|
id: string;
|
|
text: string;
|
|
createdAt: Date;
|
|
author?: string;
|
|
stars?: number;
|
|
}
|
|
|
|
export interface ItemsListResponse {
|
|
items: Item[];
|
|
total: number;
|
|
page: number;
|
|
limit: number;
|
|
hasMore: boolean;
|
|
}
|