feat: migrate task jobs to workflow notifications + timeline
This commit is contained in:
40
lib/types.ts
40
lib/types.ts
@@ -90,12 +90,37 @@ export type Filing = {
|
||||
|
||||
export type TaskStatus = 'queued' | 'running' | 'completed' | 'failed';
|
||||
export type TaskType = 'sync_filings' | 'refresh_prices' | 'analyze_filing' | 'portfolio_insights';
|
||||
export type TaskStage =
|
||||
| 'queued'
|
||||
| 'running'
|
||||
| 'completed'
|
||||
| 'failed'
|
||||
| 'sync.fetch_filings'
|
||||
| 'sync.fetch_metrics'
|
||||
| 'sync.persist_filings'
|
||||
| 'sync.hydrate_statements'
|
||||
| 'refresh.load_holdings'
|
||||
| 'refresh.fetch_quotes'
|
||||
| 'refresh.persist_prices'
|
||||
| 'analyze.load_filing'
|
||||
| 'analyze.fetch_document'
|
||||
| 'analyze.extract'
|
||||
| 'analyze.generate_report'
|
||||
| 'analyze.persist_report'
|
||||
| 'insights.load_holdings'
|
||||
| 'insights.generate'
|
||||
| 'insights.persist';
|
||||
|
||||
export type Task = {
|
||||
id: string;
|
||||
user_id: string;
|
||||
task_type: TaskType;
|
||||
status: TaskStatus;
|
||||
stage: TaskStage;
|
||||
stage_detail: string | null;
|
||||
resource_key: string | null;
|
||||
notification_read_at: string | null;
|
||||
notification_silenced_at: string | null;
|
||||
priority: number;
|
||||
payload: Record<string, unknown>;
|
||||
result: Record<string, unknown> | null;
|
||||
@@ -108,6 +133,21 @@ export type Task = {
|
||||
finished_at: string | null;
|
||||
};
|
||||
|
||||
export type TaskStageEvent = {
|
||||
id: number;
|
||||
task_id: string;
|
||||
user_id: string;
|
||||
stage: TaskStage;
|
||||
stage_detail: string | null;
|
||||
status: TaskStatus;
|
||||
created_at: string;
|
||||
};
|
||||
|
||||
export type TaskTimeline = {
|
||||
task: Task;
|
||||
events: TaskStageEvent[];
|
||||
};
|
||||
|
||||
export type PortfolioInsight = {
|
||||
id: number;
|
||||
user_id: string;
|
||||
|
||||
Reference in New Issue
Block a user