mirror of
https://github.com/EZ-Api/ez-api.git
synced 2026-01-13 17:47:51 +00:00
style(core): align struct tags and fields
Standardize alignment of struct tags in models and field assignments in services for better readability. Additionally, include the Binding model in the test database auto-migration.
This commit is contained in:
@@ -11,31 +11,31 @@ import (
|
||||
// Master represents a tenant account.
|
||||
type Master struct {
|
||||
gorm.Model
|
||||
Name string `gorm:"size:255" json:"name"`
|
||||
MasterKey string `gorm:"size:255" json:"-"` // bcrypt hash of master key
|
||||
MasterKeyDigest string `gorm:"size:64;uniqueIndex" json:"-"` // sha256 digest for lookup
|
||||
Group string `gorm:"size:100;default:'default'" json:"group"` // routing group
|
||||
Name string `gorm:"size:255" json:"name"`
|
||||
MasterKey string `gorm:"size:255" json:"-"` // bcrypt hash of master key
|
||||
MasterKeyDigest string `gorm:"size:64;uniqueIndex" json:"-"` // sha256 digest for lookup
|
||||
Group string `gorm:"size:100;default:'default'" json:"group"` // routing group
|
||||
DefaultNamespace string `gorm:"size:100;default:'default'" json:"default_namespace"`
|
||||
Namespaces string `gorm:"size:1024;default:'default'" json:"namespaces"` // Comma-separated namespaces
|
||||
Epoch int64 `gorm:"default:1" json:"epoch"` // used for revocation/rotation
|
||||
Status string `gorm:"size:50;default:'active'" json:"status"` // active, suspended
|
||||
MaxChildKeys int `gorm:"default:5" json:"max_child_keys"`
|
||||
GlobalQPS int `gorm:"default:3" json:"global_qps"`
|
||||
Epoch int64 `gorm:"default:1" json:"epoch"` // used for revocation/rotation
|
||||
Status string `gorm:"size:50;default:'active'" json:"status"` // active, suspended
|
||||
MaxChildKeys int `gorm:"default:5" json:"max_child_keys"`
|
||||
GlobalQPS int `gorm:"default:3" json:"global_qps"`
|
||||
}
|
||||
|
||||
// Key represents a child access token issued by a Master.
|
||||
type Key struct {
|
||||
gorm.Model
|
||||
MasterID uint `gorm:"not null;index" json:"master_id"`
|
||||
KeySecret string `gorm:"size:255;column:key_secret" json:"-"` // bcrypt hash of child key
|
||||
TokenHash string `gorm:"size:64;uniqueIndex" json:"token_hash"` // sha256 digest of child key
|
||||
Group string `gorm:"size:100;default:'default'" json:"group"` // routing group
|
||||
Scopes string `gorm:"size:1024" json:"scopes"` // Comma-separated scopes
|
||||
MasterID uint `gorm:"not null;index" json:"master_id"`
|
||||
KeySecret string `gorm:"size:255;column:key_secret" json:"-"` // bcrypt hash of child key
|
||||
TokenHash string `gorm:"size:64;uniqueIndex" json:"token_hash"` // sha256 digest of child key
|
||||
Group string `gorm:"size:100;default:'default'" json:"group"` // routing group
|
||||
Scopes string `gorm:"size:1024" json:"scopes"` // Comma-separated scopes
|
||||
DefaultNamespace string `gorm:"size:100;default:'default'" json:"default_namespace"`
|
||||
Namespaces string `gorm:"size:1024;default:'default'" json:"namespaces"` // Comma-separated namespaces
|
||||
IssuedAtEpoch int64 `gorm:"not null" json:"issued_at_epoch"` // copy of master epoch at issuance
|
||||
Status string `gorm:"size:50;default:'active'" json:"status"` // active, suspended
|
||||
IssuedBy string `gorm:"size:20;default:'master'" json:"issued_by"`
|
||||
IssuedAtEpoch int64 `gorm:"not null" json:"issued_at_epoch"` // copy of master epoch at issuance
|
||||
Status string `gorm:"size:50;default:'active'" json:"status"` // active, suspended
|
||||
IssuedBy string `gorm:"size:20;default:'master'" json:"issued_by"`
|
||||
}
|
||||
|
||||
// Provider remains the same.
|
||||
|
||||
Reference in New Issue
Block a user