variants units
This commit is contained in:
@@ -3,37 +3,40 @@ 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"`
|
||||
Latitude string `json:"latitude"`
|
||||
Longitude string `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:"-"`
|
||||
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 {
|
||||
@@ -82,20 +85,37 @@ type CustomerLocationResult struct {
|
||||
}
|
||||
|
||||
type Customerlocations struct {
|
||||
Locationid int `json:"locationid" gorm:"Primary_Key"`
|
||||
Customerid int `json:"customerid"`
|
||||
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 string `json:"latitude"`
|
||||
Longitude string `json:"longitude"`
|
||||
Primaryaddress int `json:"primaryaddress"`
|
||||
Status int `json:"status"`
|
||||
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 {
|
||||
|
||||
Reference in New Issue
Block a user