task_id: task_create_api_create_album entity_id: api_create_album generated_at: '2025-12-18T15:16:50.255667' workflow_version: v001 target: type: api definition: id: api_create_album method: POST path: /api/albums description: Create new album request_body: title: string description: string cover_art_url: string release_date: string album_type: enum[album, ep, single] responses: - status: 201 description: Album created schema: id: uuid title: string cover_art_url: string auth: required: true roles: - musician depends_on_models: - model_album - model_artist related: models: - id: model_artist definition: &id001 id: model_artist name: Artist table_name: artists description: Extended profile for musicians fields: - name: id type: uuid constraints: - primary_key - name: user_id type: uuid constraints: - not_null - foreign_key references: users.id - name: stage_name type: string constraints: - not_null - name: bio type: text constraints: - nullable - name: cover_image_url type: string constraints: - nullable - name: social_links type: jsonb description: JSON object with {twitter, instagram, facebook, website} constraints: - nullable - name: verified type: boolean default: false - name: created_at type: timestamp constraints: - not_null - name: updated_at type: timestamp constraints: - not_null relations: - type: belongs_to to: model_user foreign_key: user_id - type: has_many to: model_song foreign_key: artist_id - type: has_many to: model_album foreign_key: artist_id - type: belongs_to to: model_label foreign_key: label_id optional: true indexes: - fields: - user_id unique: true - fields: - stage_name timestamps: true - id: model_album definition: &id002 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_artist - model_album definitions: - id: model_artist type: model definition: *id001 - id: model_album type: model definition: *id002 files: to_create: - app/api/albums/route.ts reference: [] acceptance: - criterion: POST /api/albums returns success response verification: curl -X POST /api/albums - criterion: Request validation implemented verification: Test with invalid data - criterion: Error responses match contract verification: Test error scenarios