ch some
Some checks failed
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:
2026-09-04 19:33:26 +05:00
parent 28509eb4ca
commit d1a6fcaadc
102 changed files with 2089 additions and 1957 deletions

View File

@@ -7,6 +7,7 @@ import (
"strings"
"online-back/internal/lending/loansdocument"
"online-back/internal/shared"
"online-back/pkg/client/postgresql"
"online-back/pkg/logging"
"online-back/pkg/repository/genericrepo"
@@ -47,7 +48,7 @@ func buildListQuery(filter loansdocument.ListFilter) (whereClause string, args [
var conditions []string
if filter.DocumentName != "" {
args = append(args, likePattern(filter.DocumentName))
args = append(args, shared.LikePattern(filter.DocumentName))
n := len(args)
conditions = append(conditions, fmt.Sprintf(`d.name ILIKE $%d`, n))
}
@@ -64,13 +65,6 @@ func buildListQuery(filter loansdocument.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) GetByID(ctx context.Context, id int64) (loansdocument.LoanDocumentDTO, error) {
return r.generic.GetByID(ctx, id)
}