MCPcopy Index your code
hub / github.com/sourcebot-dev/sourcebot / orgHasAvailability

Function orgHasAvailability

packages/web/src/lib/authUtils.ts:164–186  ·  view source on GitHub ↗
(orgId: number)

Source from the content-addressed store, hash-verified

162 * the offline license key, if available.
163 */
164export const orgHasAvailability = async (orgId: number): Promise<boolean> => {
165 const org = await __unsafePrisma.org.findUniqueOrThrow({
166 where: {
167 id: orgId,
168 },
169 include: {
170 members: true,
171 }
172 });
173
174 const seatCap = getSeatCap();
175 const memberCount = org.members.length;
176
177 if (
178 seatCap &&
179 memberCount >= seatCap
180 ) {
181 logger.error(`orgHasAvailability: org ${org.id} has reached max capacity`);
182 return false;
183 }
184
185 return true;
186}
187
188export const addUserToOrganization = async (userId: string, orgId: number): Promise<{ success: boolean } | ServiceError> => {
189 const user = await __unsafePrisma.user.findUnique({

Callers 5

createInvitesFunction · 0.90
redeemInviteFunction · 0.90
page.tsxFile · 0.90
onCreateUserFunction · 0.85
addUserToOrganizationFunction · 0.85

Calls 1

getSeatCapFunction · 0.90

Tested by

no test coverage detected