@openinc/parse-server-opendash 3.35.3 → 3.35.5

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.
@@ -76,6 +76,9 @@ async function init(name) {
76
76
  user.set("microsoftId", verifiedPayload.oid);
77
77
  user.set("name", verifiedPayload.name || verifiedPayload.preferred_username);
78
78
  user.set("tenant", defaultTenant);
79
+ user.set("username", verifiedPayload.name ??
80
+ verifiedPayload.preferred_username ??
81
+ account.username);
79
82
  user = await user.signUp(null, { useMasterKey: true });
80
83
  return user.getSessionToken();
81
84
  }
@@ -16,8 +16,23 @@ async function init() {
16
16
  });
17
17
  (0, schema_1.afterSaveHook)(types_1.Maintenance_Schedule_Execution, async (request) => {
18
18
  const { object, original, user } = request;
19
- //If this is an update, do nothing
20
19
  if (original !== undefined) {
20
+ // If this is an update and the status has changed to completed, update all related messages displayAt to finishedAt
21
+ if (object.get("status") === "completed" &&
22
+ original.get("status") !== "completed") {
23
+ // 1. Find all messages related to this schedule execution
24
+ const messages = await new Parse.Query(types_1.Maintenance_Message)
25
+ // @ts-ignore
26
+ .equalTo("data.origin.id", object.id)
27
+ // @ts-ignore
28
+ .equalTo("data.origin.classname", object.className)
29
+ .find({ useMasterKey: true });
30
+ // 2. Update displayAt to finishedAt for all messages
31
+ await Promise.all(messages.map((message) => {
32
+ message.set("displayAt", object.get("finishedAt") ?? object.get("createdAt"));
33
+ return message.save(null, { useMasterKey: true });
34
+ }));
35
+ }
21
36
  return;
22
37
  }
23
38
  // save schedule message to source
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openinc/parse-server-opendash",
3
- "version": "3.35.3",
3
+ "version": "3.35.5",
4
4
  "description": "Parse Server Cloud Code for open.INC Stack.",
5
5
  "packageManager": "pnpm@10.28.0",
6
6
  "keywords": [