project-standalo-sonic-cloud/.workflow/versions/v001/contexts/api_update_album.yml

111 lines
2.4 KiB
YAML

task_id: task_create_api_update_album
entity_id: api_update_album
generated_at: '2025-12-18T15:16:50.260977'
workflow_version: v001
target:
type: api
definition:
id: api_update_album
method: PUT
path: /api/albums/:id
description: Update album metadata
request_body:
title: string
description: string
cover_art_url: string
release_date: string
responses:
- status: 200
description: Album updated
schema:
id: uuid
title: string
auth:
required: true
owner_only: true
depends_on_models:
- model_album
related:
models:
- id: model_album
definition: &id001
id: model_album
name: Album
table_name: albums
description: Collection of songs
fields:
- name: id
type: uuid
constraints:
- primary_key
- name: artist_id
type: uuid
constraints:
- not_null
- foreign_key
references: artists.id
- name: title
type: string
constraints:
- not_null
- name: description
type: text
constraints:
- nullable
- name: cover_art_url
type: string
constraints:
- nullable
- name: release_date
type: date
constraints:
- nullable
- name: album_type
type: enum
values:
- album
- ep
- single
default: album
- name: created_at
type: timestamp
constraints:
- not_null
- name: updated_at
type: timestamp
constraints:
- not_null
relations:
- type: belongs_to
to: model_artist
foreign_key: artist_id
- type: has_many
to: model_song
foreign_key: album_id
indexes:
- fields:
- artist_id
- fields:
- release_date
timestamps: true
apis: []
components: []
dependencies:
entity_ids:
- model_album
definitions:
- id: model_album
type: model
definition: *id001
files:
to_create:
- app/api/albums/id/route.ts
reference: []
acceptance:
- criterion: PUT /api/albums/:id returns success response
verification: curl -X PUT /api/albums/:id
- criterion: Request validation implemented
verification: Test with invalid data
- criterion: Error responses match contract
verification: Test error scenarios