Files
backend_fiesta/routes/partnerroutes.go
2026-09-24 15:51:47 +05:30

56 lines
2.4 KiB
Go

package routes
import (
"nearle/facade"
"github.com/gofiber/fiber/v2"
)
func RegisterPartnerRoutes(api fiber.Router, f *facade.Facade) {
partner := api.Group("/v1/web/partners")
partner.Get("/getriders", f.PartnerController.GetActiveRiders)
partner.Get("/getpartners", f.PartnerController.GetPartners)
partner.Get("/getridershifts", f.PartnerController.GetRiderShifts)
// Opening a shift window. Riders cannot be hired without one, and this table
// was read-only until now — see partnerController.CreateRiderShift.
partner.Post("/createridershift", f.PartnerController.CreateRiderShift)
partner.Get("/getlocations", f.PartnerController.GetLocationConfig)
partner.Get("/getriderlogs", f.PartnerController.GetRiderLogs)
partner.Get("/getfleetsummary", f.PartnerController.GetFleetSummary)
// Hiring a rider, and the directory that shows them before they clock on.
//
// Until these existed the only way to create a rider was POST /users/create,
// which writes app_users and stops — it answered 201 and produced somebody
// every rider query ignored, because getriders joins ridersettings and
// app_userpools too.
//
// Web group only. A rider is onboarded from the merchant's console, not from
// a phone, so the mobile group below stays read-only as it was.
// Onboarding the COMPANY that supplies riders, as opposed to the riders
// themselves. `getpartners` has always existed and nothing could create
// one, which is why the five partners live today were inserted by hand —
// two of them are still named "Test".
//
// Web group only, and deliberately not in the mob group below: a partner is
// onboarded by the platform from a console, never from a phone and never by
// a merchant. A merchant's side of this is being assigned one.
partner.Post("/createpartner", f.PartnerController.CreatePartner)
partner.Put("/updatepartner", f.PartnerController.UpdatePartner)
partner.Get("/getpartnerlocations", f.PartnerController.GetPartnerLocations)
partner.Post("/createrider", f.PartnerController.CreateRider)
partner.Put("/updaterider", f.PartnerController.UpdateRider)
partner.Get("/getriderroster", f.PartnerController.GetRiderRoster)
partner = api.Group("/v1/mob/partners")
partner.Get("/getpartners", f.PartnerController.GetPartners)
partner.Get("/getriderlogs", f.PartnerController.GetRiderLogs)
partner.Get("/getriderinfo", f.PartnerController.GetRiderInfo)
partner.Get("/getriders", f.PartnerController.GetActiveRiders)
}