package models import "time" type Customers struct { Customerid int `json:"customerid" gorm:"Primary_Key"` Firstname string `json:"firstname"` Lastname string `json:"lastname"` Profileimage string `json:"profileimage"` Gender string `json:"gender"` Dob string `json:"dob"` Dialcode string `json:"dialcode"` Contactno string `json:"contactno"` Email string `json:"email"` Deviceid string `json:"deviceid"` Devicetype string `json:"devicetype"` Authmode int `json:"authmode"` Configid int `json:"configid"` Customertoken string `json:"customertoken"` Address string `json:"address"` Suburb string `json:"suburb"` City string `json:"city"` State string `json:"state"` Landmark string `json:"landmark"` Doorno string `json:"doorno"` Postcode string `json:"postcode"` // Numbers from a map picker, strings from a text field — see // Customerlocations below. A customer must exist before an order can be // placed, so a 400 here blocks the whole flow, not just the address. Latitude FlexibleString `json:"latitude"` Longitude FlexibleString `json:"longitude"` Applocationid int `json:"applocationid"` Locationid int `json:"locationid,omitempty" gorm:"-"` Defaultaddress string `json:"defaultaddress,omitempty" gorm:"-"` Primaryaddress int `json:"primaryaddress,omitempty" gorm:"-"` Tenantid int `json:"tenantid,omitempty" gorm:"-"` Status int `json:"status"` Intro string `json:"intro"` Qrmode int `json:"qrmode,omitempty" gorm:"-"` } type CustomerInfo struct { Customerid int `json:"customerid"` Firstname string `json:"firstname"` Lastname string `json:"lastname"` Profileimage string `json:"profileimage"` Gender string `json:"gender"` Dob string `json:"dob"` Dialcode string `json:"dialcode"` Contactno string `json:"contactno"` Email string `json:"email"` Deviceid string `json:"deviceid"` Devicetype string `json:"devicetype"` Authmode int `json:"authmode"` Configid int `json:"configid"` Customertoken string `json:"customertoken"` Deliverylocationid int `json:"deliverylocationid"` Address string `json:"address"` Suburb string `json:"suburb"` City string `json:"city"` State string `json:"state"` Landmark string `json:"landmark"` Doorno string `json:"doorno"` Postcode string `json:"postcode"` Latitude string `json:"latitude"` Longitude string `json:"longitude"` Applocationid int `json:"applocationid"` Allocationid int `json:"allocationid"` Primaryaddress int `json:"primaryaddress"` Tenantlocationid int `json:"tenantlocationid"` Tenantid int `json:"tenantid"` Status int `json:"status"` Intro string `json:"intro"` Selectedlatitude string `json:"selectedlatitude"` Selectedlongitude string `json:"selectedlongitude"` Radius string `json:"radius"` Qrmode int `json:"qrmode"` } type CustomerLocationResult struct { Code int `json:"code"` Status bool `json:"status"` Message string `json:"message"` Details []Customerlocations `json:"details"` } type Customerlocations struct { Locationid int `json:"locationid" gorm:"Primary_Key"` Customerid int `json:"customerid"` // The query joins customers to select b.applocationid; `gorm:"-"` then threw // it away, so every address came back with 0 however the join resolved. Applocationid int `json:"applocationid" gorm:"->"` Address string `json:"address"` Suburb string `json:"suburb"` City string `json:"city"` State string `json:"state"` Landmark string `json:"landmark"` Doorno string `json:"doorno"` Postcode string `json:"postcode"` // Latitude and longitude arrive as NUMBERS from a map picker and as strings // from a text field. A strict type rejected the first, and BodyParser fails // the WHOLE request on one unreadable field — so a shopper who set their // location on a map got 400 and no saved address. Same treatment the order // model already gives Pickuplat and Pickuplong. Latitude FlexibleString `json:"latitude"` Longitude FlexibleString `json:"longitude"` // A "make this my default" checkbox sends true, a form sends 1, a text // input sends "1". All three mean the same thing. Primaryaddress FlexibleInt `json:"primaryaddress"` // Sent as 1, as "1", or as the word "Active", depending on the caller. Status FlexibleInt `json:"status"` // Selected by GetCustomerLocations and, until now, dropped on the floor: // the struct had no field for it, so the column marking the chosen address // never reached the app. Defaultaddress string `json:"defaultaddress"` } type CustomerRequest struct { Customerrequestid int `json:"customerrequestid" gorm:"primaryKey;autoIncrement"` Referencedate time.Time `json:"referencedate"` Referencetype string `json:"referencetype"` Customerid int `json:"customerid"` Tenantid int `json:"tenantid"` Apptypeid int `json:"apptypeid"` Locationid int `json:"locationid"` Subject string `json:"subject"` Remarks string `json:"remarks"` Status int `json:"status"` Created time.Time `json:"created"` Updated time.Time `json:"updated"` } type Tenantcustomers struct { Tenantcustomerid int `json:"tenantcustomerid" gorm:"Primary_Key"` Tenantid int `json:"tenantid" ` Locationid int `json:"locationid"` Customerid int `json:"customerid"` Moduleid int `json:"moduleid"` Status int `json:"status"` }