first commit

This commit is contained in:
2023-10-19 22:47:12 +09:00
commit 7873968e4d
35 changed files with 1710 additions and 0 deletions

11
internal/models/auth.go Normal file
View File

@ -0,0 +1,11 @@
package models
type LoginRequest struct {
Username string `json:"username"`
Password string `json:"password"`
}
type RegisterRequest struct {
Username string `json:"username"`
Password string `json:"password"`
}

25
internal/models/token.go Normal file
View File

@ -0,0 +1,25 @@
package models
import "time"
type Token struct {
ID string `json:"id" db:"id" gorm:"column:id;size:255;primary_key;"`
UserID string `json:"user_id" db:"user_id" gorm:"column:user_id;size:255;index;"`
Token string `json:"token" gorm:"column:token;size:255;index;"`
RefreshToken string `json:"refresh_token" gorm:"column:token;size:255;index;"`
Status string `json:"status" gorm:"column:status;size:10;index;"`
ExpireAt time.Time `json:"expire_at" gorm:"column:expire_at;index;"`
UpdatedAt time.Time `json:"updated_at" gorm:"column:updated_at;index;"`
CreatedAt time.Time `json:"created_at" gorm:"column:created_at;index;"`
}
type TokenResponse struct {
Token string `json:"token"`
TokenBody TokenBody `json:"tokenBody"`
}
type TokenBody struct {
ExpireAt time.Time `json:"tokenExpiredDate"`
TokenIdx int `json:"tokenIdx"`
TokenType int `json:"tokenType"`
}

9
internal/models/user.go Normal file
View File

@ -0,0 +1,9 @@
package models
type User struct {
ID string `json:"id" db:"id" gorm:"column:id;size:255;primary_key;"`
Username string `json:"username" db:"username" gorm:"column:username;size:50;uniqueIndex;"`
Score int32 `json:"score" db:"score" gorm:"column:score;"`
Money int32 `json:"money" db:"money" gorm:"column:money;"`
Password string `json:"-" db:"password" gorm:"column:password;size:255;not null;"`
}