@openinc/parse-server-opendash 3.12.0 → 3.14.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.
@@ -1,12 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.init = init;
4
+ const initIssuecategory_1 = require("./issuecategory/initIssuecategory");
4
5
  const initKanbanStates_1 = require("./kanbanState/initKanbanStates");
5
6
  const initMessages_1 = require("./messages/initMessages");
6
7
  const initTicket_1 = require("./ticket/initTicket");
7
8
  async function init() {
8
9
  console.log("Initializing open.SERVICE feature...");
9
10
  await (0, initKanbanStates_1.initKanbanStates)();
11
+ await (0, initIssuecategory_1.initIssuecategory)();
10
12
  await (0, initMessages_1.initializeMessages)();
11
13
  await (0, initKanbanStates_1.initCurrentTicketStates)();
12
14
  await (0, initTicket_1.updateTicketDescription)();
@@ -0,0 +1 @@
1
+ export declare function initIssuecategory(): Promise<void>;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.initIssuecategory = initIssuecategory;
4
+ const types_1 = require("../../../types");
5
+ async function initIssuecategory() {
6
+ const tenant = await new Parse.Query(types_1.Tenant)
7
+ .ascending("createdAt")
8
+ .first({ useMasterKey: true });
9
+ const issueCategory = await new Parse.Query(types_1.Maintenance_Issuecategory)
10
+ .equalTo("catchall", true)
11
+ .first({ useMasterKey: true });
12
+ if (!issueCategory) {
13
+ const newIssueCategory = new types_1.Maintenance_Issuecategory({
14
+ name: "Allgemeiner Fehler",
15
+ catchall: true,
16
+ enabled: true,
17
+ issuecode: "0",
18
+ tenant: tenant,
19
+ });
20
+ const acl = new Parse.ACL();
21
+ acl.setPublicReadAccess(false);
22
+ acl.setPublicWriteAccess(false);
23
+ acl.setRoleReadAccess("od-admin", true);
24
+ acl.setRoleWriteAccess("od-admin", true);
25
+ if (tenant) {
26
+ acl.setRoleReadAccess(`od-tenant-user-${tenant.id}`, true);
27
+ acl.setRoleWriteAccess(`od-tenant-user-${tenant.id}`, true);
28
+ acl.setRoleReadAccess(`od-tenant-admin-${tenant.id}`, true);
29
+ acl.setRoleWriteAccess(`od-tenant-admin-${tenant.id}`, true);
30
+ }
31
+ newIssueCategory.setACL(acl);
32
+ await newIssueCategory.save(null, { useMasterKey: true });
33
+ }
34
+ }
@@ -1,6 +1,6 @@
1
1
  import { Maintenance_Ticket, Maintenance_Ticket_Material, Maintenance_Ticket_Source } from "../types";
2
2
  type FilterParams = {
3
- attribute: "objectId" | "state" | "issuecategory" | "user" | "role" | "userRole" | "createdUser" | "source" | "project";
3
+ attribute: "objectId" | "state" | "issuecategory" | "user" | "role" | "userRole" | "createdUser" | "source" | "project" | "title";
4
4
  /**
5
5
  * the objectId of the attribute to filter by
6
6
  */
@@ -328,6 +328,9 @@ const filterQueryMap = {
328
328
  query.include("project");
329
329
  query.equalTo("project", new types_1.Maintenance_Project({ objectId: value }));
330
330
  },
331
+ title: async (query, value) => {
332
+ query.matches("title", new RegExp(value, "i")); // case-insensitive match
333
+ },
331
334
  };
332
335
  /**
333
336
  * Creates a distinct array based on the getId function and can afterwards filter the array
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openinc/parse-server-opendash",
3
- "version": "3.12.0",
3
+ "version": "3.14.0",
4
4
  "description": "Parse Server Cloud Code for open.INC Stack.",
5
5
  "packageManager": "pnpm@10.13.1",
6
6
  "keywords": [