127 lines
2.8 KiB
YAML
127 lines
2.8 KiB
YAML
task_id: task_create_api_register
|
|
entity_id: api_register
|
|
generated_at: '2025-12-18T15:16:50.226614'
|
|
workflow_version: v001
|
|
target:
|
|
type: api
|
|
definition:
|
|
id: api_register
|
|
method: POST
|
|
path: /api/auth/register
|
|
description: Register new user account
|
|
request_body:
|
|
email: string
|
|
password: string
|
|
name: string
|
|
role: enum[musician, listener, label]
|
|
responses:
|
|
- status: 201
|
|
description: User created successfully
|
|
schema:
|
|
user:
|
|
id: uuid
|
|
email: string
|
|
name: string
|
|
role: string
|
|
token: string
|
|
- status: 400
|
|
description: Validation error
|
|
schema:
|
|
error: string
|
|
- status: 409
|
|
description: Email already exists
|
|
schema:
|
|
error: string
|
|
auth:
|
|
required: false
|
|
depends_on_models:
|
|
- model_user
|
|
related:
|
|
models:
|
|
- id: model_user
|
|
definition: &id001
|
|
id: model_user
|
|
name: User
|
|
table_name: users
|
|
description: Base user entity with authentication
|
|
fields:
|
|
- name: id
|
|
type: uuid
|
|
constraints:
|
|
- primary_key
|
|
- name: email
|
|
type: string
|
|
constraints:
|
|
- unique
|
|
- not_null
|
|
- name: password_hash
|
|
type: string
|
|
constraints:
|
|
- not_null
|
|
- name: name
|
|
type: string
|
|
constraints:
|
|
- not_null
|
|
- name: role
|
|
type: enum
|
|
values:
|
|
- musician
|
|
- listener
|
|
- label
|
|
constraints:
|
|
- not_null
|
|
- name: email_verified
|
|
type: boolean
|
|
default: false
|
|
- name: avatar_url
|
|
type: string
|
|
constraints:
|
|
- nullable
|
|
- name: created_at
|
|
type: timestamp
|
|
constraints:
|
|
- not_null
|
|
- name: updated_at
|
|
type: timestamp
|
|
constraints:
|
|
- not_null
|
|
relations:
|
|
- type: has_one
|
|
to: model_artist
|
|
foreign_key: user_id
|
|
condition: role = 'musician'
|
|
- type: has_one
|
|
to: model_label
|
|
foreign_key: user_id
|
|
condition: role = 'label'
|
|
- type: has_many
|
|
to: model_playlist
|
|
foreign_key: user_id
|
|
indexes:
|
|
- fields:
|
|
- email
|
|
unique: true
|
|
- fields:
|
|
- role
|
|
timestamps: true
|
|
apis: []
|
|
components: []
|
|
dependencies:
|
|
entity_ids:
|
|
- model_user
|
|
definitions:
|
|
- id: model_user
|
|
type: model
|
|
definition: *id001
|
|
files:
|
|
to_create:
|
|
- app/api/auth/register/route.ts
|
|
reference: []
|
|
acceptance:
|
|
- criterion: POST /api/auth/register returns success response
|
|
verification: curl -X POST /api/auth/register
|
|
- criterion: Request validation implemented
|
|
verification: Test with invalid data
|
|
- criterion: Error responses match contract
|
|
verification: Test error scenarios
|