init: Initial commit

This commit is contained in:
Björn Benouarets
2026-01-21 06:35:35 +01:00
commit e13859a3ac
30 changed files with 1224 additions and 0 deletions

26
app/models/tenant.go Normal file
View 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"
}