Your Name a32102f583 feat: 补全后端 API 并对齐前后端类型
- 后端新增: Project CRUD / Brief CRUD / 组织关系管理 / 工作台统计 / SSE 推送 / 认证依赖注入
- 后端完善: 任务 API 全流程(创建/审核/申诉) + Task Service + Task Schema
- 前端修复: login 页面 localStorage key 错误 (miaosi_auth -> miaosi_user)
- 前端对齐: types/task.ts 与后端 TaskStage/TaskResponse 完全对齐
- 前端新增: project/brief/organization/dashboard 类型定义
- 前端补全: api.ts 新增 30+ API 方法覆盖所有后端接口

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 14:13:08 +08:00

164 lines
3.2 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* 任务相关类型定义
* 与后端 TaskStage/TaskStatus/TaskResponse 对齐
*/
// 任务阶段(对应后端 TaskStage
export type TaskStage =
| 'script_upload'
| 'script_ai_review'
| 'script_agency_review'
| 'script_brand_review'
| 'video_upload'
| 'video_ai_review'
| 'video_agency_review'
| 'video_brand_review'
| 'completed'
| 'rejected'
// 审核状态(对应后端 TaskStatus
export type TaskStatus =
| 'pending'
| 'processing'
| 'passed'
| 'rejected'
| 'force_passed'
// 关联信息
export interface ProjectInfo {
id: string
name: string
brand_name?: string | null
}
export interface AgencyInfo {
id: string
name: string
}
export interface CreatorInfo {
id: string
name: string
avatar?: string | null
}
// AI 审核结果
export interface AIReviewResult {
score: number
violations: Array<{
type: string
content: string
severity: string
suggestion: string
timestamp?: number
source?: string
}>
soft_warnings: Array<{
type: string
content: string
suggestion: string
}>
summary?: string
}
// 任务响应(对应后端 TaskResponse
export interface TaskResponse {
id: string
name: string
sequence: number
stage: TaskStage
// 关联
project: ProjectInfo
agency: AgencyInfo
creator: CreatorInfo
// 脚本信息
script_file_url?: string | null
script_file_name?: string | null
script_uploaded_at?: string | null
script_ai_score?: number | null
script_ai_result?: AIReviewResult | null
script_agency_status?: TaskStatus | null
script_agency_comment?: string | null
script_brand_status?: TaskStatus | null
script_brand_comment?: string | null
// 视频信息
video_file_url?: string | null
video_file_name?: string | null
video_duration?: number | null
video_thumbnail_url?: string | null
video_uploaded_at?: string | null
video_ai_score?: number | null
video_ai_result?: AIReviewResult | null
video_agency_status?: TaskStatus | null
video_agency_comment?: string | null
video_brand_status?: TaskStatus | null
video_brand_comment?: string | null
// 申诉
appeal_count: number
is_appeal: boolean
appeal_reason?: string | null
// 时间
created_at: string
updated_at: string
}
export interface TaskListResponse {
items: TaskResponse[]
total: number
page: number
page_size: number
}
export interface TaskSummary {
id: string
name: string
stage: TaskStage
creator_name: string
creator_avatar?: string | null
project_name: string
is_appeal: boolean
appeal_reason?: string | null
created_at: string
updated_at: string
}
export interface ReviewTaskListResponse {
items: TaskSummary[]
total: number
page: number
page_size: number
}
// 请求类型
export interface TaskCreateRequest {
project_id: string
creator_id: string
name?: string
}
export interface TaskScriptUploadRequest {
file_url: string
file_name: string
}
export interface TaskVideoUploadRequest {
file_url: string
file_name: string
duration?: number
thumbnail_url?: string
}
export interface TaskReviewRequest {
action: 'pass' | 'reject' | 'force_pass'
comment?: string
}
export interface AppealRequest {
reason: string
}