(userId: string, action: string, points: number, referenceId?: string, referenceType?: string)
| 639 | // ===================================================== |
| 640 | |
| 641 | async awardPoints(userId: string, action: string, points: number, referenceId?: string, referenceType?: string): Promise<void> { |
| 642 | await query( |
| 643 | `INSERT INTO community_points (workos_user_id, action, points, reference_id, reference_type) |
| 644 | VALUES ($1, $2, $3, $4, $5) |
| 645 | ON CONFLICT (workos_user_id, action, reference_id) WHERE reference_id IS NOT NULL |
| 646 | DO NOTHING`, |
| 647 | [userId, action, points, referenceId || null, referenceType || null] |
| 648 | ); |
| 649 | } |
| 650 | |
| 651 | async getUserPoints(userId: string): Promise<number> { |
| 652 | const result = await query<{ total: string }>( |
no test coverage detected