package database import "time" // APIKey represents an API key for a user. // // Key is a bearer credential, so it is never marshalled with the // model. A creation handler that has to show it once returns it in its // own response type. type APIKey struct { BaseModel UserID string `gorm:"type:uuid;not null" json:"userId"` Key string `gorm:"uniqueIndex;not null" json:"-"` Description string `json:"description"` LastUsedAt *time.Time `json:"lastUsedAt,omitempty"` // Relations User User `json:"user,omitzero"` }