rider partner
This commit is contained in:
@@ -61,6 +61,15 @@ type Partnerinfo struct {
|
||||
Postcode string `json:"postcode"`
|
||||
Partnerinfo string `json:"partnerinfo"`
|
||||
Partnerimage string `json:"partnerimage"`
|
||||
// Read back so a directory can show who the partner is and whether they
|
||||
// are trading. Both columns have always been on the table; the struct had
|
||||
// no field for them, so `getpartners` could not report either.
|
||||
Companyname string `json:"companyname"`
|
||||
Status string `json:"status"`
|
||||
// Every region this partner covers, from `partnerlocations`. A partner is
|
||||
// not confined to the one city on their own row — that column records where
|
||||
// they were set up, and the link table records where they actually work.
|
||||
Locations []PartnerLocation `json:"locations" gorm:"-"`
|
||||
}
|
||||
|
||||
type Ridershifts struct {
|
||||
@@ -156,7 +165,16 @@ type NewRider struct {
|
||||
Postcode string `json:"postcode"`
|
||||
|
||||
// Whose rider they are, where they ride, and who they ride for.
|
||||
//
|
||||
// Tenantid and Partnerid are exclusive: a rider belongs to a shop or to a
|
||||
// delivery partner, never to both and never to neither. The controller
|
||||
// refuses either mistake.
|
||||
//
|
||||
// Locationid is the branch an OWN rider works out of. It is meaningless for
|
||||
// a partner's rider — a partner supplies several merchants and is not tied
|
||||
// to any one shop's outlet — so it is only ever set alongside a tenantid.
|
||||
Tenantid int `json:"tenantid"`
|
||||
Locationid int `json:"locationid"`
|
||||
Applocationid int `json:"applocationid"`
|
||||
Partnerid int `json:"partnerid"`
|
||||
Shiftid int `json:"shiftid"`
|
||||
@@ -185,6 +203,8 @@ type RiderRosterRow struct {
|
||||
Contactno string `json:"contactno"`
|
||||
Email string `json:"email"`
|
||||
Tenantid int `json:"tenantid"`
|
||||
Locationid int `json:"locationid"`
|
||||
Locationname string `json:"locationname"`
|
||||
Applocationid int `json:"applocationid"`
|
||||
Applocation string `json:"applocation"`
|
||||
Partnerid int `json:"partnerid"`
|
||||
@@ -236,3 +256,61 @@ type Appuserpools struct {
|
||||
Onduty int `json:"onduty"`
|
||||
Status string `json:"status"`
|
||||
}
|
||||
|
||||
// PartnerLocation is one region a partner covers — a row of `partnerlocations`.
|
||||
type PartnerLocation struct {
|
||||
Partnerlocationid int `json:"partnerlocationid" gorm:"column:partnerlocationid"`
|
||||
Partnerid int `json:"partnerid" gorm:"column:partnerid"`
|
||||
Applocationid int `json:"applocationid" gorm:"column:applocationid"`
|
||||
Applocation string `json:"applocation" gorm:"column:applocation"`
|
||||
}
|
||||
|
||||
// NewPartner is everything the console collects to onboard a delivery partner.
|
||||
//
|
||||
// Separate from `Partnerinfo`, which is the READ shape. Binding a create to the
|
||||
// read model is how a caller ends up able to set columns nobody meant to expose
|
||||
// — `allocationid`, `partnertypeid`, the billing links — because a form happened
|
||||
// to send them.
|
||||
//
|
||||
// A partner is a company that supplies riders. It is onboarded by the platform,
|
||||
// never by a merchant: the merchant's side of this is being ASSIGNED one, which
|
||||
// is `AssignPartner` on the tenant.
|
||||
type NewPartner struct {
|
||||
Partnerid int `json:"partnerid"`
|
||||
Partnername string `json:"partnername"`
|
||||
Companyname string `json:"companyname"`
|
||||
Registrationno string `json:"registrationno"`
|
||||
Primarycontact string `json:"primarycontact"`
|
||||
Primaryemail string `json:"primaryemail"`
|
||||
Contactno string `json:"contactno"`
|
||||
Address string `json:"address"`
|
||||
Suburb string `json:"suburb"`
|
||||
City string `json:"city"`
|
||||
State string `json:"state"`
|
||||
Postcode int `json:"postcode"`
|
||||
Partnerinfo string `json:"partnerinfo"`
|
||||
Partnerimage string `json:"partnerimage"`
|
||||
Status string `json:"status"`
|
||||
|
||||
/*
|
||||
Where they work — ONE district, not a set.
|
||||
|
||||
`Applocationid` is the home region and goes on the partner row itself,
|
||||
because `GetPartners` filters on it and the rider app reads it.
|
||||
`Applocationids` is every region they cover and goes to
|
||||
`partnerlocations` — one partner routinely serves several cities, and
|
||||
that is the whole reason the link table exists.
|
||||
*/
|
||||
Applocationid int `json:"applocationid"`
|
||||
/*
|
||||
The district by NAME, for one that is not open yet.
|
||||
|
||||
Nearle runs three of Tamil Nadu's thirty-eight districts, and a partner
|
||||
could only be placed in those three because `partnerinfo.applocationid`
|
||||
has to point at an `app_location` row. Sending the name instead opens the
|
||||
district — see `EnsureRegion` — so the form can offer all 38 and mean it.
|
||||
|
||||
Ignored when `Applocationid` is set, which is the ordinary case.
|
||||
*/
|
||||
District string `json:"district"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user