diff --git a/internal/api/controllers/targets/controller.go b/internal/api/controllers/targets/controller.go index 7c7748b..2eed3a4 100644 --- a/internal/api/controllers/targets/controller.go +++ b/internal/api/controllers/targets/controller.go @@ -39,7 +39,7 @@ func (controller *TargetController) CreateTarget(ec echo.Context, request gen.Cr return nil, echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Failed to save target: %v", err)) } - return gen.CreateTarget201JSONResponse{}, nil + return gen.CreateTarget201JSONResponse(NewDto(&newTarget)), nil } func (controller *TargetController) ListTargets(ec echo.Context, request gen.ListTargetsRequestObject) (gen.ListTargetsResponseObject, error) { @@ -66,10 +66,10 @@ func (controller *TargetController) UpdateTarget(ec echo.Context, request gen.Up model.Label = *request.Body.Label } if request.Body.FfmpegOptions != nil { - if opts, err := ffmpegOptsToModel(*request.Body.FfmpegOptions); err != nil { + if opts, err := ffmpegOptsToModel(*request.Body.FfmpegOptions); err == nil { model.FfmpegOptions = opts } else { - return nil, echo.NewHTTPError(http.StatusBadRequest, err) + return nil, echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Failed to parse provided FFmpegOptions: %v", err)) } } diff --git a/internal/api/gen/errors.go b/internal/api/gen/errors.go index c890b4b..96a18f9 100644 --- a/internal/api/gen/errors.go +++ b/internal/api/gen/errors.go @@ -62,7 +62,7 @@ func GetHTTPErrorHandler(fallbackHandler echo.HTTPErrorHandler) echo.HTTPErrorHa // This is not an APIError, just let Echo handle it as it normally would // TODO: Consider just 500'ing here, and enforcing that our routes MUST // use the APIError if they want to expose error information. - logger.Warnf("Request to %s caused error response, however the response does not satisfy the APIError interface. Falling back to default HTTP error handling\n", ctx.Request().RequestURI) + logger.Warnf("%s request to %s caused error response, however the response does not satisfy the APIError interface. Falling back to default HTTP error handling\n", ctx.Request().Method, ctx.Request().RequestURI) fallbackHandler(err, ctx) } } diff --git a/internal/ffmpeg/store.go b/internal/ffmpeg/store.go index ef27b1d..926eade 100644 --- a/internal/ffmpeg/store.go +++ b/internal/ffmpeg/store.go @@ -63,7 +63,7 @@ func (store *Store) GetMany(db database.Queryable, ids ...uuid.UUID) []*Target { } func (store *Store) Delete(db database.Queryable, id uuid.UUID) { - if _, err := db.NamedExec(`DELETE FROM transcode_target WHERE id=$1`, id); err != nil { + if _, err := db.Exec(`DELETE FROM transcode_target WHERE id=$1`, id); err != nil { log.Fatalf("Failed to delete target (ID=%s): %v\n", id, err) } }