changed column name
This commit is contained in:
@@ -25,6 +25,8 @@ func NewRepository(client postgresql.Client, logger *logging.Logger) loantype.Re
|
||||
|
||||
const loanTypeColumns = `lt.id, lt.title, lt.tax, lt.loan_term, lt.content, lt.created_at, lt.updated_at`
|
||||
|
||||
const loanTypeReturningColumns = `id, title, tax, loan_term, content, created_at, updated_at`
|
||||
|
||||
func (r *repository) List(ctx context.Context, filter loantype.ListFilter) (loantype.ListLoanTypeDTO, error) {
|
||||
fromClause, whereClause, args := buildListQuery(filter)
|
||||
|
||||
@@ -106,7 +108,7 @@ func (r *repository) Create(ctx context.Context, dto loantype.CreateLoanTypeDTO)
|
||||
query := fmt.Sprintf(`
|
||||
INSERT INTO loan_types (title, tax, loan_term, content)
|
||||
VALUES ($1, $2, $3, $4)
|
||||
RETURNING %s`, loanTypeColumns)
|
||||
RETURNING %s`, loanTypeReturningColumns)
|
||||
|
||||
return scanLoanType(r.client.QueryRow(ctx, query, title, dto.Tax, dto.LoanTerm, content))
|
||||
}
|
||||
@@ -122,7 +124,7 @@ func (r *repository) Update(ctx context.Context, id int64, dto loantype.UpdateLo
|
||||
title = $1, tax = $2, loan_term = $3, content = $4,
|
||||
updated_at = (CURRENT_TIMESTAMP AT TIME ZONE 'UTC')
|
||||
WHERE id = $5
|
||||
RETURNING %s`, loanTypeColumns)
|
||||
RETURNING %s`, loanTypeReturningColumns)
|
||||
|
||||
item, err := scanLoanType(r.client.QueryRow(ctx, query, title, dto.Tax, dto.LoanTerm, content, id))
|
||||
if errors.Is(err, pgx.ErrNoRows) {
|
||||
|
||||
Reference in New Issue
Block a user