This commit is contained in:
Owen
2025-07-18 11:32:07 -07:00
parent 97b8e84143
commit dca2a29865
2 changed files with 19 additions and 9 deletions

BIN
config/db/db.sqlite.bak Normal file

Binary file not shown.

View File

@@ -164,14 +164,19 @@ export async function createSite(
const addressExistsSites = await db
.select()
.from(sites)
.where(eq(sites.address, updatedAddress))
.where(
and(
eq(sites.address, updatedAddress),
eq(sites.orgId, orgId)
)
)
.limit(1);
if (addressExistsSites.length > 0) {
return next(
createHttpError(
HttpCode.CONFLICT,
`Subnet ${subnet} already exists`
`Subnet ${updatedAddress} already exists in sites`
)
);
}
@@ -179,13 +184,18 @@ export async function createSite(
const addressExistsClients = await db
.select()
.from(clients)
.where(eq(clients.subnet, updatedAddress))
.where(
and(
eq(clients.subnet, updatedAddress),
eq(clients.orgId, orgId)
)
)
.limit(1);
if (addressExistsClients.length > 0) {
return next(
createHttpError(
HttpCode.CONFLICT,
`Subnet ${subnet} already exists`
`Subnet ${updatedAddress} already exists in clients`
)
);
}