feat: initial lifelog project
- 待办事项(支持优先级、截止日期) - 每日记录(上午/下午/晚上分条目) - Go后端 + Gin + GORM + MySQL - React前端 + TailwindCSS
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type Todo struct {
|
||||
ID uint64 `gorm:"primaryKey;autoIncrement" json:"id"`
|
||||
Title string `gorm:"type:varchar(255);not null" json:"title"`
|
||||
Done bool `gorm:"type:tinyint(1);not null;default:0" json:"done"`
|
||||
Priority int `gorm:"type:tinyint(1);not null;default:2" json:"priority"` // 1高 2中 3低
|
||||
DueDate *time.Time `gorm:"type:date" json:"due_date"` // 可选截止日期
|
||||
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
|
||||
UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"`
|
||||
}
|
||||
|
||||
func (Todo) TableName() string {
|
||||
return "todos"
|
||||
}
|
||||
|
||||
type DailyLog struct {
|
||||
ID uint64 `gorm:"primaryKey;autoIncrement" json:"id"`
|
||||
Date string `gorm:"type:date;not null;uniqueIndex" json:"date"` // 格式:2024-07-24
|
||||
Morning string `gorm:"type:text" json:"morning"`
|
||||
Afternoon string `gorm:"type:text" json:"afternoon"`
|
||||
Evening string `gorm:"type:text" json:"evening"`
|
||||
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
|
||||
UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"`
|
||||
}
|
||||
|
||||
func (DailyLog) TableName() string {
|
||||
return "daily_logs"
|
||||
}
|
||||
Reference in New Issue
Block a user