Files
mgmt-api/app/models/tenant.go
Björn Benouarets e13859a3ac init: Initial commit
2026-01-21 06:35:35 +01:00

27 lines
1.0 KiB
Go

package models
import (
"time"
"github.com/google/uuid"
"gorm.io/gorm"
)
type Tenant struct {
ID uuid.UUID `gorm:"type:uuid;primary_key;default:gen_random_uuid()" json:"id"`
Name string `gorm:"not null;unique" json:"name"`
Enabled bool `gorm:"not null;default:true" json:"enabled"`
AllowSelfRegistration bool `gorm:"not null;default:false" json:"allow_self_registration"`
AllowSelfRegistrationDomains *[]string `gorm:"type:jsonb" json:"allow_self_registration_domains"`
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"deleted_at"`
Users []User `gorm:"foreignKey:TenantID" json:"users"`
Applications []Application `gorm:"foreignKey:TenantID" json:"applications"`
}
func (Tenant) TableName() string {
return "tenants"
}