mirror of
https://github.com/fosrl/pangolin.git
synced 2025-12-12 19:18:30 +00:00
Fix #1085
This commit is contained in:
BIN
config/db/db.sqlite.bak
Normal file
BIN
config/db/db.sqlite.bak
Normal file
Binary file not shown.
@@ -164,14 +164,19 @@ export async function createSite(
|
|||||||
const addressExistsSites = await db
|
const addressExistsSites = await db
|
||||||
.select()
|
.select()
|
||||||
.from(sites)
|
.from(sites)
|
||||||
.where(eq(sites.address, updatedAddress))
|
.where(
|
||||||
|
and(
|
||||||
|
eq(sites.address, updatedAddress),
|
||||||
|
eq(sites.orgId, orgId)
|
||||||
|
)
|
||||||
|
)
|
||||||
.limit(1);
|
.limit(1);
|
||||||
|
|
||||||
if (addressExistsSites.length > 0) {
|
if (addressExistsSites.length > 0) {
|
||||||
return next(
|
return next(
|
||||||
createHttpError(
|
createHttpError(
|
||||||
HttpCode.CONFLICT,
|
HttpCode.CONFLICT,
|
||||||
`Subnet ${subnet} already exists`
|
`Subnet ${updatedAddress} already exists in sites`
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -179,13 +184,18 @@ export async function createSite(
|
|||||||
const addressExistsClients = await db
|
const addressExistsClients = await db
|
||||||
.select()
|
.select()
|
||||||
.from(clients)
|
.from(clients)
|
||||||
.where(eq(clients.subnet, updatedAddress))
|
.where(
|
||||||
|
and(
|
||||||
|
eq(clients.subnet, updatedAddress),
|
||||||
|
eq(clients.orgId, orgId)
|
||||||
|
)
|
||||||
|
)
|
||||||
.limit(1);
|
.limit(1);
|
||||||
if (addressExistsClients.length > 0) {
|
if (addressExistsClients.length > 0) {
|
||||||
return next(
|
return next(
|
||||||
createHttpError(
|
createHttpError(
|
||||||
HttpCode.CONFLICT,
|
HttpCode.CONFLICT,
|
||||||
`Subnet ${subnet} already exists`
|
`Subnet ${updatedAddress} already exists in clients`
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user