@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/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -3746,6 +3746,7 @@ declare enum BulletinRecipient {
|
|
|
3746
3746
|
}
|
|
3747
3747
|
declare enum BulletinStatus {
|
|
3748
3748
|
ACTIVE = "active",
|
|
3749
|
+
UPCOMING = "upcoming",
|
|
3749
3750
|
EXPIRED = "expired",
|
|
3750
3751
|
DELETED = "deleted"
|
|
3751
3752
|
}
|
|
@@ -3820,6 +3821,7 @@ declare function useBulletinBoardRepo(): {
|
|
|
3820
3821
|
getBulletinBoardById: (_id: string | ObjectId, session?: ClientSession) => Promise<mongodb.WithId<bson.Document> | TBulletinBoard>;
|
|
3821
3822
|
updateBulletinBoardById: (_id: ObjectId | string, value: Partial<TBulletinBoard>, session?: ClientSession) => Promise<mongodb.UpdateResult<bson.Document>>;
|
|
3822
3823
|
processExpiredBulletinBoards: (session?: ClientSession) => Promise<mongodb.UpdateResult<bson.Document>>;
|
|
3824
|
+
processUpcomingBulletinBoards: (session?: ClientSession) => Promise<mongodb.UpdateResult<bson.Document>>;
|
|
3823
3825
|
deleteBulletinBoardById: (_id: string | ObjectId, session?: ClientSession) => Promise<number>;
|
|
3824
3826
|
createIndexes: () => Promise<void>;
|
|
3825
3827
|
};
|
|
@@ -3828,6 +3830,7 @@ declare function useBulletinBoardService(): {
|
|
|
3828
3830
|
add: (value: TBulletinBoard) => Promise<string>;
|
|
3829
3831
|
updateBulletinBoardById: (id: string | ObjectId, value: Partial<TBulletinBoard>) => Promise<string>;
|
|
3830
3832
|
processExpiredBulletinBoards: () => Promise<void>;
|
|
3833
|
+
processUpcomingBulletinBoards: () => Promise<void>;
|
|
3831
3834
|
deleteBulletinBoardById: (id: string | ObjectId) => Promise<string>;
|
|
3832
3835
|
};
|
|
3833
3836
|
|
package/dist/index.js
CHANGED
|
@@ -30649,6 +30649,7 @@ var BulletinRecipient = /* @__PURE__ */ ((BulletinRecipient2) => {
|
|
|
30649
30649
|
})(BulletinRecipient || {});
|
|
30650
30650
|
var BulletinStatus = /* @__PURE__ */ ((BulletinStatus2) => {
|
|
30651
30651
|
BulletinStatus2["ACTIVE"] = "active";
|
|
30652
|
+
BulletinStatus2["UPCOMING"] = "upcoming";
|
|
30652
30653
|
BulletinStatus2["EXPIRED"] = "expired";
|
|
30653
30654
|
BulletinStatus2["DELETED"] = "deleted";
|
|
30654
30655
|
return BulletinStatus2;
|
|
@@ -30993,12 +30994,48 @@ function useBulletinBoardRepo() {
|
|
|
30993
30994
|
throw error;
|
|
30994
30995
|
}
|
|
30995
30996
|
}
|
|
30997
|
+
async function processUpcomingBulletinBoards(session) {
|
|
30998
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
30999
|
+
const query = {
|
|
31000
|
+
status: "upcoming" /* UPCOMING */,
|
|
31001
|
+
startDate: { $lte: now }
|
|
31002
|
+
};
|
|
31003
|
+
try {
|
|
31004
|
+
const res = await collection.updateMany(
|
|
31005
|
+
query,
|
|
31006
|
+
{
|
|
31007
|
+
$set: {
|
|
31008
|
+
status: "active" /* ACTIVE */,
|
|
31009
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
31010
|
+
}
|
|
31011
|
+
},
|
|
31012
|
+
{ session }
|
|
31013
|
+
);
|
|
31014
|
+
if (res.matchedCount === 0) {
|
|
31015
|
+
throw new import_node_server_utils135.NotFoundError("No upcoming bulletin boards found to activate.");
|
|
31016
|
+
}
|
|
31017
|
+
delNamespace().then(() => {
|
|
31018
|
+
import_node_server_utils135.logger.info(
|
|
31019
|
+
`Cache cleared for namespace: ${bulletin_boards_namespace_collection}`
|
|
31020
|
+
);
|
|
31021
|
+
}).catch((err) => {
|
|
31022
|
+
import_node_server_utils135.logger.error(
|
|
31023
|
+
`Failed to clear cache for namespace: ${bulletin_boards_namespace_collection}`,
|
|
31024
|
+
err
|
|
31025
|
+
);
|
|
31026
|
+
});
|
|
31027
|
+
return res;
|
|
31028
|
+
} catch (error) {
|
|
31029
|
+
throw error;
|
|
31030
|
+
}
|
|
31031
|
+
}
|
|
30996
31032
|
return {
|
|
30997
31033
|
add,
|
|
30998
31034
|
getAll,
|
|
30999
31035
|
getBulletinBoardById,
|
|
31000
31036
|
updateBulletinBoardById,
|
|
31001
31037
|
processExpiredBulletinBoards,
|
|
31038
|
+
processUpcomingBulletinBoards,
|
|
31002
31039
|
deleteBulletinBoardById,
|
|
31003
31040
|
createIndexes
|
|
31004
31041
|
};
|
|
@@ -31011,6 +31048,7 @@ function useBulletinBoardService() {
|
|
|
31011
31048
|
add: _add,
|
|
31012
31049
|
updateBulletinBoardById: _updateBulletinBoardById,
|
|
31013
31050
|
processExpiredBulletinBoards: _processExpiredBulletinBoards,
|
|
31051
|
+
processUpcomingBulletinBoards: _processUpcomingBulletinBoards,
|
|
31014
31052
|
deleteBulletinBoardById: _deleteBulletinBoardById,
|
|
31015
31053
|
getBulletinBoardById: _getBulletinBoardById
|
|
31016
31054
|
} = useBulletinBoardRepo();
|
|
@@ -31018,6 +31056,9 @@ function useBulletinBoardService() {
|
|
|
31018
31056
|
async function add(value) {
|
|
31019
31057
|
const session = import_node_server_utils136.useAtlas.getClient()?.startSession();
|
|
31020
31058
|
session?.startTransaction();
|
|
31059
|
+
if (value.startDate && new Date(value.startDate) > /* @__PURE__ */ new Date()) {
|
|
31060
|
+
value.status = "upcoming" /* UPCOMING */;
|
|
31061
|
+
}
|
|
31021
31062
|
try {
|
|
31022
31063
|
await _add(value, session);
|
|
31023
31064
|
await session?.commitTransaction();
|
|
@@ -31043,6 +31084,20 @@ function useBulletinBoardService() {
|
|
|
31043
31084
|
session?.endSession();
|
|
31044
31085
|
}
|
|
31045
31086
|
}
|
|
31087
|
+
async function processUpcomingBulletinBoards() {
|
|
31088
|
+
const session = import_node_server_utils136.useAtlas.getClient()?.startSession();
|
|
31089
|
+
session?.startTransaction();
|
|
31090
|
+
try {
|
|
31091
|
+
await _processUpcomingBulletinBoards(session);
|
|
31092
|
+
await session?.commitTransaction();
|
|
31093
|
+
return;
|
|
31094
|
+
} catch (error) {
|
|
31095
|
+
await session?.abortTransaction();
|
|
31096
|
+
throw error;
|
|
31097
|
+
} finally {
|
|
31098
|
+
session?.endSession();
|
|
31099
|
+
}
|
|
31100
|
+
}
|
|
31046
31101
|
async function processExpiredBulletinBoards() {
|
|
31047
31102
|
const session = import_node_server_utils136.useAtlas.getClient()?.startSession();
|
|
31048
31103
|
session?.startTransaction();
|
|
@@ -31084,6 +31139,7 @@ function useBulletinBoardService() {
|
|
|
31084
31139
|
add,
|
|
31085
31140
|
updateBulletinBoardById,
|
|
31086
31141
|
processExpiredBulletinBoards,
|
|
31142
|
+
processUpcomingBulletinBoards,
|
|
31087
31143
|
deleteBulletinBoardById
|
|
31088
31144
|
};
|
|
31089
31145
|
}
|
|
@@ -32676,14 +32732,15 @@ function useEventManagementRepo() {
|
|
|
32676
32732
|
} catch (error) {
|
|
32677
32733
|
throw new import_node_server_utils146.BadRequestError("Invalid site ID format.");
|
|
32678
32734
|
}
|
|
32735
|
+
const datePart = date ? new Date(date).toISOString().split("T")[0] : "";
|
|
32679
32736
|
const baseQuery = {
|
|
32680
32737
|
site,
|
|
32681
32738
|
status: status ? status : { $ne: "deleted" },
|
|
32682
32739
|
...type && { type },
|
|
32683
|
-
...
|
|
32740
|
+
...datePart && {
|
|
32684
32741
|
dateTime: {
|
|
32685
|
-
$gte: `${
|
|
32686
|
-
$
|
|
32742
|
+
$gte: /* @__PURE__ */ new Date(`${datePart}T00:00:00.000Z`),
|
|
32743
|
+
$lte: /* @__PURE__ */ new Date(`${datePart}T23:59:59.999Z`)
|
|
32687
32744
|
}
|
|
32688
32745
|
}
|
|
32689
32746
|
};
|
|
@@ -32696,7 +32753,7 @@ function useEventManagementRepo() {
|
|
|
32696
32753
|
page,
|
|
32697
32754
|
limit,
|
|
32698
32755
|
...type && { type },
|
|
32699
|
-
...
|
|
32756
|
+
...datePart && { dateTime: datePart }
|
|
32700
32757
|
};
|
|
32701
32758
|
if (search) {
|
|
32702
32759
|
query.$or = [{ title: { $regex: search, $options: "i" } }];
|