Bridge global catalogue DB to per-store product catalogue

Adds a separate CatalogueDB (pgvector) connection alongside the main
nearledb, plus a new catalogue module (repository/service/controller/
routes) to browse it by brand, category, and keyword, with brand
optional so the whole ~237-product catalogue can be browsed unfiltered.

Adds the actual bridge: importing a catalogue product snapshots it into
the tenant's own products table (keyed on brand+catalogueid, since a
catalogue row's bare id is only unique within its own brand table),
then links it via the existing productlocations upsert. Re-importing
tops up stock and refreshes price instead of duplicating. Also adds an
imported-refs endpoint so the frontend can badge already-imported items
without diffing full product lists, and wires the new AWS S3 image
store used to resolve catalogue product photos.

Bumps Go/Docker to 1.24 for the AWS SDK dependency this needs.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Suriya
2026-07-16 17:34:20 +05:30
parent 950064de6c
commit fab06bb33e
20 changed files with 1408 additions and 15 deletions

24
routes/catalogueroutes.go Normal file
View File

@@ -0,0 +1,24 @@
package routes
import (
"nearle/facade"
"github.com/gofiber/fiber/v2"
)
func RegisterCatalogueRoutes(api fiber.Router, f *facade.Facade) {
catalogue := api.Group("/v1/web/catalogue")
catalogue.Get("/getbrands", f.CatalogueController.GetBrands)
catalogue.Get("/getcategories", f.CatalogueController.GetCategories)
catalogue.Get("/getproducts", f.CatalogueController.GetProducts)
catalogue.Get("/getproduct", f.CatalogueController.GetProductBySKU)
catalogue = api.Group("/v1/mob/catalogue")
catalogue.Get("/getbrands", f.CatalogueController.GetBrands)
catalogue.Get("/getcategories", f.CatalogueController.GetCategories)
catalogue.Get("/getproducts", f.CatalogueController.GetProducts)
catalogue.Get("/getproduct", f.CatalogueController.GetProductBySKU)
}

View File

@@ -26,6 +26,8 @@ func RegisterProductRoutes(api fiber.Router, f *facade.Facade) {
products.Get("/getallproducts", f.ProductController.GetAllProducts)
products.Put("/updateproductlocation", f.ProductController.UpdateProductLocation)
products.Post("/createproductlocation", f.ProductController.CreateProductLocation)
products.Post("/importcatalogueproduct", f.ProductController.ImportCatalogueProduct)
products.Get("/getimportedcatalogueproducts", f.ProductController.GetImportedCatalogueProducts)
products.Delete("/deleteproductlocation", f.ProductController.DeleteProductLocation)
products.Post("/createproductvariant", f.ProductController.CreateProductVariant)
@@ -42,5 +44,7 @@ func RegisterProductRoutes(api fiber.Router, f *facade.Facade) {
products.Put("/update", f.ProductController.UpdateProduct)
products.Get("/getlocationproducts", f.ProductController.GetLocationProducts)
products.Put("/updateproductlocation", f.ProductController.UpdateProductLocation)
products.Post("/importcatalogueproduct", f.ProductController.ImportCatalogueProduct)
products.Get("/getimportedcatalogueproducts", f.ProductController.GetImportedCatalogueProducts)
}

View File

@@ -18,4 +18,5 @@ func RegisterRoutes(app *fiber.App, f *facade.Facade) {
RegisterTenantRoutes(api, f)
RegisterPartnerRoutes(api, f)
RegisterCustomerRoutes(api, f)
RegisterCatalogueRoutes(api, f)
}