(domain: string)
| 1567 | WHERE scope_key LIKE 'org:%' |
| 1568 | AND ( |
| 1569 | recipients->'userIds' ? ${userId}::text |
| 1570 | OR recipients->'emails' ? ${originalEmail}::text |
| 1571 | ) |
| 1572 | `); |
| 1573 | await tx.delete(user_period_cache).where(eq(user_period_cache.kilo_user_id, userId)); |
| 1574 | await tx |
| 1575 | .delete(kilo_pass_scheduled_changes) |
| 1576 | .where(eq(kilo_pass_scheduled_changes.kilo_user_id, userId)); |
| 1577 | await tx |
| 1578 | .delete(github_branch_pull_requests) |
| 1579 | .where(eq(github_branch_pull_requests.owned_by_user_id, userId)); |
| 1580 | |
| 1581 | // Moderation data. Blocks/mutes key on the blocker's Kilo user id; the |
| 1582 | // other column is a GitHub login, so only the blocker side is deleted. |
| 1583 | await tx |
| 1584 | .delete(content_moderation_reports) |
| 1585 | .where(eq(content_moderation_reports.kilo_user_id, userId)); |
| 1586 | await tx.delete(user_moderation_blocks).where(eq(user_moderation_blocks.blocker_user_id, userId)); |
| 1587 | await tx.delete(user_moderation_mutes).where(eq(user_moderation_mutes.blocker_user_id, userId)); |
| 1588 | await tx.delete(user_terms_acceptances).where(eq(user_terms_acceptances.kilo_user_id, userId)); |
| 1589 | |
| 1590 | // Quick chat threads and messages are user-owned, so they are hard-deleted |
no outgoing calls
no test coverage detected