Files
gen2d/backend/internal/model/project.go
T

44 lines
1.5 KiB
Go
Raw Normal View History

2026-05-25 16:38:46 +08:00
package model
import "time"
// Project 工程数据模型,对应数据库表。
type Project struct {
ID uint `gorm:"primaryKey" json:"id"`
UserID uint `gorm:"index" json:"-"` // 用户ID,用于权限控制
Name string `gorm:"size:100;not null" json:"name"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt,omitempty"`
}
// ProjectStyleRecord 工程风格记录,用于存储键值对。
type ProjectStyleRecord struct {
ID uint `gorm:"primaryKey" json:"id"`
ProjectID uint `gorm:"index" json:"-"`
Key string `gorm:"size:50;not null" json:"-"`
Value string `gorm:"size:100;not null" json:"-"`
CreatedAt time.Time `json:"-"`
}
// ProjectResponse 工程响应,包含风格键值对和元数据。
type ProjectResponse struct {
ID string `json:"id"`
Name string `json:"name"`
Style *ProjectStyleResponse `json:"style"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt,omitempty"`
TaskCount int `json:"taskCount,omitempty"`
LastActivityAt string `json:"lastActivityAt,omitempty"`
}
// ProjectStyleResponse 工程风格响应。
type ProjectStyleResponse struct {
KvPairs map[string]string `json:"kvPairs"`
}
// ProjectsListResponse 工程列表响应。
type ProjectsListResponse struct {
Total int `json:"total"`
Projects []ProjectResponse `json:"projects"`
}