deffiretiate main and custom edits

This commit is contained in:
arc-alex
2025-05-28 16:58:41 +02:00
parent 549c291f56
commit 0ff5f1b79b
9 changed files with 83 additions and 18 deletions
@@ -31,6 +31,8 @@ export async function generateUrl(req: Request, res: Response<GetUrl | ErrorResp
req.body.baseUrl,
req.body.path,
req.body.lock,
req.body.lockMainFields,
req.body.lockCustomFields,
req.body.authenticate,
);
res.status(200).send({ url: url.toString() });
@@ -59,6 +59,8 @@ export function generateAuthenticatedUrl(
baseUrl: string,
path: string,
lock: boolean,
lockMainFields: boolean,
lockCustomFields: boolean,
authenticate: boolean,
prefix = routerPrefix,
hash = hashedPassword,
@@ -72,5 +74,11 @@ export function generateAuthenticatedUrl(
if (lock) {
url.searchParams.append('locked', 'true');
}
if (lockMainFields) {
url.searchParams.append('lmain', 'true');
}
if (lockCustomFields) {
url.searchParams.append('lcustom', 'true');
}
return url;
}
@@ -5,6 +5,8 @@ export const validateGenerateUrl = [
body('baseUrl').exists().isString().notEmpty().trim(),
body('path').exists().isString().trim(),
body('lock').exists().isBoolean(),
body('lockMainFields').exists().isBoolean(),
body('lockCustomFields').exists().isBoolean(),
body('authenticate').exists().isBoolean(),
(req: Request, res: Response, next: NextFunction) => {