Files
nl-pms-api/internal/model/team.go
2026-08-15 17:04:47 +08:00

81 lines
3.3 KiB
Go

package model
// Team 对应 teams。
type Team struct {
ID int64 `gorm:"primaryKey" json:"id"`
Name string `gorm:"size:64;not null" json:"name"`
OwnerID int64 `gorm:"not null" json:"ownerId"`
DigestTime string `gorm:"size:8;not null;default:21:00" json:"digestTime"`
AIBanned int `gorm:"column:ai_banned;not null;default:0" json:"aiBanned"`
CreatedAt string `gorm:"size:32;not null" json:"createdAt"`
}
func (Team) TableName() string { return "teams" }
// TeamMember 对应 team_members。
type TeamMember struct {
TeamID int64 `gorm:"primaryKey" json:"teamId"`
UserID int64 `gorm:"primaryKey" json:"userId"`
Role string `gorm:"size:16;not null;default:member" json:"role"`
JoinedAt string `gorm:"size:32;not null" json:"joinedAt"`
}
func (TeamMember) TableName() string { return "team_members" }
// TeamTask 对应 team_tasks。
type TeamTask struct {
ID int64 `gorm:"primaryKey" json:"id"`
TeamID int64 `gorm:"not null;index" json:"teamId"`
Kind string `gorm:"size:16;not null;default:todo" json:"kind"`
Title string `gorm:"type:text;not null" json:"title"`
Description string `gorm:"type:mediumtext;not null" json:"description"`
Priority string `gorm:"size:16;not null;default:medium" json:"priority"`
Status string `gorm:"size:16;not null;default:open" json:"status"`
CreatorID int64 `gorm:"not null" json:"creatorId"`
AssigneeID int64 `gorm:"not null;default:0;index" json:"assigneeId"`
StartAt string `gorm:"size:32;not null;default:''" json:"startAt"`
DueAt string `gorm:"size:32;not null;default:''" json:"dueAt"`
UrgedAt string `gorm:"size:32;not null;default:''" json:"urgedAt"`
History string `gorm:"type:mediumtext;not null" json:"history"`
UpdatedAt string `gorm:"size:32;not null" json:"updatedAt"`
Deleted int `gorm:"not null;default:0" json:"deleted"`
}
func (TeamTask) TableName() string { return "team_tasks" }
// TeamReport 对应 team_reports。
type TeamReport struct {
TeamID int64 `gorm:"primaryKey" json:"teamId"`
UserID int64 `gorm:"primaryKey" json:"userId"`
Date string `gorm:"primaryKey;size:10" json:"date"`
Content string `gorm:"type:mediumtext;not null" json:"content"`
SubmittedAt string `gorm:"size:32;not null" json:"submittedAt"`
}
func (TeamReport) TableName() string { return "team_reports" }
// TeamDigest 对应 team_digests。
type TeamDigest struct {
TeamID int64 `gorm:"primaryKey" json:"teamId"`
Date string `gorm:"primaryKey;size:10" json:"date"`
Content string `gorm:"type:mediumtext;not null" json:"content"`
Provider string `gorm:"size:32;not null;default:''" json:"provider"`
GeneratedAt string `gorm:"size:32;not null" json:"generatedAt"`
}
func (TeamDigest) TableName() string { return "team_digests" }
// TeamNotice 对应 team_notices。
type TeamNotice struct {
ID int64 `gorm:"primaryKey" json:"id"`
TeamID int64 `gorm:"not null" json:"teamId"`
ToUser int64 `gorm:"not null;index" json:"toUser"`
FromUser int64 `gorm:"not null" json:"fromUser"`
Kind string `gorm:"size:16;not null" json:"kind"`
RefID string `gorm:"size:64;not null;default:''" json:"refId"`
Content string `gorm:"type:text;not null" json:"content"`
CreatedAt string `gorm:"size:32;not null" json:"createdAt"`
}
func (TeamNotice) TableName() string { return "team_notices" }