productRepository created

This commit is contained in:
2026-07-15 15:25:50 +05:30
parent 7e9b3f98ba
commit 950064de6c
8 changed files with 62 additions and 1 deletions

View File

@@ -514,3 +514,41 @@ func (ctl *ProductController) CreateProductVariant(c *fiber.Ctx) error {
"status": true,
})
}
func (ctl *ProductController) DeleteProductLocation(c *fiber.Ctx) error {
var input struct {
Tenantid int `json:"tenantid"`
Locationid int `json:"locationid"`
Productid int `json:"productid"`
}
if err := c.BodyParser(&input); err != nil {
return c.Status(http.StatusBadRequest).JSON(fiber.Map{
"code": http.StatusBadRequest,
"message": "Invalid request body",
"status": false,
})
}
if input.Tenantid == 0 || input.Locationid == 0 || input.Productid == 0 {
return c.Status(http.StatusBadRequest).JSON(fiber.Map{
"code": http.StatusBadRequest,
"message": "tenantid, locationid, and productid are required",
"status": false,
})
}
if err := ctl.productService.DeleteProductLocation(input.Tenantid, input.Locationid, input.Productid); err != nil {
return c.Status(http.StatusConflict).JSON(fiber.Map{
"code": http.StatusConflict,
"message": err.Error(),
"status": false,
})
}
return c.Status(http.StatusOK).JSON(fiber.Map{
"code": http.StatusOK,
"message": "Product location deleted successfully",
"status": true,
})
}