task_id: task_create_model_share entity_id: model_share generated_at: '2025-12-18T18:15:12.902338' workflow_version: v004 target: type: model definition: 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 related: models: [] apis: [] components: [] dependencies: entity_ids: [] definitions: [] files: to_create: - prisma/schema.prisma - app/models/share.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