code ready, time for testing...

This commit is contained in:
Daniel Goc
2026-04-10 13:23:51 +02:00
parent 8595969c6e
commit 134bc4ea53
9 changed files with 131 additions and 44 deletions

View File

@@ -3,9 +3,10 @@ package perms
type Permission string
const (
UserReadAny Permission = "user.read.any"
UserWriteAny Permission = "user.write.any"
UserDeleteAny Permission = "user.delete.any"
CurrencyWrite Permission = "currency.write"
ViewAllOrders Permission = "orders.view"
UserReadAny Permission = "user.read.any"
UserWriteAny Permission = "user.write.any"
UserDeleteAny Permission = "user.delete.any"
CurrencyWrite Permission = "currency.write"
ViewAllOrders Permission = "orders.view"
ModifyAllOrders Permission = "orders.modify"
)

View File

@@ -61,8 +61,9 @@ func (h *OrdersHandler) ListOrders(c fiber.Ctx) error {
}
var columnMappingListOrders map[string]string = map[string]string{
"order_id": "b2b_customer_orders.id",
"order_id": "b2b_customer_orders.order_id",
"user_id": "b2b_customer_orders.user_id",
"name": "b2b_customer_orders.name",
"country_id": "b2b_customer_orders.country_id",
"status": "b2b_customer_orders.status",
}
@@ -81,6 +82,7 @@ func (h *OrdersHandler) PlaceNewOrder(c fiber.Ctx) error {
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrBadAttribute)))
}
address_info := c.Query("address_info")
country_id_attribute := c.Query("country_id")
country_id, err := strconv.Atoi(country_id_attribute)
if err != nil {
@@ -88,9 +90,9 @@ func (h *OrdersHandler) PlaceNewOrder(c fiber.Ctx) error {
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrBadAttribute)))
}
address_info := c.Query("address_info")
name := c.Query("name")
err = h.ordersService.PlaceNewOrder(userID, uint(cart_id), uint(country_id), address_info)
err = h.ordersService.PlaceNewOrder(userID, uint(cart_id), name, uint(country_id), address_info)
if err != nil {
return c.Status(responseErrors.GetErrorStatus(err)).
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, err)))