Files
market-backOfficce/src/app/models/item.model.ts

121 lines
2.4 KiB
TypeScript
Raw Normal View History

2026-02-20 09:01:02 +04:00
/**
* Per-language translation content for an item.
*/
export interface ItemTranslation {
name?: string;
simpleDescription?: string;
description?: ItemDescriptionField[];
}
2026-03-24 00:07:45 +04:00
/** Localized name entry */
export interface ItemName {
language: string;
value: string;
2026-03-24 02:47:31 +04:00
/** Backend typo — some responses use 'valuue' instead of 'value' */
valuue?: string;
2026-03-24 00:07:45 +04:00
}
/** Localized description entry */
export interface ItemDescription {
language: string;
value: string;
2026-03-24 02:47:31 +04:00
valuue?: string;
2026-03-24 00:07:45 +04:00
}
/** Key-value attribute pair */
export interface ItemAttribute {
key: string;
value: string;
}
2026-03-24 02:47:31 +04:00
/** 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;
}
2026-01-19 23:17:07 +04:00
export interface Item {
id: string;
name: string;
visible: boolean;
priority: number;
quantity: number;
price: number;
2026-02-20 10:43:47 +04:00
discount: number;
2026-01-19 23:17:07 +04:00
currency: string;
imgs: string[];
tags: string[];
2026-02-20 01:46:14 +04:00
badges?: string[];
2026-03-24 00:07:45 +04:00
colour?: string;
size?: string;
2026-01-19 23:17:07 +04:00
simpleDescription: string;
description: ItemDescriptionField[];
subcategoryId: string;
2026-03-24 00:07:45 +04:00
names?: ItemName[];
descriptions?: ItemDescription[];
attributes?: ItemAttribute[];
2026-01-19 23:17:07 +04:00
comments?: Comment[];
2026-02-20 09:01:02 +04:00
/** Optional translations keyed by language code: { ru: { name: '...', simpleDescription: '...', description: [...] } } */
translations?: { [lang: string]: ItemTranslation };
2026-03-24 02:47:31 +04:00
// 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;
2026-01-19 23:17:07 +04:00
}
export interface ItemDescriptionField {
key: string;
value: string;
}
export interface Comment {
id: string;
text: string;
createdAt: Date;
author?: string;
2026-01-22 00:41:13 +04:00
stars?: number;
2026-01-19 23:17:07 +04:00
}
export interface ItemsListResponse {
items: Item[];
total: number;
page: number;
limit: number;
hasMore: boolean;
}