project-standalo-sonic-cloud/.workflow/versions/v003/contexts/api_get_label.yml

160 lines
3.9 KiB
YAML

task_id: task_create_api_get_label
entity_id: api_get_label
generated_at: '2025-12-18T17:43:33.706954'
workflow_version: v003
target:
type: api
definition:
id: api_get_label
method: GET
path: /api/labels/[id]
summary: Get label details
description: Retrieve label profile with artist roster and statistics
tags:
- labels
path_params:
- name: id
type: string
description: Label ID
responses:
- status: 200
description: Label found
schema:
type: object
properties:
- name: id
type: uuid
- name: name
type: string
- name: slug
type: string
- name: description
type: string
- name: logoUrl
type: string
- name: website
type: string
- name: artists
type: array
- name: _count
type: object
example:
id: 550e8400-e29b-41d4-a716-446655440000
name: Sonic Records
slug: sonic-records
description: Independent music label
artists: []
_count:
artists: 5
songs: 120
- status: 404
description: Label not found
schema:
type: object
properties:
- name: error
type: string
depends_on_models:
- model_label_invitation
depends_on_apis: []
auth:
required: false
roles: []
related:
models:
- id: model_label_invitation
definition: &id001
id: model_label_invitation
name: LabelInvitation
description: Invitations from labels to artists to join their roster
table_name: label_invitations
fields:
- name: id
type: uuid
constraints:
- primary_key
description: Unique identifier
- name: labelId
type: uuid
constraints:
- foreign_key
- not_null
- indexed
description: Reference to the inviting label (FK to labels table)
- name: artistId
type: uuid
constraints:
- foreign_key
- not_null
- indexed
description: Reference to the invited artist (FK to artists table)
- name: status
type: enum
enum_values:
- pending
- accepted
- declined
- expired
constraints:
- not_null
- default
default: pending
description: Current status of the invitation
- name: message
type: text
constraints: []
description: Optional message from label to artist
- name: expiresAt
type: datetime
constraints:
- not_null
description: When the invitation expires
- name: createdAt
type: datetime
constraints:
- not_null
description: When invitation was created
- name: updatedAt
type: datetime
constraints:
- not_null
description: When invitation was last updated
relations: []
indexes:
- fields:
- labelId
- artistId
unique: true
name: label_artist_unique
- fields:
- artistId
- status
unique: false
name: artist_pending_invitations
timestamps: true
soft_delete: false
validations:
- field: expiresAt
rule: future_date
message: Expiration date must be in the future
apis: []
components: []
dependencies:
entity_ids:
- model_label_invitation
definitions:
- id: model_label_invitation
type: model
definition: *id001
files:
to_create:
- app/api/labels/[id]/route.ts
reference: []
acceptance:
- criterion: GET /api/labels/[id] returns success response
verification: curl -X GET /api/labels/[id]
- criterion: Request validation implemented
verification: Test with invalid data
- criterion: Error responses match contract
verification: Test error scenarios