package models type RiderInfo struct { Userid int `json:"userid"` Authname string `json:"authname"` Configid int `json:"configid"` Authmode int `json:"authmode"` Roleid int `json:"roleid"` Firstname string `json:"firstname"` Lastname string `json:"lastname"` Fullname string `json:"fullname"` Password string `json:"password"` Email string `json:"email"` Contactno string `json:"contactno"` Address string `json:"address"` Suburb string `json:"suburb"` City string `json:"city"` State string `json:"state"` Postcode string `json:"postcode"` Userfcmtoken string `json:"userfcmtoken"` Pin int `json:"pin"` Partnerid int `json:"partnerid"` Identificationno string `json:"identificationno"` Vehiclename string `json:"vehiclename"` Vehicleno string `json:"vehicleno"` Licenseno string `json:"licenseno"` Insuranceno string `json:"insoranceno"` Insurancedate string `json:"insurancedate"` Shiftid int `json:"shiftid"` Starttime string `json:"starttime"` Endtime string `json:"endtime"` Shifthours float32 `json:"shifthours"` Basefare float32 `json:"basefare"` Additionalcharges float32 `json:"additionalcharges"` Orders int `json:"orders"` Fuelcharge float32 `json:"fuelcharge"` Logdate string `json:"logdate"` Applocationid int `json:"applocationid"` Applocation string `json:"applocation"` Logseconds int `json:"logseconds"` Riderid int `json:"riderid"` Status string `json:"status"` Tenantid int `json:"tenantid"` } type Partnerinfo struct { Partnerid int `json:"partnerid" gorm:"Primary_Key"` Partnertypeid int `json:"partnertypeid"` Applocationid int `json:"applocationid"` Partnername string `json:"partnername"` Registrationno string `json:"registrationno"` Primarycontact string `json:"primartcontact"` Primaryemail string `json:"primaryemail"` Contactno string `json:"contactno"` Bizcategoryid int `json:"bizcategoryid"` Bizsubcategoryid int `json:"bizsubcategoryid"` Adderss string `json:"address"` Suburb string `json:"suburb"` State string `json:"state"` City string `json:"city"` Postcode string `json:"postcode"` Partnerinfo string `json:"partnerinfo"` Partnerimage string `json:"partnerimage"` } type Ridershifts struct { Shiftid int `json:"shiftid" gorm:"Primary_Key"` Shiftdate string `json:"shiftdate"` Starttime string `json:"starttime"` Endtime string `json:"endtime"` Shifthours float32 `json:"shifthours"` Basefare float32 `json:"basefare"` Additionalkm float32 `json:"additionalkm"` Additionalcharges float32 `json:"additionalcharges"` Orders int `json:"orders"` Fuelcharge float32 `json:"fuelcharge"` Shiftname string `json:"shiftname" gorm:"<-:false"` } type Locationconfigs struct { Applocationid int `json:"applocationid"` Configid int `json:"configid"` Locationname string `json:"locationname"` Latitude string `json:"latitude"` Longitude string `json:"longitude"` Status string `json:"status"` } type FleetCounts struct { Totalriders int `json:"totalriders"` Activeriders int `json:"activeriders"` Ridersworked int `json:"ridersworked"` Totallogins int `json:"totallogins"` } type FleetRiderSummary struct { Userid int `json:"userid"` Fullname string `json:"fullname"` Contactno string `json:"contactno"` Partnerid int `json:"partnerid"` Status string `json:"status"` Vehicleno string `json:"vehicleno"` Vehiclename string `json:"vehiclename"` Dayslogged int `json:"dayslogged"` Totalworkhours float32 `json:"totalworkhours"` Totalshorthours float32 `json:"totalshorthours"` Totalbreakhours float32 `json:"totalbreakhours"` } type FleetSummary struct { Counts FleetCounts `json:"counts"` Riders []FleetRiderSummary `json:"riders"` } type RiderlogDetails struct { Logid int `json:"logid"` Logdate string `json:"logdate"` Userid int `json:"userid"` Username string `json:"username"` Partnerid int `json:"partnerid"` Shiftid int `json:"shiftid"` Shifthours float32 `json:"shifthours"` Login string `json:"login"` Logout string `json:"logout"` Latitude string `json:"latitude"` Longitude string `json:"longitude"` Workhours float32 `json:"workhours"` Shorthours float32 `json:"shorthours"` Breakhours float32 `json:"breakhours"` Logstatus int `json:"logstatus"` } // NewRider is one rider being onboarded, as the console sends it. // // A rider is three rows, not one. `app_users` holds the person, `ridersettings` // the vehicle and licence, and `app_userpools` their place in the availability // pool — and `getriders` INNER JOINs all three, so a rider missing any of them // is not a partial rider, they are no rider at all. The flat shape here is // deliberate: the caller should not have to know the table layout to hire // somebody. // // `Tenantid` is filled in by the controller from the caller's scope, never read // from the body — a store admin must not be able to put a rider on another // merchant's books by editing a payload. type NewRider struct { Userid int `json:"userid"` Firstname string `json:"firstname"` Lastname string `json:"lastname"` Contactno string `json:"contactno"` Email string `json:"email"` Password string `json:"password"` Address string `json:"address"` Suburb string `json:"suburb"` City string `json:"city"` State string `json:"state"` Postcode string `json:"postcode"` // Whose rider they are, where they ride, and who they ride for. Tenantid int `json:"tenantid"` Applocationid int `json:"applocationid"` Partnerid int `json:"partnerid"` Shiftid int `json:"shiftid"` // The vehicle half — `ridersettings`. Identificationno string `json:"identificationno"` Vehiclename string `json:"vehiclename"` Vehicleno string `json:"vehicleno"` Licenseno string `json:"licenseno"` Registrationno string `json:"registrationno"` Status string `json:"status"` } // RiderRosterRow is one rider in the directory. // // Distinct from RiderInfo, which is the ON-DUTY read: that one requires a // riderlog stamped today, which is right for an assignment picker and wrong for // a staff list, where somebody who has not started their shift must still // appear. This carries the last log rather than requiring one. type RiderRosterRow struct { Userid int `json:"userid"` Firstname string `json:"firstname"` Lastname string `json:"lastname"` Fullname string `json:"fullname"` Contactno string `json:"contactno"` Email string `json:"email"` Tenantid int `json:"tenantid"` Applocationid int `json:"applocationid"` Applocation string `json:"applocation"` Partnerid int `json:"partnerid"` Partnername string `json:"partnername"` Shiftid int `json:"shiftid"` Shiftname string `json:"shiftname"` Identificationno string `json:"identificationno"` Vehiclename string `json:"vehiclename"` Vehicleno string `json:"vehicleno"` Licenseno string `json:"licenseno"` Registrationno string `json:"registrationno"` // Duty state, as facts rather than as a filter. Onduty int `json:"onduty"` Lastlogdate string `json:"lastlogdate"` // True when there is a log dated today with logstatus 0 — on shift right now. Isonduty bool `json:"isonduty"` Status string `json:"status"` } // Ridersettings is the vehicle-and-licence half of a rider. // // `riderid` is DELIBERATELY ABSENT. It is a GENERATED ALWAYS identity column, // and including it makes GORM send a zero, which Postgres rejects outright: // "cannot insert a non-DEFAULT value into column riderid". Leaving it off the // struct is what keeps the insert to the columns that are actually ours to set. type Ridersettings struct { Userid int `json:"userid"` Partnerid int `json:"partnerid"` Shiftid int `json:"shiftid"` Identificationno string `json:"identificationno"` Vehiclename string `json:"vehiclename"` Vehicleno string `json:"vehicleno"` Licenseno string `json:"licenseno"` Registrationno string `json:"registrationno"` } // Appuserpools is a rider's place in the availability pool. // // `poolid` is absent for the same reason as `riderid` above — same identity // column, same rejection. // // `Onduty` means "may be given work", not "on shift right now". The second // question is answered by riderlogs, which the rider's own app writes. type Appuserpools struct { Userid int `json:"userid"` Partnerid int `json:"partnerid"` Onduty int `json:"onduty"` Status string `json:"status"` }