77 lines
3.6 KiB
Go
77 lines
3.6 KiB
Go
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)
|
|
|
|
// 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)
|
|
|
|
// 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)
|
|
|
|
}
|