Merge branch 'fix/daily-checklist' into 'development'

[FIX][BE]: fix search list daily checklist

See merge request mbugroup/lti-api!286
This commit is contained in:
Adnan Zahir
2026-01-30 14:04:18 +07:00
@@ -3,6 +3,7 @@ package service
import (
"errors"
"math"
"regexp"
"sort"
"strconv"
"strings"
@@ -259,8 +260,9 @@ func (s dailyChecklistService) GetAll(c *fiber.Ctx, params *validation.Query) ([
}
if params.Search != "" {
like := "%" + params.Search + "%"
db = db.Where("(k.name ILIKE ? OR dc.category::text ILIKE ?)", like, like)
re := regexp.MustCompile("[^a-zA-Z0-9]")
like := re.ReplaceAll([]byte("%"+params.Search+"%"), []byte(""))
db = db.Where("(regexp_replace(k.name, '[^a-zA-Z0-9]', '', 'g') ILIKE ? OR regexp_replace(dc.category::text, '[^a-zA-Z0-9]', '', 'g') ILIKE ?)", string(like), string(like))
}
countDB := db.Session(&gorm.Session{})