Skip to content

Commit 6338ed9

Browse files
committed
fix: target deletion using NamedExec on UUID
1 parent 7e33f71 commit 6338ed9

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

internal/api/controllers/targets/controller.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func (controller *TargetController) CreateTarget(ec echo.Context, request gen.Cr
3939
return nil, echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Failed to save target: %v", err))
4040
}
4141

42-
return gen.CreateTarget201JSONResponse{}, nil
42+
return gen.CreateTarget201JSONResponse(NewDto(&newTarget)), nil
4343
}
4444

4545
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
6666
model.Label = *request.Body.Label
6767
}
6868
if request.Body.FfmpegOptions != nil {
69-
if opts, err := ffmpegOptsToModel(*request.Body.FfmpegOptions); err != nil {
69+
if opts, err := ffmpegOptsToModel(*request.Body.FfmpegOptions); err == nil {
7070
model.FfmpegOptions = opts
7171
} else {
72-
return nil, echo.NewHTTPError(http.StatusBadRequest, err)
72+
return nil, echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Failed to parse provided FFmpegOptions: %v", err))
7373
}
7474
}
7575

internal/api/gen/errors.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func GetHTTPErrorHandler(fallbackHandler echo.HTTPErrorHandler) echo.HTTPErrorHa
6262
// This is not an APIError, just let Echo handle it as it normally would
6363
// TODO: Consider just 500'ing here, and enforcing that our routes MUST
6464
// use the APIError if they want to expose error information.
65-
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)
65+
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)
6666
fallbackHandler(err, ctx)
6767
}
6868
}

internal/ffmpeg/store.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func (store *Store) GetMany(db database.Queryable, ids ...uuid.UUID) []*Target {
6363
}
6464

6565
func (store *Store) Delete(db database.Queryable, id uuid.UUID) {
66-
if _, err := db.NamedExec(`DELETE FROM transcode_target WHERE id=$1`, id); err != nil {
66+
if _, err := db.Exec(`DELETE FROM transcode_target WHERE id=$1`, id); err != nil {
6767
log.Fatalf("Failed to delete target (ID=%s): %v\n", id, err)
6868
}
6969
}

0 commit comments

Comments
 (0)