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

36 lines
946 B
Go

package models
import "time"
type Token struct {
ID int64 `json:"-" db:"id" gorm:"primary_key"`
UserID int64 `json:"user_id" db:"user_id" gorm:"index;"`
Token string `json:"token" db:"token" gorm:"size:255;index;"`
RefreshToken string `json:"refresh_token" db:"refresh_token" gorm:"size:255;index;"`
Status string `json:"status" gorm:"size:3;index"`
RegisterAt time.Time `json:"register_at" db:"register_at"`
EndingAt time.Time `json:"ending_at" db:"ending_at"`
}
// 테이블이름 정의
func (Token) TableName() string {
return "UserTokens"
}
type RefreshTokenRequest struct {
RefreshToken string `json:"refresh_token" binding:"required"`
}
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"`
}