refactor: 모델에 JSON 태그 추가 및 gorm.Model 인라인 확장
All checks were successful
Server CI/CD / deploy (push) Successful in 35s
All checks were successful
Server CI/CD / deploy (push) Successful in 35s
camelCase JSON 필드명으로 통일, PasswordHash json:"-" 처리 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,9 +1,16 @@
|
|||||||
package announcement
|
package announcement
|
||||||
|
|
||||||
import "gorm.io/gorm"
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"gorm.io/gorm"
|
||||||
|
)
|
||||||
|
|
||||||
type Announcement struct {
|
type Announcement struct {
|
||||||
gorm.Model
|
ID uint `json:"id" gorm:"primaryKey"`
|
||||||
Title string `gorm:"not null"`
|
CreatedAt time.Time `json:"createdAt"`
|
||||||
Content string `gorm:"type:text;not null"`
|
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"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
package auth
|
package auth
|
||||||
|
|
||||||
import "gorm.io/gorm"
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"gorm.io/gorm"
|
||||||
|
)
|
||||||
|
|
||||||
type Role string
|
type Role string
|
||||||
|
|
||||||
@@ -10,8 +14,11 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type User struct {
|
type User struct {
|
||||||
gorm.Model
|
ID uint `json:"id" gorm:"primaryKey"`
|
||||||
Username string `gorm:"type:varchar(100);uniqueIndex;not null"`
|
CreatedAt time.Time `json:"createdAt"`
|
||||||
PasswordHash string `gorm:"not null"`
|
UpdatedAt time.Time `json:"updatedAt"`
|
||||||
Role Role `gorm:"default:'user'"`
|
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'"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,18 @@
|
|||||||
package download
|
package download
|
||||||
|
|
||||||
import "gorm.io/gorm"
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"gorm.io/gorm"
|
||||||
|
)
|
||||||
|
|
||||||
type Info struct {
|
type Info struct {
|
||||||
gorm.Model
|
ID uint `json:"id" gorm:"primaryKey"`
|
||||||
URL string `gorm:"not null"`
|
CreatedAt time.Time `json:"createdAt"`
|
||||||
Version string `gorm:"not null"`
|
UpdatedAt time.Time `json:"updatedAt"`
|
||||||
FileName string `gorm:"not null"`
|
DeletedAt gorm.DeletedAt `json:"-" gorm:"index"`
|
||||||
FileSize string `gorm:"not null"`
|
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"`
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user