@openinc/parse-server-opendash 3.15.0 → 3.16.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.
@@ -4,6 +4,7 @@ exports.init = init;
4
4
  const initIssuecategory_1 = require("./issuecategory/initIssuecategory");
5
5
  const initKanbanStates_1 = require("./kanbanState/initKanbanStates");
6
6
  const initMessages_1 = require("./messages/initMessages");
7
+ const reassignScheduleExecutions_1 = require("./schedules/mappings/reassignScheduleExecutions");
7
8
  const initTicket_1 = require("./ticket/initTicket");
8
9
  async function init() {
9
10
  console.log("Initializing open.SERVICE feature...");
@@ -15,5 +16,6 @@ async function init() {
15
16
  await (0, initKanbanStates_1.initEnabledFlag)();
16
17
  // await initScheduling();
17
18
  await (0, initTicket_1.initTicketClass)();
19
+ await (0, reassignScheduleExecutions_1.reassignScheduleExecutions)();
18
20
  console.log("open.SERVICE feature initialized.");
19
21
  }
@@ -0,0 +1 @@
1
+ export declare function reassignScheduleExecutions(): Promise<void>;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.reassignScheduleExecutions = reassignScheduleExecutions;
4
+ const types_1 = require("../../../../types");
5
+ async function reassignScheduleExecutions() {
6
+ const executions = await new Parse.Query(types_1.Maintenance_Schedule_Execution)
7
+ .includeAll()
8
+ .limit(100000000)
9
+ .find({ useMasterKey: true });
10
+ for (const execution of executions) {
11
+ // Get the full execution object
12
+ const schedule = execution.get("schedule");
13
+ if (!schedule && execution.get("origin") && execution.get("source")) {
14
+ const matchingSchedule = await new Parse.Query(types_1.Maintenance_Schedule)
15
+ .equalTo("template", execution.get("origin"))
16
+ .equalTo("source", execution.get("source"))
17
+ .first({ useMasterKey: true });
18
+ if (matchingSchedule) {
19
+ await execution.save({ schedule: matchingSchedule }, { useMasterKey: true });
20
+ console.log(`Updated execution ${execution.id} with schedule ${matchingSchedule.id}`);
21
+ }
22
+ }
23
+ if (schedule && (!execution.get("origin") || !execution.get("source"))) {
24
+ await execution.save({
25
+ origin: schedule.get("template"),
26
+ source: schedule.get("source"),
27
+ }, { useMasterKey: true });
28
+ console.log(`Updated execution ${execution.id} with origin/source from schedule`);
29
+ }
30
+ }
31
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openinc/parse-server-opendash",
3
- "version": "3.15.0",
3
+ "version": "3.16.0",
4
4
  "description": "Parse Server Cloud Code for open.INC Stack.",
5
5
  "packageManager": "pnpm@10.15.0",
6
6
  "keywords": [