Skip to content

Commit

Permalink
fixed conflict update create trasaction2
Browse files Browse the repository at this point in the history
  • Loading branch information
Gitong23 committed May 12, 2024
1 parent fbc48f8 commit 060ab0a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ func TestCreateTransaction(t *testing.T) {
mock.ExpectQuery(cStmt).WithArgs("2021-08-01", 1000.0, "food", "expense", 1, "lunch", "http://image.com").WillReturnRows(sqlmock.NewRows(column).AddRow(1, "2021-08-01", 1000, "food", "expense", 1, "lunch", "http://image.com"))

h := NewHandler(config.FeatureFlag{}, db)

err = h.Create(c)
if err != nil {
t.Fatalf("error creating transaction: %v", err)
Expand Down Expand Up @@ -67,7 +68,7 @@ func TestUpdateTransaction(t *testing.T) {
column := []string{"id", "date", "amount", "category", "transaction_type", "spender_id", "note", "image_url"}
mock.ExpectQuery(uStmt).WithArgs("2021-08-01", 555.0, "shopping", "expense", 1, "lunch", "http://image.com", id).WillReturnRows(sqlmock.NewRows(column).AddRow(1, "2021-08-01", 555.0, "shopping", "expense", 1, "lunch", "http://image.com"))

h := New(config.FeatureFlag{}, db)
h := NewHandler(config.FeatureFlag{}, db)
err = h.Update(c)
if err != nil {
t.Fatalf("error updating transaction: %v", err)
Expand Down
2 changes: 1 addition & 1 deletion api/transaction/transaction_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (h handlerTransaction) Create(c echo.Context) error {
return c.JSON(http.StatusCreated, insertTransaction)
}

func (h handler) Update(c echo.Context) error {
func (h handlerTransaction) Update(c echo.Context) error {

logger := mlog.L(c)
ctx := c.Request().Context()
Expand Down

0 comments on commit 060ab0a

Please sign in to comment.