feat(tenant): 增加租户基础与域名解析
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"gorm.io/datatypes"
|
||||
)
|
||||
|
||||
type Tenant struct {
|
||||
ID uint64 `gorm:"primaryKey" json:"id"`
|
||||
Code string `gorm:"size:32;not null;uniqueIndex:uk_tenants_code" json:"code"`
|
||||
Name string `gorm:"size:64;not null" json:"name"`
|
||||
Status string `gorm:"size:16;not null;default:'active';index" json:"status"`
|
||||
ProfileJSON datatypes.JSON `gorm:"type:json" json:"profile_json"`
|
||||
FeaturesJSON datatypes.JSON `gorm:"type:json" json:"features_json"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
func (Tenant) TableName() string {
|
||||
return "tenants"
|
||||
}
|
||||
|
||||
type TenantDomain struct {
|
||||
ID uint64 `gorm:"primaryKey" json:"id"`
|
||||
TenantID uint64 `gorm:"not null;index:idx_tenant_domains_tenant" json:"tenant_id"`
|
||||
Host string `gorm:"size:255;not null;uniqueIndex:uk_tenant_domains_host" json:"host"`
|
||||
DomainType string `gorm:"size:32;not null;default:'storefront'" json:"domain_type"`
|
||||
Status string `gorm:"size:16;not null;default:'active';index:idx_tenant_domains_tenant" json:"status"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
func (TenantDomain) TableName() string {
|
||||
return "tenant_domains"
|
||||
}
|
||||
|
||||
type TenantListingOffer struct {
|
||||
ID uint64 `gorm:"primaryKey" json:"id"`
|
||||
TenantID uint64 `gorm:"not null;uniqueIndex:uk_tenant_listing_offers_listing;index:idx_tenant_listing_offers_display" json:"tenant_id"`
|
||||
ListingID uint64 `gorm:"not null;uniqueIndex:uk_tenant_listing_offers_listing;index:idx_tenant_listing_offers_display" json:"listing_id"`
|
||||
DisplayStatus string `gorm:"size:16;not null;default:'enabled';index:idx_tenant_listing_offers_display" json:"display_status"`
|
||||
PriceCent *int64 `json:"price_cent"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
func (TenantListingOffer) TableName() string {
|
||||
return "tenant_listing_offers"
|
||||
}
|
||||
Reference in New Issue
Block a user