lookup endpoint updated

This commit is contained in:
2026-09-30 16:13:25 +05:30
parent d0804ae84f
commit ea90b95cdc
4 changed files with 193 additions and 11 deletions

View File

@@ -856,13 +856,34 @@ func buildOffers(stores []models.ScanStore, rows []repositories.StoreOptionRow,
func optionFromRow(r repositories.StoreOptionRow, keys []repositories.CatalogueKey) models.ScanOption {
opt := models.ScanOption{
// Repeated from the enclosing store on purpose: an order line carries
// both, and the app should not have to reach back up the response.
Tenantid: r.Tenantid,
Locationid: r.Locationid,
Productid: r.Productid,
Productname: r.Productname,
// The printable label AND its two parts. The label is what the app has
// always shown; the parts are what an order line needs, and recovering
// them by splitting the label means parsing a string a shop typed.
Size: strings.TrimSpace(r.Unitvalue + " " + r.Productunit),
Unitvalue: r.Unitvalue,
Productunit: r.Productunit,
Price: r.Price,
Stock: r.Stock,
Available: r.Stock > 0,
Image: r.Productimage,
Productcost: r.Productcost,
Categoryid: r.Categoryid,
Subcategoryid: r.Subcategoryid,
Stock: r.Stock,
Available: r.Stock > 0,
// One URL, both names — see the struct.
Image: r.Productimage,
Productimage: r.Productimage,
IsVariant: r.Parentid > 0,
Variantname: r.Variantname,
MatchedBy: "name",