mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
fix(BE): change name from sort to order
This commit is contained in:
@@ -44,13 +44,13 @@ func (u *ApprovalController) GetAll(c *fiber.Ctx) error {
|
||||
page := c.QueryInt("page", 1)
|
||||
limit := c.QueryInt("limit", 10)
|
||||
search := strings.TrimSpace(c.Query("search", ""))
|
||||
sortByDate := strings.TrimSpace(c.Query("sort_by_date", ""))
|
||||
if sortByDate == "" {
|
||||
sortByDate = "DESC"
|
||||
orderByDate := strings.TrimSpace(c.Query("order_by_date", ""))
|
||||
if orderByDate == "" {
|
||||
orderByDate = "DESC"
|
||||
} else {
|
||||
sortByDate = strings.ToUpper(sortByDate)
|
||||
if sortByDate != "ASC" && sortByDate != "DESC" {
|
||||
return fiber.NewError(fiber.StatusBadRequest, "sort_by_date must be either ASC or DESC")
|
||||
orderByDate = strings.ToUpper(orderByDate)
|
||||
if orderByDate != "ASC" && orderByDate != "DESC" {
|
||||
return fiber.NewError(fiber.StatusBadRequest, "order_by_date must be either ASC or DESC")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ func (u *ApprovalController) GetAll(c *fiber.Ctx) error {
|
||||
Page: page,
|
||||
Limit: limit,
|
||||
Search: search,
|
||||
SortByDate: sortByDate,
|
||||
OrderByDate: orderByDate,
|
||||
}
|
||||
|
||||
records, totalResults, err := u.ApprovalService.List(
|
||||
@@ -71,7 +71,7 @@ func (u *ApprovalController) GetAll(c *fiber.Ctx) error {
|
||||
query.Page,
|
||||
query.Limit,
|
||||
query.Search,
|
||||
query.SortByDate,
|
||||
query.OrderByDate,
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user