Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions backend/internal/model/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ var AllModels = []interface{}{
&WebsiteConfig{},
&OperationLog{},
&UniqueView{},
&About{},
}

// AutoMigrate 自动迁移所有表
Expand Down
21 changes: 21 additions & 0 deletions backend/internal/model/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,24 @@ type UniqueView struct {
}

func (UniqueView) TableName() string { return "tb_unique_view" }

// About 个人信息(用于「关于」页面,由管理员维护后展示给访客)
//
// 单行表设计:整站只有一份「关于我」,用 First/Init 取第一行;不存在时 Init 一条空记录,
// 这样无需在前端处理「配置尚未初始化」的分支,简化读写语义。
type About struct {
BaseModel
Avatar string `gorm:"type:varchar(1024);not null;default:''" json:"avatar"`
Nickname string `gorm:"type:varchar(50);not null" json:"nickname"`
Intro string `gorm:"type:varchar(255)" json:"intro"`
Bio string `gorm:"type:text" json:"bio"`
Email string `gorm:"type:varchar(100)" json:"email"`
Website string `gorm:"type:varchar(255)" json:"website"`
Github string `gorm:"type:varchar(255)" json:"github"`
TechStack string `gorm:"type:text" json:"techStack"`
BackendSkills string `gorm:"type:text" json:"backendSkills"`
FrontendSkills string `gorm:"type:text" json:"frontendSkills"`
OtherSkills string `gorm:"type:text" json:"otherSkills"`
}

func (About) TableName() string { return "tb_about" }
Loading