endpoint to update JWT cookies

This commit is contained in:
Daniel Goc
2026-03-18 15:40:54 +01:00
parent 01c8f4333f
commit e094865fc7
7 changed files with 167 additions and 30 deletions

View File

@@ -25,7 +25,8 @@ type Customer struct {
PasswordResetExpires *time.Time `json:"-"`
LastPasswordResetRequest *time.Time `json:"-"`
LastLoginAt *time.Time `json:"last_login_at,omitempty"`
Lang string `gorm:"size:10;default:'en'" json:"lang"` // User's preferred language
LangID uint `gorm:"default:2" json:"lang_id"` // User's preferred language
CountryID uint `gorm:"default:2" json:"country_id"` // User's selected country
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
@@ -76,9 +77,8 @@ type UserSession struct {
Email string `json:"email"`
Username string `json:"username"`
Role CustomerRole `json:"role"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
Lang string `json:"lang"`
LangID uint `json:"lang_id"`
CountryID uint `json:"country_id"`
}
// ToSession converts User to UserSession
@@ -87,9 +87,8 @@ func (u *Customer) ToSession() *UserSession {
UserID: u.ID,
Email: u.Email,
Role: u.Role,
FirstName: u.FirstName,
LastName: u.LastName,
Lang: u.Lang,
LangID: u.LangID,
CountryID: u.CountryID,
}
}
@@ -107,7 +106,8 @@ type RegisterRequest struct {
ConfirmPassword string `json:"confirm_password" form:"confirm_password"`
FirstName string `json:"first_name" form:"first_name"`
LastName string `json:"last_name" form:"last_name"`
Lang string `form:"lang" json:"lang"`
LangID uint `form:"lang_id" json:"lang_id"`
CountryID uint `form:"country_id" json:"country_id"`
}
// CompleteRegistrationRequest represents the completion of registration with email verification