package routes import ( "nearle/facade" "github.com/gofiber/fiber/v2" ) // Receipts for spreadsheets sent to the catalogue ingest service. // // Web only, and that is not an oversight. These are a back-office audit trail — // who uploaded what, for which shop, and whether it reached the shelf. The // customer app has no use for any of it, and mounting them under /mob would // publish one merchant's stocking activity to an endpoint built for shoppers. func RegisterUploadRoutes(api fiber.Router, f *facade.Facade) { uploads := api.Group("/v1/web/uploads") // Written the instant a drop is accepted. The batch id is the only // credential for reading the result back, and the ingest service deletes an // unreviewed drop after seven days — so this is the call that keeps an // upload findable at all. uploads.Post("/record", f.CatalogueUploadController.RecordUpload) uploads.Get("/list", f.CatalogueUploadController.GetUploads) // Progress, cached from whichever browser is polling the ingest service. uploads.Put("/update", f.CatalogueUploadController.UpdateUpload) // The other half: priced, shelved and stocked at a branch. Kept apart from // /update because the ingest service confirms the shared global catalogue // and knows nothing about a shop's shelf. // The rescue path: hand the spreadsheet over again for a receipt whose // prices and opening stock were never stored, so it can still be shelved. uploads.Put("/sheet", f.CatalogueUploadController.AttachSheet) uploads.Put("/shelved", f.CatalogueUploadController.MarkShelved) }