27 lines
1.0 KiB
Go
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" 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;not null" 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"
|
|
}
|