@7365admin1/core 3.52.16 → 3.52.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/dist/index.js +18 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/test/e2e/patrol-email-scope.e2e.test.mjs +0 -1
package/dist/index.mjs
CHANGED
|
@@ -61241,10 +61241,20 @@ function usePatrolEmailController() {
|
|
|
61241
61241
|
getById: _getById,
|
|
61242
61242
|
deleteById: _deleteById
|
|
61243
61243
|
} = usePatrolEmailService();
|
|
61244
|
+
async function requirePatrolEmailReach(req, site) {
|
|
61245
|
+
await requireSiteReach(req, site);
|
|
61246
|
+
}
|
|
61247
|
+
async function requireRecordReach(req, id) {
|
|
61248
|
+
const record = await _getById(id);
|
|
61249
|
+
await requirePatrolEmailReach(req, record?.site);
|
|
61250
|
+
return record;
|
|
61251
|
+
}
|
|
61244
61252
|
async function send2(req, res, next) {
|
|
61245
|
-
const
|
|
61246
|
-
|
|
61247
|
-
|
|
61253
|
+
const actor = await resolveInviteActor(callerId(req));
|
|
61254
|
+
const { error, value } = schemaSendPatrolEmail.validate(
|
|
61255
|
+
{ ...req.body, createdBy: { _id: actor.id, name: actor.name } },
|
|
61256
|
+
{ abortEarly: false }
|
|
61257
|
+
);
|
|
61248
61258
|
if (error) {
|
|
61249
61259
|
const messages = error.details.map((d) => d.message).join(", ");
|
|
61250
61260
|
logger114.log({ level: "error", message: messages });
|
|
@@ -61252,6 +61262,7 @@ function usePatrolEmailController() {
|
|
|
61252
61262
|
return;
|
|
61253
61263
|
}
|
|
61254
61264
|
try {
|
|
61265
|
+
await requirePatrolEmailReach(req, value.site);
|
|
61255
61266
|
const cookieHeader = req.headers.cookie;
|
|
61256
61267
|
const data = await _send({
|
|
61257
61268
|
site: value.site,
|
|
@@ -61295,6 +61306,7 @@ function usePatrolEmailController() {
|
|
|
61295
61306
|
return;
|
|
61296
61307
|
}
|
|
61297
61308
|
try {
|
|
61309
|
+
await requireRecordReach(req, params.value.id);
|
|
61298
61310
|
const data = await _resend({
|
|
61299
61311
|
id: params.value.id,
|
|
61300
61312
|
createdBy: value.createdBy,
|
|
@@ -61322,6 +61334,7 @@ function usePatrolEmailController() {
|
|
|
61322
61334
|
return;
|
|
61323
61335
|
}
|
|
61324
61336
|
try {
|
|
61337
|
+
await requirePatrolEmailReach(req, value.site);
|
|
61325
61338
|
res.json(await _getAll(value));
|
|
61326
61339
|
return;
|
|
61327
61340
|
} catch (err) {
|
|
@@ -61341,7 +61354,7 @@ function usePatrolEmailController() {
|
|
|
61341
61354
|
return;
|
|
61342
61355
|
}
|
|
61343
61356
|
try {
|
|
61344
|
-
res.json({ data: await
|
|
61357
|
+
res.json({ data: await requireRecordReach(req, value.id) });
|
|
61345
61358
|
return;
|
|
61346
61359
|
} catch (err) {
|
|
61347
61360
|
logger114.log({ level: "error", message: `${err.message}` });
|
|
@@ -61360,6 +61373,7 @@ function usePatrolEmailController() {
|
|
|
61360
61373
|
return;
|
|
61361
61374
|
}
|
|
61362
61375
|
try {
|
|
61376
|
+
await requireRecordReach(req, value.id);
|
|
61363
61377
|
res.json({ message: await _deleteById(value.id) });
|
|
61364
61378
|
return;
|
|
61365
61379
|
} catch (err) {
|