Add missing await

This commit is contained in:
Owen Schwartz 2024-10-14 22:33:51 -04:00
parent 1f42409826
commit 9f0c9c595d
No known key found for this signature in database
GPG key ID: 8271FDFFD9E0CCBD
2 changed files with 2 additions and 2 deletions

View file

@ -21,7 +21,7 @@ export async function getUniqueName(orgId: string): Promise<string> {
} }
const name = generateName(); const name = generateName();
const count = await db.select({niceId: sites.niceId, orgId: sites.orgId}).from(sites).where(and(eq(sites.niceId, name), eq(sites.orgId, orgId))); const count = await db.select({ niceId: sites.niceId, orgId: sites.orgId }).from(sites).where(and(eq(sites.niceId, name), eq(sites.orgId, orgId)));
if (count.length === 0) { if (count.length === 0) {
return name; return name;
} }

View file

@ -73,7 +73,7 @@ export async function createSite(req: Request, res: Response, next: NextFunction
return next(createHttpError(HttpCode.FORBIDDEN, 'User does not have a role')); return next(createHttpError(HttpCode.FORBIDDEN, 'User does not have a role'));
} }
const niceId = getUniqueName(); const niceId = await getUniqueName(orgId);
// TODO: pick a subnet // TODO: pick a subnet