From ec6ac35ac7f880b5d8a972a2e8d41d9c460230d2 Mon Sep 17 00:00:00 2001 From: tolelom <98kimsungmin@naver.com> Date: Tue, 24 Feb 2026 14:32:11 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20=EB=AA=A8=EB=8D=B8=EC=97=90=20JSON?= =?UTF-8?q?=20=ED=83=9C=EA=B7=B8=20=EC=B6=94=EA=B0=80=20=EB=B0=8F=20gorm.M?= =?UTF-8?q?odel=20=EC=9D=B8=EB=9D=BC=EC=9D=B8=20=ED=99=95=EC=9E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit camelCase JSON 필드명으로 통일, PasswordHash json:"-" 처리 Co-Authored-By: Claude Sonnet 4.6 --- internal/announcement/model.go | 15 +++++++++++---- internal/auth/model.go | 17 ++++++++++++----- internal/download/model.go | 19 +++++++++++++------ 3 files changed, 36 insertions(+), 15 deletions(-) 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"` }