Skip to content

Commit

Permalink
T|edit transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
Ton.R committed May 19, 2024
1 parent 30d103b commit 4f6f137
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion api/transaction/getAllTransection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func TestGetAllExpenses(t *testing.T) {
rows := sqlmock.NewRows([]string{"id", "date", "amount", "category", "transaction_type", "note", "image_url", "spender_id"}).
AddRow(1, "2021-01-01", 100.0, "Food", "expense", "Lunch", "image_url", 1).
AddRow(2, "2021-01-02", 150.0, "Transport", "expense", "Taxi", "image_url", 2)
mock.ExpectQuery(`SELECT id, date, amount, category, transaction_type, note, image_url, spender_id FROM transaction WHERE transaction_type = 'expense'"`).WillReturnRows(rows)
mock.ExpectQuery(`SELECT id, date, amount, category, transaction_type, note, image_url, spender_id FROM transaction WHERE transaction_type = 'expense'`).WillReturnRows(rows)

h := New(config.FeatureFlag{}, db)
err := h.GetAllTransaction(c)
Expand Down
2 changes: 1 addition & 1 deletion api/transaction/getAllTrasaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ func (h handler) GetAllTransaction(c echo.Context) error {
logger := mlog.L(c)
ctx := c.Request().Context()

rows, err := h.db.QueryContext(ctx, `SELECT id, date, amount, category, transaction_type, note, image_url, spender_id FROM transaction WHERE transaction_type = 'expense'"`)
rows, err := h.db.QueryContext(ctx, `SELECT id, date, amount, category, transaction_type, note, image_url, spender_id FROM transaction WHERE transaction_type = 'expense'`)
if err != nil {
logger.Error("query error", zap.Error(err))
return c.JSON(http.StatusInternalServerError, err.Error())
Expand Down

0 comments on commit 4f6f137

Please sign in to comment.