@7365admin1/core 2.57.0 → 2.58.0
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 +6 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +61 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +61 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -30632,6 +30632,7 @@ var BulletinRecipient = /* @__PURE__ */ ((BulletinRecipient2) => {
|
|
|
30632
30632
|
})(BulletinRecipient || {});
|
|
30633
30633
|
var BulletinStatus = /* @__PURE__ */ ((BulletinStatus2) => {
|
|
30634
30634
|
BulletinStatus2["ACTIVE"] = "active";
|
|
30635
|
+
BulletinStatus2["UPCOMING"] = "upcoming";
|
|
30635
30636
|
BulletinStatus2["EXPIRED"] = "expired";
|
|
30636
30637
|
BulletinStatus2["DELETED"] = "deleted";
|
|
30637
30638
|
return BulletinStatus2;
|
|
@@ -30985,12 +30986,48 @@ function useBulletinBoardRepo() {
|
|
|
30985
30986
|
throw error;
|
|
30986
30987
|
}
|
|
30987
30988
|
}
|
|
30989
|
+
async function processUpcomingBulletinBoards(session) {
|
|
30990
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
30991
|
+
const query = {
|
|
30992
|
+
status: "upcoming" /* UPCOMING */,
|
|
30993
|
+
startDate: { $lte: now }
|
|
30994
|
+
};
|
|
30995
|
+
try {
|
|
30996
|
+
const res = await collection.updateMany(
|
|
30997
|
+
query,
|
|
30998
|
+
{
|
|
30999
|
+
$set: {
|
|
31000
|
+
status: "active" /* ACTIVE */,
|
|
31001
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
31002
|
+
}
|
|
31003
|
+
},
|
|
31004
|
+
{ session }
|
|
31005
|
+
);
|
|
31006
|
+
if (res.matchedCount === 0) {
|
|
31007
|
+
throw new NotFoundError30("No upcoming bulletin boards found to activate.");
|
|
31008
|
+
}
|
|
31009
|
+
delNamespace().then(() => {
|
|
31010
|
+
logger104.info(
|
|
31011
|
+
`Cache cleared for namespace: ${bulletin_boards_namespace_collection}`
|
|
31012
|
+
);
|
|
31013
|
+
}).catch((err) => {
|
|
31014
|
+
logger104.error(
|
|
31015
|
+
`Failed to clear cache for namespace: ${bulletin_boards_namespace_collection}`,
|
|
31016
|
+
err
|
|
31017
|
+
);
|
|
31018
|
+
});
|
|
31019
|
+
return res;
|
|
31020
|
+
} catch (error) {
|
|
31021
|
+
throw error;
|
|
31022
|
+
}
|
|
31023
|
+
}
|
|
30988
31024
|
return {
|
|
30989
31025
|
add,
|
|
30990
31026
|
getAll,
|
|
30991
31027
|
getBulletinBoardById,
|
|
30992
31028
|
updateBulletinBoardById,
|
|
30993
31029
|
processExpiredBulletinBoards,
|
|
31030
|
+
processUpcomingBulletinBoards,
|
|
30994
31031
|
deleteBulletinBoardById,
|
|
30995
31032
|
createIndexes
|
|
30996
31033
|
};
|
|
@@ -31003,6 +31040,7 @@ function useBulletinBoardService() {
|
|
|
31003
31040
|
add: _add,
|
|
31004
31041
|
updateBulletinBoardById: _updateBulletinBoardById,
|
|
31005
31042
|
processExpiredBulletinBoards: _processExpiredBulletinBoards,
|
|
31043
|
+
processUpcomingBulletinBoards: _processUpcomingBulletinBoards,
|
|
31006
31044
|
deleteBulletinBoardById: _deleteBulletinBoardById,
|
|
31007
31045
|
getBulletinBoardById: _getBulletinBoardById
|
|
31008
31046
|
} = useBulletinBoardRepo();
|
|
@@ -31010,6 +31048,9 @@ function useBulletinBoardService() {
|
|
|
31010
31048
|
async function add(value) {
|
|
31011
31049
|
const session = useAtlas67.getClient()?.startSession();
|
|
31012
31050
|
session?.startTransaction();
|
|
31051
|
+
if (value.startDate && new Date(value.startDate) > /* @__PURE__ */ new Date()) {
|
|
31052
|
+
value.status = "upcoming" /* UPCOMING */;
|
|
31053
|
+
}
|
|
31013
31054
|
try {
|
|
31014
31055
|
await _add(value, session);
|
|
31015
31056
|
await session?.commitTransaction();
|
|
@@ -31035,6 +31076,20 @@ function useBulletinBoardService() {
|
|
|
31035
31076
|
session?.endSession();
|
|
31036
31077
|
}
|
|
31037
31078
|
}
|
|
31079
|
+
async function processUpcomingBulletinBoards() {
|
|
31080
|
+
const session = useAtlas67.getClient()?.startSession();
|
|
31081
|
+
session?.startTransaction();
|
|
31082
|
+
try {
|
|
31083
|
+
await _processUpcomingBulletinBoards(session);
|
|
31084
|
+
await session?.commitTransaction();
|
|
31085
|
+
return;
|
|
31086
|
+
} catch (error) {
|
|
31087
|
+
await session?.abortTransaction();
|
|
31088
|
+
throw error;
|
|
31089
|
+
} finally {
|
|
31090
|
+
session?.endSession();
|
|
31091
|
+
}
|
|
31092
|
+
}
|
|
31038
31093
|
async function processExpiredBulletinBoards() {
|
|
31039
31094
|
const session = useAtlas67.getClient()?.startSession();
|
|
31040
31095
|
session?.startTransaction();
|
|
@@ -31076,6 +31131,7 @@ function useBulletinBoardService() {
|
|
|
31076
31131
|
add,
|
|
31077
31132
|
updateBulletinBoardById,
|
|
31078
31133
|
processExpiredBulletinBoards,
|
|
31134
|
+
processUpcomingBulletinBoards,
|
|
31079
31135
|
deleteBulletinBoardById
|
|
31080
31136
|
};
|
|
31081
31137
|
}
|
|
@@ -32703,14 +32759,15 @@ function useEventManagementRepo() {
|
|
|
32703
32759
|
} catch (error) {
|
|
32704
32760
|
throw new BadRequestError136("Invalid site ID format.");
|
|
32705
32761
|
}
|
|
32762
|
+
const datePart = date ? new Date(date).toISOString().split("T")[0] : "";
|
|
32706
32763
|
const baseQuery = {
|
|
32707
32764
|
site,
|
|
32708
32765
|
status: status ? status : { $ne: "deleted" },
|
|
32709
32766
|
...type && { type },
|
|
32710
|
-
...
|
|
32767
|
+
...datePart && {
|
|
32711
32768
|
dateTime: {
|
|
32712
|
-
$gte: `${
|
|
32713
|
-
$
|
|
32769
|
+
$gte: /* @__PURE__ */ new Date(`${datePart}T00:00:00.000Z`),
|
|
32770
|
+
$lte: /* @__PURE__ */ new Date(`${datePart}T23:59:59.999Z`)
|
|
32714
32771
|
}
|
|
32715
32772
|
}
|
|
32716
32773
|
};
|
|
@@ -32723,7 +32780,7 @@ function useEventManagementRepo() {
|
|
|
32723
32780
|
page,
|
|
32724
32781
|
limit,
|
|
32725
32782
|
...type && { type },
|
|
32726
|
-
...
|
|
32783
|
+
...datePart && { dateTime: datePart }
|
|
32727
32784
|
};
|
|
32728
32785
|
if (search) {
|
|
32729
32786
|
query.$or = [{ title: { $regex: search, $options: "i" } }];
|