wms-be/database/entities/refresh_token_entity.go

19 lines
701 B
Go

package entities
import (
"time"
"github.com/google/uuid"
)
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"`
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:"-"`
Timestamp
}