feat: promotion feature added

This commit is contained in:
2026-02-23 21:04:18 +03:30
parent d65b73a593
commit 99d29bbce5
6 changed files with 912 additions and 0 deletions
+69
View File
@@ -0,0 +1,69 @@
export type PromotionType = 'slider' | 'action' | 'paid_app' | 'banner';
export const PROMOTION_TYPES = {
slider: 'اسلایدر',
action: 'اکشن',
paid_app: 'اپلیکیشن پولی',
banner: 'بنر'
} as const;
export interface Promotion {
id: number;
type: PromotionType;
title: string | null;
image_url:string | null;
subtitle: string | null;
image: string | null;
action_text: string | null;
url_myket: string | null;
url_bazzar: string | null;
url_google_play: string | null;
url_site: string | null;
is_active: boolean;
priority: number | null;
start_at: string | null;
end_at: string | null;
created_at: string;
updated_at: string;
}
export interface CreatePromotionData {
type: PromotionType;
title?: string | null;
subtitle?: string | null;
image?: File | null;
action_text?: string | null;
url_myket?: string | null;
url_bazzar?: string | null;
url_google_play?: string | null;
url_site?: string | null;
priority?: number | null;
start_at?: string | null;
end_at?: string | null;
}
export interface UpdatePromotionData {
type?: PromotionType;
title?: string | null;
subtitle?: string | null;
image?: File | null;
action_text?: string | null;
url_myket?: string | null;
url_bazzar?: string | null;
url_google_play?: string | null;
url_site?: string | null;
is_active?: boolean;
priority?: number | null;
start_at?: string | null;
end_at?: string | null;
}
export interface ApiResponse<T> {
data: T;
message?: string;
status?: number;
}
export const getPromotionTypeLabel = (type: PromotionType): string => {
return PROMOTION_TYPES[type] || type;
};