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

133 lines
2.8 KiB
YAML

task_id: task_create_model_song
entity_id: model_song
generated_at: '2025-12-18T15:16:50.222463'
workflow_version: v001
target:
type: model
definition:
id: model_song
name: Song
table_name: songs
description: Audio track with metadata
fields:
- name: id
type: uuid
constraints:
- primary_key
- name: artist_id
type: uuid
constraints:
- not_null
- foreign_key
references: artists.id
- name: album_id
type: uuid
constraints:
- nullable
- foreign_key
references: albums.id
- name: title
type: string
constraints:
- not_null
- name: duration
type: integer
description: Duration in seconds
constraints:
- not_null
- name: file_url
type: string
description: Cloud storage URL for audio file
constraints:
- not_null
- name: file_format
type: enum
values:
- mp3
- wav
constraints:
- not_null
- name: file_size
type: integer
description: File size in bytes
constraints:
- not_null
- name: waveform_data
type: jsonb
description: Waveform visualization data
constraints:
- nullable
- name: cover_art_url
type: string
constraints:
- nullable
- name: release_date
type: date
constraints:
- nullable
- name: play_count
type: integer
default: 0
- name: is_public
type: boolean
default: true
- name: track_number
type: integer
description: Position in album
constraints:
- nullable
- 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: belongs_to
to: model_album
foreign_key: album_id
optional: true
- type: has_many
to: model_genre
through: song_genres
foreign_key: song_id
- type: has_many
to: model_playlist_song
foreign_key: song_id
indexes:
- fields:
- artist_id
- fields:
- album_id
- fields:
- release_date
- fields:
- play_count
- fields:
- is_public
timestamps: true
related:
models: []
apis: []
components: []
dependencies:
entity_ids: []
definitions: []
files:
to_create:
- prisma/schema.prisma
- app/models/song.ts
reference: []
acceptance:
- criterion: Model defined in Prisma schema
verification: Check prisma/schema.prisma
- criterion: TypeScript types exported
verification: Import type in test file
- criterion: Relations properly configured
verification: Check Prisma relations