feat: 实现工程管理模块
- 新增 Project ProjectStyleRecord Task 数据模型 - 新增 ProjectService 服务层,支持工程和风格的 CRUD 操作 - 新增工程相关 handler,实现前端所需的所有工程接口 - 数据库层新增 GetDB 方法,便于服务层获取数据库连接 涉及接口: - GET /api/v1/projects - 获取工程列表 - POST /api/v1/projects - 创建工程 - GET /api/v1/projects/:projectId - 获取工程详情 - PUT /api/v1/projects/:projectId - 更新工程信息 - DELETE /api/v1/projects/:projectId - 删除工程 - GET /api/v1/projects/:projectId/style - 获取工程风格 - PUT /api/v1/projects/:projectId/style - 更新工程风格 - GET /api/v1/projects/:projectId/tasks - 获取工程任务列表
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
// Task 任务数据模型,对应数据库表。
|
||||
type Task struct {
|
||||
ID uint `gorm:"primaryKey" json:"id"`
|
||||
ProjectID uint `gorm:"index" json:"-"`
|
||||
Prompt string `gorm:"type:text" json:"prompt"`
|
||||
AssetType string `gorm:"size:50" json:"assetType"`
|
||||
Status string `gorm:"size:20;default:'pending'" json:"status"`
|
||||
Stage string `gorm:"size:50" json:"stage,omitempty"`
|
||||
Progress int `gorm:"default:0" json:"progress"`
|
||||
RetryCount int `gorm:"default:0" json:"retryCount"`
|
||||
Error string `gorm:"type:text" json:"error,omitempty"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt,omitempty"`
|
||||
}
|
||||
|
||||
// TaskResponse 任务响应。
|
||||
type TaskResponse struct {
|
||||
ID string `json:"id"`
|
||||
ProjectID string `json:"projectId"`
|
||||
Prompt string `json:"prompt"`
|
||||
AssetType string `json:"assetType"`
|
||||
Status string `json:"status"`
|
||||
Stage string `json:"stage,omitempty"`
|
||||
Progress int `json:"progress"`
|
||||
RetryCount int `json:"retryCount"`
|
||||
Error string `json:"error,omitempty"`
|
||||
CreatedAt string `json:"createdAt"`
|
||||
UpdatedAt string `json:"updatedAt,omitempty"`
|
||||
}
|
||||
Reference in New Issue
Block a user