Refactor RefreshToken entity to replace TenantID with ClientID for consistency

This commit is contained in:
Habib Fatkhul Rohman 2025-10-15 21:13:27 +07:00
parent 9fc51fdefa
commit e27712ab18
1 changed files with 7 additions and 5 deletions

View File

@ -9,10 +9,12 @@ import (
type RefreshToken struct {
ID uuid.UUID `gorm:"type:uuid;primary_key;default:uuid_generate_v4()" json:"id"`
UserID uuid.UUID `gorm:"type:uuid;not null" json:"user_id"`
TenantID uuid.UUID `gorm:"type:uuid;not null" json:"tenant_id"`
ClientID uuid.UUID `gorm:"type:uuid;not null" json:"client_id"`
// TenantID uuid.UUID `gorm:"type:uuid;not null" json:"tenant_id"`
Token string `gorm:"type:varchar(255);not null;uniqueIndex" json:"token"`
ExpiresAt time.Time `gorm:"type:timestamp with time zone;not null" json:"expires_at"`
User User `gorm:"foreignKey:UserID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"-"`
Tenant Tenant `gorm:"foreignKey:TenantID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"-"`
User M_User `gorm:"foreignKey:UserID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"-"`
// Tenant Tenant `gorm:"foreignKey:TenantID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"-"`
Timestamp
}