Files
a301_server/internal/auth/model.go
tolelom 9738f1a83c
All checks were successful
Server CI/CD / deploy (push) Successful in 1m26s
fix: SSAFYTokenResponse.expires_in 타입을 int로 수정
SSAFY 서버가 expires_in을 숫자로 반환하므로 string에서 int로 변경.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 01:21:01 +09:00

42 lines
1.2 KiB
Go

package auth
import (
"time"
"gorm.io/gorm"
)
type Role string
const (
RoleAdmin Role = "admin"
RoleUser Role = "user"
)
type User struct {
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'"`
SsafyID *string `json:"ssafyId,omitempty" gorm:"type:varchar(100);uniqueIndex"`
}
// SSAFY OAuth 응답 구조체
type SSAFYTokenResponse struct {
TokenType string `json:"token_type"`
AccessToken string `json:"access_token"`
Scope string `json:"scope"`
ExpiresIn int `json:"expires_in"`
RefreshToken string `json:"refresh_token"`
RefreshTokenExpiresIn int `json:"refresh_token_expires_in"`
}
type SSAFYUserInfo struct {
UserID string `json:"userId"`
Email string `json:"email"`
Name string `json:"name"`
}