package routes import ( "nearle/facade" "github.com/gofiber/fiber/v2" ) func RegisterTenantRoutes(api fiber.Router, f *facade.Facade) { tenant := api.Group("/v1/web/tenants") tenant.Get("/search", f.TenantController.SearchTenant) tenant.Get("/searchbykeyword", f.TenantController.GetTenantByKeyword) tenant.Get("/getalltenants", f.TenantController.GetAllTenants) tenant.Get("/gettenantlocations", f.TenantController.GetTenantLocations) tenant.Post("/createtenantcustomer", f.TenantController.CreateTenantCustomer) tenant.Put("/updatelocation", f.TenantController.UpdateLocation) tenant.Post("/createlocation", f.TenantController.CreateLocation) tenant.Delete("/deletelocation", f.TenantController.DeleteLocation) tenant.Post("/createtenantlocation", f.TenantController.CreateTenantLocation) tenant.Put("/updatetenantlocation", f.TenantController.UpdateTenantLocation) tenant.Post("/createtenantuser", f.TenantController.CreateTenantUser) // Re-issuing a merchant's first-password link, for the one who never got // the mail or whose invitation expired. // // Web group only, and the handler additionally requires a platform account: // this mints a credential, and the merchant it would invite is by // definition somebody who cannot sign in to ask for it themselves. tenant.Post("/resendinvite", f.TenantController.ResendInvite) // One business, by id. // // Also /mob-only until now, so the console's only way to read its own // merchant was `getalltenants` — 262 rows, paginated, and a shop on page // two was simply not found. A profile screen cannot be built on that. tenant.Get("/gettenantinfo", f.TenantController.GetTenantInfo) // Which delivery partner supplies this merchant's riders. // // Its own route rather than a field on updatetenant: `partnerid` is kept // out of the merchant-editable allowlist on purpose, because a merchant // who could set it would move themselves under another partner. tenant.Put("/assignpartner", f.TenantController.AssignPartner) // A merchant editing their own business record. The first write path the // `tenants` table has ever had — see UpdateTenantProfile for what may be // set, and what deliberately may not. tenant.Put("/updatetenant", f.TenantController.UpdateTenantProfile) // Somebody editing their own name, mobile or email. Scoped to their own // account AND their own business — `users/update` checks neither, which is // why the store user's account page could only ever be read-only. tenant.Put("/updateownprofile", f.TenantController.UpdateOwnProfile) // A merchant's people, and where each of them works. // // These existed only under /mob, which is why the console has never had a // screen for them: back-office staff were reachable exclusively through the // customer app's door. The /mob registrations stay — something may be // calling them — but this is where they belong. tenant.Get("/getstaffs", f.TenantController.GetStaffs) tenant.Post("/createstaff", f.TenantController.CreateStaff) // Placing a person at a branch, or taking them off one. Separate from // createstaff because hiring and posting are different decisions, and the // second happens repeatedly over an account's life. tenant.Put("/assignstaff", f.TenantController.AssignStaff) tenant = api.Group("/v1/mob/tenants") tenant.Get("/gettenantslot", f.TenantController.GetTenantSlot) tenant.Get("/searchbykeyword", f.TenantController.GetTenantByKeyword) tenant.Post("/createtenantcustomer", f.TenantController.CreateTenantCustomer) tenant.Get("/getcustomertenants", f.TenantController.GetCustomerTenants) tenant.Get("/gettenantlocations", f.TenantController.GetTenantLocations) tenant.Get("/gettenantpricing", f.TenantController.GetTenantPricing) tenant.Put("/updatelocation", f.TenantController.UpdateLocation) tenant.Post("/createlocation", f.TenantController.CreateLocation) tenant.Get("/getstaffs", f.TenantController.GetStaffs) tenant.Post("/createstaff", f.TenantController.CreateStaff) // Placing a person at a branch, or taking them off one. Separate from // createstaff because hiring and posting are different decisions, and the // second happens again and again over an account's life. tenant.Put("/assignstaff", f.TenantController.AssignStaff) tenant.Post("/createtenantuser", f.TenantController.CreateTenantUser) tenant.Get("/gettenantinfo", f.TenantController.GetTenantInfo) }