changed column name
This commit is contained in:
@@ -41,10 +41,9 @@ func (h *handler) Register(router *gin.RouterGroup) {
|
||||
// @Produce json
|
||||
// @Security BearerAuth
|
||||
// @Param province_id query int false "Filter by province ID"
|
||||
// @Param location_id query int false "Filter by location ID"
|
||||
// @Param province_name query string false "Filter by province name (en, ru, tm)"
|
||||
// @Param branch_name query string false "Filter by branch name (en, ru, tm)"
|
||||
// @Param unikal_nomer query string false "Filter by unique number"
|
||||
// @Param unique_code query string false "Filter by unique code"
|
||||
// @Param page query int false "Page number" default(1)
|
||||
// @Param limit query int false "Items per page" default(10)
|
||||
// @Success 200 {object} appresult.AppSuccess
|
||||
@@ -212,7 +211,7 @@ func (h *handler) delete(c *gin.Context) {
|
||||
|
||||
func isClientError(err error) bool {
|
||||
msg := err.Error()
|
||||
return msg == "location not found in province" || msg == "unikal nomer already exists"
|
||||
return msg == "province not found" || msg == "unique code already exists"
|
||||
}
|
||||
|
||||
func parseID(raw string) (int64, bool) {
|
||||
@@ -243,14 +242,6 @@ func parseListFilter(c *gin.Context) (ListFilter, bool) {
|
||||
filter.ProvinceID = &id
|
||||
}
|
||||
|
||||
if raw := c.Query("location_id"); raw != "" {
|
||||
id, ok := parseID(raw)
|
||||
if !ok {
|
||||
return ListFilter{}, false
|
||||
}
|
||||
filter.LocationID = &id
|
||||
}
|
||||
|
||||
if raw := c.Query("page"); raw != "" {
|
||||
page, err := strconv.Atoi(raw)
|
||||
if err != nil || page < 1 {
|
||||
@@ -275,8 +266,8 @@ func parseListFilter(c *gin.Context) (ListFilter, bool) {
|
||||
filter.BranchName = raw
|
||||
}
|
||||
|
||||
if raw := strings.TrimSpace(c.Query("unikal_nomer")); raw != "" {
|
||||
filter.UnikalNomer = raw
|
||||
if raw := strings.TrimSpace(c.Query("unique_code")); raw != "" {
|
||||
filter.UniqueCode = raw
|
||||
}
|
||||
|
||||
return filter, true
|
||||
|
||||
Reference in New Issue
Block a user