changed column name
This commit is contained in:
@@ -25,6 +25,8 @@ func NewRepository(client postgresql.Client, logger *logging.Logger) reasonscard
|
||||
|
||||
const reasonColumns = `r.id, r.title, r.price, r.content, r.created_at, r.updated_at`
|
||||
|
||||
const reasonReturningColumns = `id, title, price, content, created_at, updated_at`
|
||||
|
||||
func (r *repository) List(ctx context.Context, filter reasonscard.ListFilter) (reasonscard.ListReasonCardDTO, error) {
|
||||
fromClause, whereClause, args := buildListQuery(filter)
|
||||
|
||||
@@ -106,7 +108,7 @@ func (r *repository) Create(ctx context.Context, dto reasonscard.CreateReasonCar
|
||||
query := fmt.Sprintf(`
|
||||
INSERT INTO reasons_cards (title, price, content)
|
||||
VALUES ($1, $2, $3)
|
||||
RETURNING %s`, reasonColumns)
|
||||
RETURNING %s`, reasonReturningColumns)
|
||||
|
||||
return scanReasonCard(r.client.QueryRow(ctx, query, title, dto.Price, content))
|
||||
}
|
||||
@@ -122,7 +124,7 @@ func (r *repository) Update(ctx context.Context, id int64, dto reasonscard.Updat
|
||||
title = $1, price = $2, content = $3,
|
||||
updated_at = (CURRENT_TIMESTAMP AT TIME ZONE 'UTC')
|
||||
WHERE id = $4
|
||||
RETURNING %s`, reasonColumns)
|
||||
RETURNING %s`, reasonReturningColumns)
|
||||
|
||||
item, err := scanReasonCard(r.client.QueryRow(ctx, query, title, dto.Price, content, id))
|
||||
if errors.Is(err, pgx.ErrNoRows) {
|
||||
|
||||
Reference in New Issue
Block a user