MCPcopy Create free account
hub / github.com/adcontextprotocol/adcp / getUserSeatType

Function getUserSeatType

server/src/db/organization-db.ts:492–505  ·  view source on GitHub ↗
(userId: string)

Source from the content-addressed store, hash-verified

490 * - they are an active member of a working group
491 */
492export async function getUserSeatType(userId: string): Promise<SeatType | null> {
493 const pool = getPool();
494 const result = await pool.query<{ is_contributor: boolean }>(
495 `SELECT (
496 EXISTS (SELECT 1 FROM organization_memberships WHERE workos_user_id = $1 AND seat_type = 'contributor')
497 OR EXISTS (SELECT 1 FROM slack_user_mappings WHERE workos_user_id = $1 AND mapping_status = 'mapped')
498 OR EXISTS (SELECT 1 FROM working_group_memberships WHERE workos_user_id = $1 AND status = 'active')
499 ) as is_contributor
500 FROM organization_memberships WHERE workos_user_id = $1 LIMIT 1`,
501 [userId]
502 );
503 if (result.rows.length === 0) return null;
504 return result.rows[0]?.is_contributor ? 'contributor' : 'community_only';
505}
506
507// ==================== Seat Warning Threshold Management ====================
508

Callers 5

setupAuthRoutesMethod · 0.85
createCommitteeRoutersFunction · 0.85
createEventsRouterFunction · 0.85

Calls 1

getPoolFunction · 0.85

Tested by

no test coverage detected