mirror of
https://github.com/fosrl/pangolin.git
synced 2026-01-28 22:00:51 +00:00
Merge branch 'dev' into pallavi/feat/make-niceId-editable
This commit is contained in:
@@ -163,12 +163,8 @@ export async function createTarget(
|
||||
);
|
||||
|
||||
if (existingTarget) {
|
||||
return next(
|
||||
createHttpError(
|
||||
HttpCode.BAD_REQUEST,
|
||||
`Target with IP ${targetData.ip}, port ${targetData.port}, method ${targetData.method} already exists for resource ID ${resourceId}`
|
||||
)
|
||||
);
|
||||
// log a warning
|
||||
logger.warn(`Target with IP ${targetData.ip}, port ${targetData.port}, method ${targetData.method} already exists for resource ID ${resourceId}`);
|
||||
}
|
||||
|
||||
let newTarget: Target[] = [];
|
||||
|
||||
@@ -48,12 +48,10 @@ export async function deleteTarget(
|
||||
|
||||
const { targetId } = parsedParams.data;
|
||||
|
||||
const [deletedTarget] = await db.transaction(async (tx) => {
|
||||
return await tx
|
||||
.delete(targets)
|
||||
.where(eq(targets.targetId, targetId))
|
||||
.returning();
|
||||
});
|
||||
const [deletedTarget] = await db
|
||||
.delete(targets)
|
||||
.where(eq(targets.targetId, targetId))
|
||||
.returning();
|
||||
|
||||
if (!deletedTarget) {
|
||||
return next(
|
||||
|
||||
@@ -170,12 +170,8 @@ export async function updateTarget(
|
||||
);
|
||||
|
||||
if (foundTarget) {
|
||||
return next(
|
||||
createHttpError(
|
||||
HttpCode.BAD_REQUEST,
|
||||
`Target with IP ${targetData.ip}, port ${targetData.port}, and method ${targetData.method} already exists on the same site.`
|
||||
)
|
||||
);
|
||||
// log a warning
|
||||
logger.warn(`Target with IP ${targetData.ip}, port ${targetData.port}, method ${targetData.method} already exists for resource ID ${target.resourceId}`);
|
||||
}
|
||||
|
||||
const { internalPort, targetIps } = await pickPort(site.siteId!, db);
|
||||
|
||||
Reference in New Issue
Block a user