Delete legacy alerts

This commit is contained in:
Urtzi Alfaro
2025-08-22 15:31:52 +02:00
parent c6dd6fd1de
commit 90100a66c6
40 changed files with 25 additions and 3308 deletions

View File

@@ -105,22 +105,6 @@ export interface StockMovement {
batch_info?: StockBatch;
}
export interface StockAlert {
id: string;
item_id: string;
alert_type: 'low_stock' | 'expired' | 'expiring_soon' | 'overstock';
severity: 'low' | 'medium' | 'high' | 'critical';
message: string;
threshold_value?: number;
current_value?: number;
is_acknowledged: boolean;
created_at: string;
acknowledged_at?: string;
acknowledged_by?: string;
// Related data
item?: InventoryItem;
}
// ========== REQUEST/RESPONSE TYPES ==========
@@ -404,32 +388,6 @@ export class InventoryService {
return apiClient.get(url);
}
// ========== ALERTS ==========
/**
* Get current stock alerts
*/
async getStockAlerts(tenantId: string): Promise<StockAlert[]> {
// TODO: Map to correct endpoint when available
return [];
// return apiClient.get(`/tenants/${tenantId}/inventory/alerts`);
}
/**
* Acknowledge alert
*/
async acknowledgeAlert(tenantId: string, alertId: string): Promise<void> {
return apiClient.post(`${this.baseEndpoint}/tenants/${tenantId}/inventory/alerts/${alertId}/acknowledge`);
}
/**
* Bulk acknowledge alerts
*/
async bulkAcknowledgeAlerts(tenantId: string, alertIds: string[]): Promise<void> {
return apiClient.post(`${this.baseEndpoint}/tenants/${tenantId}/inventory/alerts/bulk-acknowledge`, {
alert_ids: alertIds
});
}
// ========== DASHBOARD & ANALYTICS ==========
@@ -771,23 +729,6 @@ export class InventoryService {
}
}
/**
* Get inventory alerts
*/
async getInventoryAlerts(tenantId: string, params?: {
alert_type?: string;
severity?: string;
status?: string;
item_id?: string;
limit?: number;
}): Promise<any[]> {
try {
return await apiClient.get(`/tenants/${tenantId}/inventory/alerts`, { params });
} catch (error) {
console.error('❌ Error fetching inventory alerts:', error);
throw error;
}
}
/**
* Get restock recommendations

View File

@@ -344,20 +344,6 @@ export class OrdersService {
return apiClient.get(`${this.basePath}/analytics/seasonal`, { params });
}
// Alerts
async getOrderAlerts(params?: {
severity?: string;
status?: string;
limit?: number;
}): Promise<any[]> {
return apiClient.get(`${this.basePath}/alerts`, { params });
}
async acknowledgeAlert(alertId: string): Promise<void> {
return apiClient.post(`${this.basePath}/alerts/${alertId}/acknowledge`);
}
async resolveAlert(alertId: string, resolution?: string): Promise<void> {
return apiClient.post(`${this.basePath}/alerts/${alertId}/resolve`, { resolution });
}
}

View File

@@ -66,13 +66,11 @@ export interface ProductionDashboardData {
equipment_in_use: number;
current_efficiency: number;
todays_production: number;
alerts_count: number;
};
efficiency_trend: { date: string; efficiency: number }[];
quality_trend: { date: string; quality: number }[];
equipment_status: Equipment[];
active_batches: ProductionBatch[];
alerts: any[];
}
export interface BatchCreateRequest {
@@ -174,8 +172,7 @@ export class ProductionService {
temperature: number;
humidity: number;
estimated_completion: string;
alerts: any[];
}> {
}> {
return apiClient.get(`${this.basePath}/batches/${batchId}/status`);
}
@@ -295,20 +292,5 @@ export class ProductionService {
return apiClient.get(`${this.basePath}/analytics/quality`, { params });
}
// Alerts
async getProductionAlerts(params?: {
severity?: string;
status?: string;
limit?: number;
}): Promise<any[]> {
return apiClient.get(`${this.basePath}/alerts`, { params });
}
async acknowledgeAlert(alertId: string): Promise<void> {
return apiClient.post(`${this.basePath}/alerts/${alertId}/acknowledge`);
}
async resolveAlert(alertId: string, resolution?: string): Promise<void> {
return apiClient.post(`${this.basePath}/alerts/${alertId}/resolve`, { resolution });
}
}

View File

@@ -188,7 +188,6 @@ export interface SupplierDashboardData {
quality_scores: number[];
cost_savings: number[];
};
alerts: any[];
contract_expirations: { supplier_name: string; days_until_expiry: number }[];
}
@@ -320,23 +319,7 @@ export class SuppliersService {
return apiClient.get(`${this.basePath}/analytics/risk-analysis`);
}
// Alerts
async getSupplierAlerts(params?: {
severity?: string;
status?: string;
supplier_id?: string;
limit?: number;
}): Promise<any[]> {
return apiClient.get(`${this.basePath}/alerts`, { params });
}
async acknowledgeAlert(alertId: string): Promise<void> {
return apiClient.post(`${this.basePath}/alerts/${alertId}/acknowledge`);
}
async resolveAlert(alertId: string, resolution?: string): Promise<void> {
return apiClient.post(`${this.basePath}/alerts/${alertId}/resolve`, { resolution });
}
// Additional methods for hooks compatibility
async getSupplierStatistics(): Promise<SupplierStatistics> {