package api //go:generate go run github.com/deepmap/oapi-codegen/v2/cmd/oapi-codegen --config=api.cfg.yaml ../../docs/openapi.yaml import ( "database/sql" "log" "net/http" "github.com/labstack/echo/v4" ) type ServerImpl struct { Db *sql.DB } func (*ServerImpl) GetBanks(ctx echo.Context) error { return echo.NewHTTPError(http.StatusNotImplemented) } func (*ServerImpl) GetBankById(ctx echo.Context, bankId int64) error { return echo.NewHTTPError(http.StatusNotImplemented) } func (pf *ServerImpl) GetTransactions(ctx echo.Context, params GetTransactionsParams) error { rows, err := pf.Db.Query("SELECT tc.name, t.date, t.description, t.id, t.amount FROM pfbudget.transactions t LEFT JOIN pfbudget.transactions_categorized tc ON t.id = tc.id") if err != nil { log.Fatal(err) } return ctx.JSON(http.StatusOK, convert[Transaction](rows)) } func (*ServerImpl) GetTransactionById(ctx echo.Context, transactionId int64) error { return echo.NewHTTPError(http.StatusNotImplemented) }