remove some daata
This commit is contained in:
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
|
||||
offsetPlaceholder := len(args) + 2
|
||||
query := fmt.Sprintf(
|
||||
`SELECT %s%s%s ORDER BY l.id DESC LIMIT $%d OFFSET $%d`,
|
||||
letterSelectColumns, letterFromClause, whereClause, limitPlaceholder, offsetPlaceholder,
|
||||
`SELECT l.id, l.unique_id, l.customer_name, l.customer_surname, l.phone, l.status
|
||||
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)...)
|
||||
@@ -92,10 +93,12 @@ func (r *repository) List(ctx context.Context, filter loanpaidletter.ListFilter)
|
||||
}
|
||||
defer rows.Close()
|
||||
|
||||
var items []loanpaidletter.LoanPaidLetterDTO
|
||||
items := []loanpaidletter.LoanPaidLetterListItemDTO{}
|
||||
for rows.Next() {
|
||||
item, err := scanLoanPaidLetter(rows)
|
||||
if err != nil {
|
||||
var item loanpaidletter.LoanPaidLetterListItemDTO
|
||||
if err := rows.Scan(
|
||||
&item.Id, &item.UniqueId, &item.CustomerName, &item.CustomerSurname, &item.Phone, &item.Status,
|
||||
); err != nil {
|
||||
return loanpaidletter.ListLoanPaidLetterDTO{}, err
|
||||
}
|
||||
items = append(items, item)
|
||||
|
||||
@@ -89,9 +89,20 @@ type ListFilter struct {
|
||||
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 {
|
||||
Count int64 `json:"count"`
|
||||
LoanPaidLetters []LoanPaidLetterDTO `json:"loanPaidLetters"`
|
||||
Count int64 `json:"count"`
|
||||
LoanPaidLetters []LoanPaidLetterListItemDTO `json:"loanPaidLetters"`
|
||||
}
|
||||
|
||||
// BranchByProvinceDTO is a compact branch row for province-scoped pickers.
|
||||
|
||||
Reference in New Issue
Block a user