69 lines
1.7 KiB
TypeScript
69 lines
1.7 KiB
TypeScript
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;
|
|
}; |