Working on refactoring

This commit is contained in:
Owen
2026-03-19 12:10:04 -07:00
parent d8b511b198
commit 7cbe3d42a1
5 changed files with 156 additions and 75 deletions

View File

@@ -366,18 +366,23 @@ export async function createSiteResource(
);
}
// Not sure what this is doing??
// const [newt] = await trx
// .select()
// .from(newts)
// .where(eq(newts.siteId, site.siteId))
// .limit(1);
for (const siteToAssign of sitesToAssign) {
const [newt] = await trx
.select()
.from(newts)
.where(eq(newts.siteId, siteToAssign.siteId))
.limit(1);
if (!newt) {
return next(
createHttpError(
HttpCode.NOT_FOUND,
`Newt not found for site ${siteToAssign.siteId}`
)
);
}
}
// if (!newt) {
// return next(
// createHttpError(HttpCode.NOT_FOUND, "Newt not found")
// );
// }
await rebuildClientAssociationsFromSiteResource(
newSiteResource,