51 lines
1.3 KiB
TypeScript
51 lines
1.3 KiB
TypeScript
// Reemplaza al enum OrderStatus
|
|
export type OrderStatus =
|
|
| 'pending'
|
|
| 'running'
|
|
| 'finished'
|
|
| 'failed'
|
|
| 'dlx';
|
|
|
|
// Reemplaza al enum OrderTypes
|
|
export type OrderType =
|
|
| 'activate'
|
|
| 'preactivate'
|
|
| 'cancel'
|
|
| 'pause'
|
|
| 'reactivate'
|
|
| 'unknown';
|
|
|
|
// Interfaz para la tabla order_tracking
|
|
export interface OrderTracking<T> {
|
|
id: number;
|
|
correlation_id: string;
|
|
exchange?: string | null;
|
|
routing_key?: string | null;
|
|
order_type: OrderType;
|
|
payload?: Record<string, T> | null; // Por no especificar el tipo del json hasta que no se cree
|
|
status: OrderStatus;
|
|
retry_count: number;
|
|
error_message?: string | null;
|
|
error_stacktrace?: string | null;
|
|
/* TODO: Importante decidir si trabajar con fecha y tener que crear los objetos o seguir como string */
|
|
start_date: string | Date;
|
|
update_date: string | Date;
|
|
finish_date?: string | Date | null;
|
|
}
|
|
|
|
// Interfaz para la tabla order_history
|
|
export interface OrderHistory {
|
|
id: number;
|
|
order_id: number;
|
|
previous_status: OrderStatus;
|
|
new_status: OrderStatus;
|
|
change_reason?: string | null;
|
|
change_date: Date;
|
|
}
|
|
|
|
// Tipo útil para la creación (Omitiendo campos generados por la DB)
|
|
export type CreateOrderDTO = Pick<
|
|
OrderTracking<any>, // Aqui realmente no importan los campos
|
|
'correlation_id' | 'exchange' | 'routing_key' | 'order_type' | 'payload'
|
|
>;
|