delivery slot updated in orders and deliveries fix
This commit is contained in:
@@ -130,23 +130,39 @@ type OrderInfo struct {
|
||||
Deliverylat FlexibleString `json:"deliverylat"`
|
||||
Deliverylong FlexibleString `json:"deliverylong"`
|
||||
Deliverytype string `json:"deliverytype"`
|
||||
Paymenttype int `json:"paymenttype"`
|
||||
Tenantname string `json:"tenantname"`
|
||||
Tenanttoken string `json:"tenanttoken"`
|
||||
Tenantsuburb string `json:"tenantsuburb"`
|
||||
Tenantcity string `json:"tenantcity"`
|
||||
Tenantcontactno string `json:"tenantcontactno"`
|
||||
Tenantpostcode string `json:"tenantpostcode"`
|
||||
Locationname string `json:"locationname"`
|
||||
Locationsuburb string `json:"locationsuburb"`
|
||||
Locationcity string `json:"locationcity"`
|
||||
Locationcontactno string `json:"locationcontactno"`
|
||||
Rider string `json:"rider"`
|
||||
Ridercontactno string `json:"ridercontactno"`
|
||||
Riderkms FlexibleString `json:"riderkms"`
|
||||
Smsdelivery int `json:"smsdelivery"`
|
||||
Customertoken string `json:"customertoken"`
|
||||
Ridertoken string `json:"ridertoken"`
|
||||
// The delivery window the customer asked for.
|
||||
//
|
||||
// ON THIS STRUCT, not only on Orders. GetTenantOrders — which is what the
|
||||
// console and the app both read — scans into OrderInfo, so fields added to
|
||||
// Orders alone never reach the list. That was the whole of the
|
||||
// products.showhealthscore bug: written correctly, selected correctly,
|
||||
// absent from the response, and every reading taken from it meaningless.
|
||||
//
|
||||
// The last four are joined from deliveryslots and read-only, so a shop that
|
||||
// renames a window sees the new name on orders already placed.
|
||||
Deliveryslotid int `json:"deliveryslotid" gorm:"column:deliveryslotid"`
|
||||
Deliveryslotdate string `json:"deliveryslotdate" gorm:"column:deliveryslotdate"`
|
||||
Slotkey string `json:"slotkey" gorm:"->"`
|
||||
Deliveryslotname string `json:"deliveryslotname" gorm:"->"`
|
||||
Deliveryslotstart string `json:"deliveryslotstart" gorm:"->"`
|
||||
Deliveryslotend string `json:"deliveryslotend" gorm:"->"`
|
||||
Paymenttype int `json:"paymenttype"`
|
||||
Tenantname string `json:"tenantname"`
|
||||
Tenanttoken string `json:"tenanttoken"`
|
||||
Tenantsuburb string `json:"tenantsuburb"`
|
||||
Tenantcity string `json:"tenantcity"`
|
||||
Tenantcontactno string `json:"tenantcontactno"`
|
||||
Tenantpostcode string `json:"tenantpostcode"`
|
||||
Locationname string `json:"locationname"`
|
||||
Locationsuburb string `json:"locationsuburb"`
|
||||
Locationcity string `json:"locationcity"`
|
||||
Locationcontactno string `json:"locationcontactno"`
|
||||
Rider string `json:"rider"`
|
||||
Ridercontactno string `json:"ridercontactno"`
|
||||
Riderkms FlexibleString `json:"riderkms"`
|
||||
Smsdelivery int `json:"smsdelivery"`
|
||||
Customertoken string `json:"customertoken"`
|
||||
Ridertoken string `json:"ridertoken"`
|
||||
}
|
||||
|
||||
type DeliveryQuery struct {
|
||||
|
||||
@@ -138,12 +138,22 @@ const (
|
||||
a.deliverycustomer,a.deliverycontactno,a.deliverylocation as deliverysuburb, a.deliverycity,a.paymenttype, a.smsdelivery, a.orderamount,
|
||||
b.tenantname, b.tenanttoken, b.primarycontact AS tenantcontactno, b.postcode AS tenantpostcode, b.suburb AS tenantsuburb,b.city AS tenantcity,
|
||||
c.locationname, c.contactno AS locationcontactno, c.postcode AS locationpostcode, c.suburb AS locationsuburb, c.city AS locationcity,
|
||||
d.locationname AS applocation
|
||||
d.locationname AS applocation,
|
||||
-- The delivery window, same as the 'base' select above.
|
||||
--
|
||||
-- BOTH selects need it. 'base' backs the console's list; this one backs the
|
||||
-- partner, customer, user and admin reads -- including the customer app's
|
||||
-- own order history, which is where a shopper expects to see the window
|
||||
-- they picked. Fixing one and not the other is how a field ends up present
|
||||
-- on some screens and silently absent on others.
|
||||
a.deliveryslotid, a.deliveryslotdate, s.slotkey, s.name AS deliveryslotname,
|
||||
s.starttime AS deliveryslotstart, s.endtime AS deliveryslotend
|
||||
FROM orders a
|
||||
LEFT JOIN tenants b ON a.tenantid = b.tenantid
|
||||
LEFT JOIN tenantlocations c ON a.locationid = c.locationid
|
||||
LEFT JOIN app_location d ON a.applocationid = d.applocationid
|
||||
LEFT JOIN app_locationconfig e ON d.applocationid = e.applocationid`
|
||||
LEFT JOIN app_locationconfig e ON d.applocationid = e.applocationid
|
||||
LEFT JOIN deliveryslots s ON a.deliveryslotid = s.slotid`
|
||||
)
|
||||
|
||||
func (r *orderRepository) GetTenantOrders(input models.DeliveryQuery) ([]models.OrderInfo, error) {
|
||||
|
||||
Reference in New Issue
Block a user