From e27712ab18a07eb900c271f88f98b9974c099031 Mon Sep 17 00:00:00 2001 From: Habib Fatkhul Rohman Date: Wed, 15 Oct 2025 21:13:27 +0700 Subject: [PATCH] Refactor RefreshToken entity to replace TenantID with ClientID for consistency --- database/entities/refresh_token_entity.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/database/entities/refresh_token_entity.go b/database/entities/refresh_token_entity.go index a41df38..ea924e8 100644 --- a/database/entities/refresh_token_entity.go +++ b/database/entities/refresh_token_entity.go @@ -7,12 +7,14 @@ 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"` + 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"` + 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 }