ch some
CI/CD / Vet, test, build (push) Has been cancelled
CI/CD / Docker image (push) Has been cancelled
CI/CD / Deploy binary to server (push) Has been cancelled

This commit is contained in:
guwandyk committed 2026-09-04 19:33:26 +05:00
1 parent 28509eb4ca
commit d1a6fcaadc
102 files changed
+2089 -1957

No files matched your search

@@ -7,7 +7,7 @@ import (
"online-back/internal/identity/rbac"
"online-back/internal/lending/loanpaidletter"
"online-back/internal/lending/shared"
"online-back/internal/shared"
"online-back/pkg/client/postgresql"
"online-back/pkg/logging"
"online-back/pkg/repository/genericrepo"
@@ -111,12 +111,12 @@ func buildListQuery(filter loanpaidletter.ListFilter) (whereClause string, args
var conditions []string
if filter.PassportId != "" {
args = append(args, likePattern(filter.PassportId))
args = append(args, shared.LikePattern(filter.PassportId))
conditions = append(conditions, fmt.Sprintf("l.passport_id ILIKE $%d", len(args)))
}
if filter.Name != "" {
args = append(args, likePattern(filter.Name))
args = append(args, shared.LikePattern(filter.Name))
n := len(args)
conditions = append(conditions, fmt.Sprintf(`(
l.customer_name ILIKE $%[1]d OR l.customer_surname ILIKE $%[1]d OR COALESCE(l.customer_patronic_name, '') ILIKE $%[1]d
@@ -152,13 +152,6 @@ func buildListQuery(filter loanpaidletter.ListFilter) (whereClause string, args
return " WHERE " + strings.Join(conditions, " AND "), args
}
func likePattern(term string) string {
term = strings.ReplaceAll(term, `\`, `\\`)
term = strings.ReplaceAll(term, `%`, `\%`)
term = strings.ReplaceAll(term, `_`, `\_`)
return "%" + term + "%"
}
func (r *repository) ListBranchesByProvince(ctx context.Context, provinceID int64, activeOnly bool) (loanpaidletter.ListBranchesByProvinceDTO, error) {
args := []interface{}{provinceID}
where := ` WHERE province_id = $1`