diff --git a/internal/announcement/model.go b/internal/announcement/model.go index 0587632..7824f38 100644 --- a/internal/announcement/model.go +++ b/internal/announcement/model.go @@ -1,9 +1,16 @@ package announcement -import "gorm.io/gorm" +import ( + "time" + + "gorm.io/gorm" +) type Announcement struct { - gorm.Model - Title string `gorm:"not null"` - Content string `gorm:"type:text;not null"` + ID uint `json:"id" gorm:"primaryKey"` + CreatedAt time.Time `json:"createdAt"` + UpdatedAt time.Time `json:"updatedAt"` + DeletedAt gorm.DeletedAt `json:"-" gorm:"index"` + Title string `json:"title" gorm:"not null"` + Content string `json:"content" gorm:"type:text;not null"` } diff --git a/internal/auth/model.go b/internal/auth/model.go index 68f1897..f859d2e 100644 --- a/internal/auth/model.go +++ b/internal/auth/model.go @@ -1,6 +1,10 @@ package auth -import "gorm.io/gorm" +import ( + "time" + + "gorm.io/gorm" +) type Role string @@ -10,8 +14,11 @@ const ( ) type User struct { - gorm.Model - Username string `gorm:"type:varchar(100);uniqueIndex;not null"` - PasswordHash string `gorm:"not null"` - Role Role `gorm:"default:'user'"` + ID uint `json:"id" gorm:"primaryKey"` + CreatedAt time.Time `json:"createdAt"` + UpdatedAt time.Time `json:"updatedAt"` + DeletedAt gorm.DeletedAt `json:"-" gorm:"index"` + Username string `json:"username" gorm:"type:varchar(100);uniqueIndex;not null"` + PasswordHash string `json:"-" gorm:"not null"` + Role Role `json:"role" gorm:"default:'user'"` } diff --git a/internal/download/model.go b/internal/download/model.go index 5638eab..5a78800 100644 --- a/internal/download/model.go +++ b/internal/download/model.go @@ -1,11 +1,18 @@ package download -import "gorm.io/gorm" +import ( + "time" + + "gorm.io/gorm" +) type Info struct { - gorm.Model - URL string `gorm:"not null"` - Version string `gorm:"not null"` - FileName string `gorm:"not null"` - FileSize string `gorm:"not null"` + ID uint `json:"id" gorm:"primaryKey"` + CreatedAt time.Time `json:"createdAt"` + UpdatedAt time.Time `json:"updatedAt"` + DeletedAt gorm.DeletedAt `json:"-" gorm:"index"` + URL string `json:"url" gorm:"not null"` + Version string `json:"version" gorm:"not null"` + FileName string `json:"fileName" gorm:"not null"` + FileSize string `json:"fileSize" gorm:"not null"` }