init: Initial commit
This commit is contained in:
26
app/models/tenant.go
Normal file
26
app/models/tenant.go
Normal file
@@ -0,0 +1,26 @@
|
||||
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"
|
||||
}
|
||||
Reference in New Issue
Block a user