cslms-api/internal/models/user.go
2023-12-29 00:27:12 +09:00

32 lines
1.7 KiB
Go

package models
import "time"
type User struct {
ID int64 `json:"id" db:"id" example:"100001" gorm:"column:id;primary_key;"`
GUID string `json:"guid_id" db:"guid_id" example:"137c1683-2ad6-4201-b256-253828b61c49" gorm:"column:guid_id;size:255;"`
FirstName string `json:"first_name" db:"first_name" example:"길순" gorm:"column:first_name;size:255;"`
LastName string `json:"last_name" db:"last_name" example:"홍" gorm:"column:last_name;size:255;"`
Username string `json:"user_name" db:"user_name" example:"user0" gorm:"column:user_name;size:50;uniqueIndex;"`
Password string `json:"-" db:"password" gorm:"column:password;size:255;not null;"`
Gender string `json:"gender" db:"gender" example:"F" gorm:"column:gender;size:1;"`
UserRole string `json:"user_role" db:"user_role" example:"member" gorm:"column:user_role;size:255;"`
Memo string `json:"memo_cs" db:"memo_cs" example:"사용자 메모" gorm:"column:memo_cs;size:255;"`
Phone string `json:"phone_cs" db:"phone_cs" example:"010-1234-5678" gorm:"column:phone_cs;size:255;"`
Image string `json:"upload_image" db:"upload_image" example:"image_url" gorm:"column:upload_image;size:255;"`
RegisterAt time.Time `json:"register_at" db:"regiser_at" gorm:"column:register_at;type:DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP;index;->:false"`
}
// 테이블이름 정의
func (User) TableName() string {
return "Users"
}
type UserListResponse struct {
Data []User `json:"data"`
Total int64 `json:"total" example:"90"`
Page int `json:"page" example:"1"`
TotalPage int64 `json:"totalPage" example:"9"`
PageSize int `json:"pageSize" example:"10"`
}