Documentation ¶
Overview ¶
Package model is responsible for the models
Index ¶
Constants ¶
View Source
const ClientBillingAddressType = "client_billing"
View Source
const ClientShippingAddressType = "client_shipping"
View Source
const CompanyBillingAddressType = "company_billing"
View Source
const CompanyShippingAddressType = "company_shipping"
Variables ¶
View Source
var AllPreferredContact = []PreferredContact{ PreferredContactPhone, PreferredContactMobile, PreferredContactEmail, }
Functions ¶
func UnmarshalID ¶
UnmarshalID implements reverse marshalling for IDs from strings
Types ¶
type Address ¶
type Address struct { SoftDelete Name string Street1 string Street2 *string City string State *string PostalCode int Country string AddresseeID hide.ID AddresseeType string }
func MapInputToAddress ¶ added in v0.0.3
func MapInputToAddress(in modelgen.CreateAddressInput) Address
type Client ¶
type Client struct { SoftDelete Name string Website *string VatNumber *string BusinessNumber *string Phone *string BillingAddress Address `gorm:"polymorphic:Addressee;polymorphicValue:client_billing"` ShippingAddress Address `gorm:"polymorphic:Addressee;polymorphicValue:client_shipping"` Contacts []Contact CompanyID hide.ID `json:"company"` Company Company `json:"-"` }
type Company ¶
type Company struct { SoftDelete Code string `gorm:"unique_index:idx_code"` Name string Users []User Domains []Domain Website string Clients []Client BillingAddress Address `gorm:"polymorphic:Addressee;polymorphicValue:company_billing"` ShippingAddress Address `gorm:"polymorphic:Addressee;polymorphicValue:company_shipping"` }
Company model
type Contact ¶
type Contact struct { SoftDelete ClientID hide.ID Email *string Phone *string Mobile *string PreferredContact *PreferredContact Firstname string Lastname string }
type Model ¶
type Model struct { ID hide.ID `gorm:"type: bigserial;primary_key" json:"id"` // int64 CreatedAt time.Time UpdatedAt time.Time }
Model Default model structure with hard deleting
type PreferredContact ¶
type PreferredContact string
const ( PreferredContactPhone PreferredContact = "PHONE" PreferredContactMobile PreferredContact = "MOBILE" PreferredContactEmail PreferredContact = "EMAIL" )
func (PreferredContact) IsValid ¶
func (e PreferredContact) IsValid() bool
func (PreferredContact) MarshalGQL ¶
func (e PreferredContact) MarshalGQL(w io.Writer)
func (PreferredContact) String ¶
func (e PreferredContact) String() string
func (*PreferredContact) UnmarshalGQL ¶
func (e *PreferredContact) UnmarshalGQL(v interface{}) error
type SoftDelete ¶
type SoftDelete struct { ID hide.ID `gorm:"type: bigserial;primary_key" json:"id"` // int64 CreatedAt time.Time UpdatedAt time.Time DeletedAt *time.Time }
SoftDelete Default model structure with soft deleting
func (SoftDelete) IDstring ¶
func (m SoftDelete) IDstring() string
IDstring returns the ID as a hash string
type TwoFactor ¶
type TwoFactor struct { Model UserID hide.ID Secret string BackupKeys pq.StringArray `gorm:"type:varchar(10)[]"` }
TwoFactor model contains the 2FA data for a user
type User ¶
type User struct { SoftDelete Email string `gorm:"UNIQUE_INDEX:idx_email"` Phone *string Mobile *string PreferredContact *PreferredContact Password string Firstname string Lastname string CompanyID hide.ID `json:"company"` Company Company `json:"-"` BuiltinRoles []permission.BuiltinRole `gorm:"many2many:user_builtinroles" json:"-"` CustomRoles []permission.CustomRole `gorm:"many2many:user_customroles" json:"-"` TwoFactor TwoFactor }
User model
func (User) Roles ¶
func (u User) Roles() []permission.Role
Roles returns all roles a user has as the Role interface
Click to show internal directories.
Click to hide internal directories.