Add asset preview management endpoints (PUT/DELETE /api/assets/{id}/preview)

- PUT /api/assets/{id}/preview: sets the preview asset for an existing asset,
  returns the full updated Asset object. Returns 404 if asset ID doesn't exist.
- DELETE /api/assets/{id}/preview: clears the preview asset link, returns 204.
  Returns 404 if asset ID doesn't exist.

Added OpenAPI spec entries under the assets tag with no x-runtime restriction.
Implemented handlers using the existing set_asset_preview service function.
Added integration tests covering happy paths and 404 cases.

Co-authored-by: Matt Miller <MillerMedia@users.noreply.github.com>
This commit is contained in:
Cursor Agent
2026-05-06 23:56:26 +00:00
committed by Matt Miller
parent 65045730a6
commit 9bd5710acb
3 changed files with 233 additions and 0 deletions

View File

@@ -1821,6 +1821,63 @@ paths:
"404":
description: Asset not found
/api/assets/{id}/preview:
put:
operationId: setAssetPreview
tags: [assets]
summary: Set preview asset
description: Sets the preview asset for an existing asset. The preview_id must reference an existing asset.
x-feature-gate: enable-assets
parameters:
- name: id
in: path
description: The asset ID.
required: true
schema:
type: string
format: uuid
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- preview_id
properties:
preview_id:
type: string
format: uuid
description: ID of the asset to use as the preview
responses:
"200":
description: Preview set successfully
content:
application/json:
schema:
$ref: "#/components/schemas/Asset"
"404":
description: Asset not found
delete:
operationId: clearAssetPreview
tags: [assets]
summary: Clear preview asset
description: Clears the preview asset link for an existing asset.
x-feature-gate: enable-assets
parameters:
- name: id
in: path
description: The asset ID.
required: true
schema:
type: string
format: uuid
responses:
"204":
description: Preview cleared
"404":
description: Asset not found
/api/assets/{id}/tags:
post:
operationId: addAssetTags