project-standalo-note-to-app/.workflow/versions/v001/contexts/api_get_current_user.yml

127 lines
2.9 KiB
YAML

task_id: task_create_api_get_current_user
entity_id: api_get_current_user
generated_at: '2025-12-19T06:08:12.148074'
workflow_version: v001
target:
type: api
definition:
id: api_get_current_user
method: GET
path: /api/auth/me
summary: Get current user
description: Get currently authenticated user information
tags:
- auth
path_params: []
query_params: []
request_body:
content_type: application/json
schema:
type: object
properties: []
responses:
- status: 200
description: User data
schema:
type: object
properties:
- name: id
type: uuid
- name: email
type: string
- name: name
type: string
- name: created_at
type: datetime
example:
id: 550e8400-e29b-41d4-a716-446655440000
email: user@example.com
name: John Doe
created_at: '2024-12-19T06:00:00Z'
- status: 401
description: Not authenticated
schema:
type: object
properties:
- name: error
type: string
example:
error: Not authenticated
depends_on_models:
- model_user
depends_on_apis: []
auth:
required: true
roles: []
related:
models:
- id: model_user
definition: &id001
id: model_user
name: User
description: Application user account with email/password authentication
table_name: users
fields:
- name: id
type: uuid
constraints:
- primary_key
description: Unique user identifier
- name: email
type: string
constraints:
- unique
- not_null
- indexed
description: User email address for login
- name: name
type: string
constraints:
- not_null
description: User's display name
- name: password_hash
type: string
constraints:
- not_null
description: Bcrypt hashed password
relations: []
indexes:
- fields:
- email
unique: true
name: idx_users_email
timestamps: true
soft_delete: false
validations:
- field: email
rule: email
message: Invalid email format
- field: name
rule: min:1
message: Name is required
- field: password_hash
rule: min:60
message: Invalid password hash
external: false
apis: []
components: []
dependencies:
entity_ids:
- model_user
definitions:
- id: model_user
type: model
definition: *id001
external: false
files:
to_create:
- app/api/auth/me/route.ts
reference: []
acceptance:
- criterion: GET /api/auth/me returns success response
verification: curl -X GET /api/auth/me
- criterion: Request validation implemented
verification: Test with invalid data
- criterion: Error responses match contract
verification: Test error scenarios