remove some daata
This commit is contained in:
1 parent
a44c10d445
commit
69d1495b1f
3 files changed
+21
-7
No files matched your search
Binary file not shown.
|
Before Width: | Height: | Size: 102 KiB |
@@ -82,8 +82,9 @@ func (r *repository) List(ctx context.Context, filter loanpaidletter.ListFilter)
|
|||||||
limitPlaceholder := len(args) + 1
|
limitPlaceholder := len(args) + 1
|
||||||
offsetPlaceholder := len(args) + 2
|
offsetPlaceholder := len(args) + 2
|
||||||
query := fmt.Sprintf(
|
query := fmt.Sprintf(
|
||||||
`SELECT %s%s%s ORDER BY l.id DESC LIMIT $%d OFFSET $%d`,
|
`SELECT l.id, l.unique_id, l.customer_name, l.customer_surname, l.phone, l.status
|
||||||
letterSelectColumns, letterFromClause, whereClause, limitPlaceholder, offsetPlaceholder,
|
FROM loan_paid_off_letters l%s ORDER BY l.id DESC LIMIT $%d OFFSET $%d`,
|
||||||
|
whereClause, limitPlaceholder, offsetPlaceholder,
|
||||||
)
|
)
|
||||||
|
|
||||||
rows, err := r.client.Query(ctx, query, append(args, filter.Limit, offset)...)
|
rows, err := r.client.Query(ctx, query, append(args, filter.Limit, offset)...)
|
||||||
@@ -92,10 +93,12 @@ func (r *repository) List(ctx context.Context, filter loanpaidletter.ListFilter)
|
|||||||
}
|
}
|
||||||
defer rows.Close()
|
defer rows.Close()
|
||||||
|
|
||||||
var items []loanpaidletter.LoanPaidLetterDTO
|
items := []loanpaidletter.LoanPaidLetterListItemDTO{}
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
item, err := scanLoanPaidLetter(rows)
|
var item loanpaidletter.LoanPaidLetterListItemDTO
|
||||||
if err != nil {
|
if err := rows.Scan(
|
||||||
|
&item.Id, &item.UniqueId, &item.CustomerName, &item.CustomerSurname, &item.Phone, &item.Status,
|
||||||
|
); err != nil {
|
||||||
return loanpaidletter.ListLoanPaidLetterDTO{}, err
|
return loanpaidletter.ListLoanPaidLetterDTO{}, err
|
||||||
}
|
}
|
||||||
items = append(items, item)
|
items = append(items, item)
|
||||||
|
|||||||
@@ -89,9 +89,20 @@ type ListFilter struct {
|
|||||||
Limit int
|
Limit int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// LoanPaidLetterListItemDTO is the list row; branch, passport and loan
|
||||||
|
// details come from GET /loan-paid-off-letters/:id.
|
||||||
|
type LoanPaidLetterListItemDTO struct {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
UniqueId *string `json:"uniqueId"`
|
||||||
|
CustomerName string `json:"customerName"`
|
||||||
|
CustomerSurname string `json:"customerSurname"`
|
||||||
|
Phone string `json:"phone"`
|
||||||
|
Status *string `json:"status"`
|
||||||
|
}
|
||||||
|
|
||||||
type ListLoanPaidLetterDTO struct {
|
type ListLoanPaidLetterDTO struct {
|
||||||
Count int64 `json:"count"`
|
Count int64 `json:"count"`
|
||||||
LoanPaidLetters []LoanPaidLetterDTO `json:"loanPaidLetters"`
|
LoanPaidLetters []LoanPaidLetterListItemDTO `json:"loanPaidLetters"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// BranchByProvinceDTO is a compact branch row for province-scoped pickers.
|
// BranchByProvinceDTO is a compact branch row for province-scoped pickers.
|
||||||
|
|||||||
Reference in new issue
Block a user