Add new frontend - fix 2
This commit is contained in:
@@ -1,170 +0,0 @@
|
||||
// frontend/dashboard/src/types/api.ts
|
||||
/**
|
||||
* Shared TypeScript interfaces for API communication
|
||||
*/
|
||||
|
||||
// Base response types
|
||||
export interface ApiResponse<T = any> {
|
||||
data?: T;
|
||||
message?: string;
|
||||
status: string;
|
||||
timestamp?: string;
|
||||
}
|
||||
|
||||
export interface ApiError {
|
||||
detail: string;
|
||||
service?: string;
|
||||
error_code?: string;
|
||||
timestamp?: string;
|
||||
}
|
||||
|
||||
// Auth types
|
||||
export interface LoginRequest {
|
||||
email: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
export interface RegisterRequest {
|
||||
email: string;
|
||||
password: string;
|
||||
full_name: string;
|
||||
phone?: string;
|
||||
language?: string;
|
||||
}
|
||||
|
||||
export interface TokenResponse {
|
||||
access_token: string;
|
||||
refresh_token: string;
|
||||
token_type: string;
|
||||
expires_in: number;
|
||||
}
|
||||
|
||||
export interface UserProfile {
|
||||
id: string;
|
||||
email: string;
|
||||
full_name: string;
|
||||
is_active: boolean;
|
||||
is_verified: boolean;
|
||||
tenant_id?: string;
|
||||
role: string;
|
||||
phone?: string;
|
||||
language: string;
|
||||
timezone: string;
|
||||
created_at?: string;
|
||||
last_login?: string;
|
||||
}
|
||||
|
||||
// Tenant types
|
||||
export interface TenantInfo {
|
||||
id: string;
|
||||
name: string;
|
||||
email: string;
|
||||
phone: string;
|
||||
address: string;
|
||||
latitude: number;
|
||||
longitude: number;
|
||||
business_type: string;
|
||||
is_active: boolean;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
// Sales types
|
||||
export interface SalesRecord {
|
||||
id: string;
|
||||
tenant_id: string;
|
||||
product_name: string;
|
||||
quantity_sold: number;
|
||||
revenue: number;
|
||||
date: string;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
export interface CreateSalesRequest {
|
||||
product_name: string;
|
||||
quantity_sold: number;
|
||||
revenue: number;
|
||||
date: string;
|
||||
}
|
||||
|
||||
// Training types
|
||||
export interface TrainingJobStatus {
|
||||
id: string;
|
||||
tenant_id: string;
|
||||
status: 'queued' | 'running' | 'completed' | 'failed' | 'cancelled';
|
||||
progress: number;
|
||||
current_step?: string;
|
||||
started_at: string;
|
||||
completed_at?: string;
|
||||
duration_seconds?: number;
|
||||
models_trained?: Record<string, any>;
|
||||
metrics?: Record<string, any>;
|
||||
error_message?: string;
|
||||
}
|
||||
|
||||
export interface TrainingRequest {
|
||||
force_retrain?: boolean;
|
||||
products?: string[];
|
||||
training_days?: number;
|
||||
}
|
||||
|
||||
export interface TrainedModel {
|
||||
id: string;
|
||||
product_name: string;
|
||||
model_type: string;
|
||||
model_version: string;
|
||||
mape?: number;
|
||||
rmse?: number;
|
||||
mae?: number;
|
||||
r2_score?: number;
|
||||
training_samples?: number;
|
||||
features_used?: string[];
|
||||
is_active: boolean;
|
||||
created_at: string;
|
||||
last_used_at?: string;
|
||||
}
|
||||
|
||||
// Forecast types
|
||||
export interface ForecastRecord {
|
||||
id: string;
|
||||
tenant_id: string;
|
||||
product_name: string;
|
||||
forecast_date: string;
|
||||
predicted_quantity: number;
|
||||
confidence_lower: number;
|
||||
confidence_upper: number;
|
||||
model_version: string;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
export interface ForecastRequest {
|
||||
product_name?: string;
|
||||
forecast_days?: number;
|
||||
include_confidence?: boolean;
|
||||
}
|
||||
|
||||
// Data types
|
||||
export interface WeatherData {
|
||||
date: string;
|
||||
temperature: number;
|
||||
humidity: number;
|
||||
precipitation: number;
|
||||
wind_speed: number;
|
||||
}
|
||||
|
||||
export interface TrafficData {
|
||||
date: string;
|
||||
traffic_volume: number;
|
||||
pedestrian_count: number;
|
||||
}
|
||||
|
||||
// Notification types
|
||||
export interface NotificationSettings {
|
||||
email_enabled: boolean;
|
||||
whatsapp_enabled: boolean;
|
||||
training_notifications: boolean;
|
||||
forecast_notifications: boolean;
|
||||
alert_thresholds: {
|
||||
low_stock_percentage: number;
|
||||
high_demand_increase: number;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user