feat: initial admin panel
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
export interface LoginCredentials {
|
||||
auth: string;
|
||||
password: string;
|
||||
package_name: string;
|
||||
}
|
||||
|
||||
export interface LoginResponse {
|
||||
token: string;
|
||||
user?: User;
|
||||
message?: string;
|
||||
}
|
||||
|
||||
export interface User {
|
||||
id: string;
|
||||
email: string;
|
||||
name?: string;
|
||||
role?: string;
|
||||
is_admin?: String;
|
||||
}
|
||||
|
||||
export interface AuthState {
|
||||
user: User | null;
|
||||
token: string | null;
|
||||
isLoading: boolean;
|
||||
error: string | null;
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
export interface PackageName {
|
||||
id: number;
|
||||
name: string | null;
|
||||
title: string | null;
|
||||
image: string | null | File | any;
|
||||
v1_identifier: string | null;
|
||||
uuid: string;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
cafe_config_id: number | null;
|
||||
myket_access_token: string | null;
|
||||
web_app_url: string | null;
|
||||
tries: number | null;
|
||||
}
|
||||
|
||||
export interface CreatePackageData {
|
||||
name: string;
|
||||
title: string;
|
||||
avatar?: File | null;
|
||||
v1_identifier?: string | null;
|
||||
myket_access_token?: string | null;
|
||||
cafe_config_id?: number | null;
|
||||
web_app_url?: string | null;
|
||||
tries?: number;
|
||||
firebase_json?: File | null;
|
||||
}
|
||||
|
||||
export interface UpdatePackageData {
|
||||
name?: string;
|
||||
title?: string;
|
||||
avatar?: File | null;
|
||||
v1_identifier?: string | null;
|
||||
myket_access_token?: string | null;
|
||||
cafe_config_id?: number | null;
|
||||
web_app_url?: string | null;
|
||||
tries?: number;
|
||||
firebase_json?: File | null;
|
||||
_method?: string; // For Laravel method spoofing
|
||||
}
|
||||
|
||||
export interface ApiResponse<T> {
|
||||
data: T;
|
||||
message?: string;
|
||||
status?: number;
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
export interface Product {
|
||||
id: number;
|
||||
package_name_id: number;
|
||||
title: string | null;
|
||||
price: number | null;
|
||||
type: number | null;
|
||||
uuid: string;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
descriptions: string[] | null;
|
||||
}
|
||||
|
||||
export interface CreateProductData {
|
||||
title: string;
|
||||
price: number;
|
||||
type: number;
|
||||
descriptions?: string[];
|
||||
}
|
||||
|
||||
export interface UpdateProductData {
|
||||
title?: string;
|
||||
price?: number;
|
||||
type?: number;
|
||||
descriptions?: string[];
|
||||
}
|
||||
|
||||
export interface ApiResponse<T> {
|
||||
data: T;
|
||||
message?: string;
|
||||
status?: number;
|
||||
}
|
||||
|
||||
// Product types mapping
|
||||
export const PRODUCT_TYPES = {
|
||||
1: 'دائمی',
|
||||
2: 'سالیانه',
|
||||
3: '۶ ماهه',
|
||||
4: 'ماهیانه'
|
||||
} as const;
|
||||
|
||||
export type ProductType = keyof typeof PRODUCT_TYPES;
|
||||
|
||||
export const getProductTypeLabel = (type: number | null): string => {
|
||||
if (!type) return 'نامشخص';
|
||||
return PRODUCT_TYPES[type as ProductType] || 'نامشخص';
|
||||
};
|
||||
@@ -0,0 +1,77 @@
|
||||
export interface User {
|
||||
id: number;
|
||||
first_name: string | null;
|
||||
last_name: string | null;
|
||||
email: string | null;
|
||||
mobile: string | null;
|
||||
avatar: string | null;
|
||||
uuid: string;
|
||||
is_admin: boolean;
|
||||
wallet: number;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
birthday: string | null;
|
||||
gender: string | null;
|
||||
email_verified_at: string | null;
|
||||
remember_token: string | null;
|
||||
full_name: string | null;
|
||||
products: UserProduct[];
|
||||
}
|
||||
|
||||
export interface UserProduct {
|
||||
id: number;
|
||||
package_name_id: number;
|
||||
title: string | null;
|
||||
price: number | null;
|
||||
type: number | null;
|
||||
uuid: string;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
descriptions: string[] | null;
|
||||
pivot: ProductPivot;
|
||||
package_name: PackageName | null;
|
||||
}
|
||||
|
||||
export interface ProductPivot {
|
||||
user_id: number;
|
||||
product_id: number;
|
||||
expire_at: string | null;
|
||||
purchase_token: string | null;
|
||||
gateway: string | null;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
export interface PackageName {
|
||||
id: number;
|
||||
name: string | null;
|
||||
title: string | null;
|
||||
image: string | null;
|
||||
v1_identifier: string | null;
|
||||
uuid: string;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
cafe_config_id: string | null;
|
||||
myket_access_token: string | null;
|
||||
web_app_url: string | null;
|
||||
tries: number | null;
|
||||
}
|
||||
|
||||
export interface Product {
|
||||
id: number;
|
||||
title: string | null;
|
||||
price: number | null;
|
||||
type: number | null;
|
||||
descriptions: string[] | null;
|
||||
}
|
||||
|
||||
export interface UserSearchParams {
|
||||
searchTerm: string;
|
||||
package_name: string;
|
||||
}
|
||||
|
||||
export interface ApiResponse<T> {
|
||||
data: T;
|
||||
message?: string | null;
|
||||
status?: number | null;
|
||||
}
|
||||
Reference in New Issue
Block a user