task_id: task_create_api_resolve_share entity_id: api_resolve_share generated_at: '2025-12-18T18:15:12.908509' workflow_version: v004 target: type: api definition: id: api_resolve_share method: GET path: /api/share/[token] description: Resolve share token and get content details auth: required: false request_params: - name: token type: string location: path required: true description: Share token to resolve responses: - status: 200 description: Share resolved successfully schema: type: string targetId: string content: object shareUrl: string - status: 404 description: Share not found or content no longer available schema: error: string business_logic: - Lookup Share record by token - Fetch associated content based on type (Song/Playlist/Album) - Include artist information for songs/albums - Include song list for playlists - Verify content is still public and available - Return content details for display depends_on_models: - model_share related: models: - id: model_share definition: &id001 id: model_share name: Share table_name: shares description: Tracks shared content links with analytics primary_key: id fields: - name: id type: String constraints: - primary_key - cuid description: Unique identifier for the share - name: type type: ShareType constraints: - required description: Type of content being shared (SONG, PLAYLIST, ALBUM) - name: targetId type: String constraints: - required description: ID of the shared content (references songs/playlists/albums) - name: token type: String constraints: - required - unique description: Unique URL-safe token for share links - name: userId type: String constraints: - optional description: User who created the share (null for anonymous shares) - name: platform type: String constraints: - optional description: Platform where content was shared to (twitter, facebook, etc) - name: clickCount type: Int default: 0 description: Number of times the share link was clicked - name: createdAt type: DateTime default: now() description: Timestamp when the share was created relations: [] indexes: - fields: - token unique: true description: Fast lookup by share token - fields: - targetId - type description: Fast lookup of shares for specific content timestamps: false validations: - field: token rule: minLength(8) message: Token must be at least 8 characters - field: type rule: enum(SONG, PLAYLIST, ALBUM) message: Type must be SONG, PLAYLIST, or ALBUM apis: [] components: [] dependencies: entity_ids: - model_share definitions: - id: model_share type: model definition: *id001 files: to_create: - app/api/share/[token]/route.ts reference: [] acceptance: - criterion: GET /api/share/[token] returns success response verification: curl -X GET /api/share/[token] - criterion: Request validation implemented verification: Test with invalid data - criterion: Error responses match contract verification: Test error scenarios