(userId: string)
| 657 | } |
| 658 | |
| 659 | async getUserBadges(userId: string): Promise<Badge[]> { |
| 660 | const result = await query<Badge & { awarded_at: string }>( |
| 661 | `SELECT b.id, b.name, b.description, b.icon, b.category, ub.awarded_at |
| 662 | FROM user_badges ub |
| 663 | JOIN badges b ON b.id = ub.badge_id |
| 664 | WHERE ub.workos_user_id = $1 |
| 665 | ORDER BY ub.awarded_at DESC`, |
| 666 | [userId] |
| 667 | ); |
| 668 | return result.rows; |
| 669 | } |
| 670 | |
| 671 | async awardBadge(userId: string, badgeId: string): Promise<boolean> { |
| 672 | const result = await query( |
no outgoing calls
no test coverage detected