(viewerUserId: string, profileUserId: string)
| 599 | } |
| 600 | |
| 601 | async getConnectionStatus(viewerUserId: string, profileUserId: string): Promise<{ status: string; id: string; direction: 'sent' | 'received' } | null> { |
| 602 | const result = await query<{ status: string; id: string; requester_user_id: string }>( |
| 603 | `SELECT id, status, requester_user_id FROM connections |
| 604 | WHERE (requester_user_id = $1 AND recipient_user_id = $2) |
| 605 | OR (requester_user_id = $2 AND recipient_user_id = $1) |
| 606 | LIMIT 1`, |
| 607 | [viewerUserId, profileUserId] |
| 608 | ); |
| 609 | const row = result.rows[0]; |
| 610 | if (!row) return null; |
| 611 | return { |
| 612 | status: row.status, |
| 613 | id: row.id, |
| 614 | direction: row.requester_user_id === viewerUserId ? 'sent' : 'received', |
| 615 | }; |
| 616 | } |
| 617 | |
| 618 | async getConnectionCount(userId: string): Promise<number> { |
| 619 | const result = await query<{ count: string }>( |
no outgoing calls
no test coverage detected