cmc-sales/go-app/internal/cmc/db/models.go
2025-06-24 20:32:28 +10:00

238 lines
7.5 KiB
Go

// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.29.0
package db
import (
"database/sql"
"database/sql/driver"
"fmt"
"time"
)
type UsersAccessLevel string
const (
UsersAccessLevelAdmin UsersAccessLevel = "admin"
UsersAccessLevelManager UsersAccessLevel = "manager"
UsersAccessLevelUser UsersAccessLevel = "user"
UsersAccessLevelNone UsersAccessLevel = "none"
)
func (e *UsersAccessLevel) Scan(src interface{}) error {
switch s := src.(type) {
case []byte:
*e = UsersAccessLevel(s)
case string:
*e = UsersAccessLevel(s)
default:
return fmt.Errorf("unsupported scan type for UsersAccessLevel: %T", src)
}
return nil
}
type NullUsersAccessLevel struct {
UsersAccessLevel UsersAccessLevel `json:"users_access_level"`
Valid bool `json:"valid"` // Valid is true if UsersAccessLevel is not NULL
}
// Scan implements the Scanner interface.
func (ns *NullUsersAccessLevel) Scan(value interface{}) error {
if value == nil {
ns.UsersAccessLevel, ns.Valid = "", false
return nil
}
ns.Valid = true
return ns.UsersAccessLevel.Scan(value)
}
// Value implements the driver Valuer interface.
func (ns NullUsersAccessLevel) Value() (driver.Value, error) {
if !ns.Valid {
return nil, nil
}
return string(ns.UsersAccessLevel), nil
}
type UsersType string
const (
UsersTypePrinciple UsersType = "principle"
UsersTypeContact UsersType = "contact"
UsersTypeUser UsersType = "user"
)
func (e *UsersType) Scan(src interface{}) error {
switch s := src.(type) {
case []byte:
*e = UsersType(s)
case string:
*e = UsersType(s)
default:
return fmt.Errorf("unsupported scan type for UsersType: %T", src)
}
return nil
}
type NullUsersType struct {
UsersType UsersType `json:"users_type"`
Valid bool `json:"valid"` // Valid is true if UsersType is not NULL
}
// Scan implements the Scanner interface.
func (ns *NullUsersType) Scan(value interface{}) error {
if value == nil {
ns.UsersType, ns.Valid = "", false
return nil
}
ns.Valid = true
return ns.UsersType.Scan(value)
}
// Value implements the driver Valuer interface.
func (ns NullUsersType) Value() (driver.Value, error) {
if !ns.Valid {
return nil, nil
}
return string(ns.UsersType), nil
}
type Country struct {
ID int32 `json:"id"`
Name string `json:"name"`
}
type Customer struct {
ID int32 `json:"id"`
// Company Name
Name string `json:"name"`
TradingName string `json:"trading_name"`
Abn sql.NullString `json:"abn"`
Created time.Time `json:"created"`
Notes string `json:"notes"`
DiscountPricingPolicies string `json:"discount_pricing_policies"`
PaymentTerms string `json:"payment_terms"`
CustomerCategoryID int32 `json:"customer_category_id"`
Url string `json:"url"`
CountryID int32 `json:"country_id"`
}
type Enquiry struct {
ID int32 `json:"id"`
Created time.Time `json:"created"`
Submitted sql.NullTime `json:"submitted"`
// enquirynumber
Title string `json:"title"`
UserID int32 `json:"user_id"`
CustomerID int32 `json:"customer_id"`
ContactID int32 `json:"contact_id"`
ContactUserID int32 `json:"contact_user_id"`
StateID int32 `json:"state_id"`
CountryID int32 `json:"country_id"`
PrincipleID int32 `json:"principle_id"`
StatusID int32 `json:"status_id"`
Comments string `json:"comments"`
// Numeric Principle Code
PrincipleCode int32 `json:"principle_code"`
// GST applicable on this enquiry
Gst bool `json:"gst"`
BillingAddressID sql.NullInt32 `json:"billing_address_id"`
ShippingAddressID sql.NullInt32 `json:"shipping_address_id"`
// has the enquired been posted
Posted bool `json:"posted"`
EmailCount int32 `json:"email_count"`
InvoiceCount int32 `json:"invoice_count"`
JobCount int32 `json:"job_count"`
QuoteCount int32 `json:"quote_count"`
Archived int8 `json:"archived"`
}
type Principle struct {
ID int32 `json:"id"`
Name string `json:"name"`
ShortName sql.NullString `json:"short_name"`
Code int32 `json:"code"`
}
type Product struct {
ID int32 `json:"id"`
// Principle FK
PrincipleID int32 `json:"principle_id"`
ProductCategoryID int32 `json:"product_category_id"`
// This must match the Title in the Excel Costing File
Title string `json:"title"`
Description string `json:"description"`
// Part or model number principle uses to identify this product
ModelNumber sql.NullString `json:"model_number"`
// %1% - first item, %2% , second item etc
ModelNumberFormat sql.NullString `json:"model_number_format"`
// Any notes about this product. Note displayed on quotes
Notes sql.NullString `json:"notes"`
// Stock or Ident
Stock bool `json:"stock"`
ItemCode string `json:"item_code"`
ItemDescription string `json:"item_description"`
}
type PurchaseOrder struct {
ID int32 `json:"id"`
IssueDate time.Time `json:"issue_date"`
DispatchDate time.Time `json:"dispatch_date"`
DateArrived time.Time `json:"date_arrived"`
// CMC PONumber
Title string `json:"title"`
PrincipleID int32 `json:"principle_id"`
PrincipleReference string `json:"principle_reference"`
DocumentID int32 `json:"document_id"`
CurrencyID sql.NullInt32 `json:"currency_id"`
OrderedFrom string `json:"ordered_from"`
Description string `json:"description"`
DispatchBy string `json:"dispatch_by"`
DeliverTo string `json:"deliver_to"`
ShippingInstructions string `json:"shipping_instructions"`
JobsText string `json:"jobs_text"`
FreightForwarderText string `json:"freight_forwarder_text"`
ParentPurchaseOrderID int32 `json:"parent_purchase_order_id"`
}
type State struct {
ID int32 `json:"id"`
Name string `json:"name"`
Shortform sql.NullString `json:"shortform"`
Enqform sql.NullString `json:"enqform"`
}
type Status struct {
ID int32 `json:"id"`
Name string `json:"name"`
Color sql.NullString `json:"color"`
}
type User struct {
ID int32 `json:"id"`
PrincipleID int32 `json:"principle_id"`
CustomerID int32 `json:"customer_id"`
Type UsersType `json:"type"`
AccessLevel UsersAccessLevel `json:"access_level"`
Username string `json:"username"`
Password string `json:"password"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
Email string `json:"email"`
JobTitle string `json:"job_title"`
Phone string `json:"phone"`
Mobile string `json:"mobile"`
Fax string `json:"fax"`
PhoneExtension string `json:"phone_extension"`
DirectPhone string `json:"direct_phone"`
Notes string `json:"notes"`
// Added by Vault. May or may not be a real person.
ByVault bool `json:"by_vault"`
// Disregard emails from this address in future.
Blacklisted bool `json:"blacklisted"`
Enabled bool `json:"enabled"`
Archived sql.NullBool `json:"archived"`
PrimaryContact bool `json:"primary_contact"`
}