@openinc/parse-server-opendash 3.11.0 → 3.12.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.
|
@@ -6,6 +6,7 @@ const initMessages_1 = require("./messages/initMessages");
|
|
|
6
6
|
const initTicket_1 = require("./ticket/initTicket");
|
|
7
7
|
async function init() {
|
|
8
8
|
console.log("Initializing open.SERVICE feature...");
|
|
9
|
+
await (0, initKanbanStates_1.initKanbanStates)();
|
|
9
10
|
await (0, initMessages_1.initializeMessages)();
|
|
10
11
|
await (0, initKanbanStates_1.initCurrentTicketStates)();
|
|
11
12
|
await (0, initTicket_1.updateTicketDescription)();
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Initialize the kanban states table.
|
|
3
|
+
* Creates a inbox and finished state if they do not exist.
|
|
4
|
+
*/
|
|
5
|
+
export declare function initKanbanStates(): Promise<void>;
|
|
1
6
|
/**
|
|
2
7
|
* Initialize the current ticket states table. if a ticket has no entry in the current ticket states table, create one.
|
|
3
8
|
* If the ticket has no state, initialize it with the inbox state.
|
|
@@ -1,8 +1,68 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.initKanbanStates = initKanbanStates;
|
|
3
4
|
exports.initCurrentTicketStates = initCurrentTicketStates;
|
|
4
5
|
exports.initEnabledFlag = initEnabledFlag;
|
|
5
6
|
const types_1 = require("../../../types");
|
|
7
|
+
/**
|
|
8
|
+
* Initialize the kanban states table.
|
|
9
|
+
* Creates a inbox and finished state if they do not exist.
|
|
10
|
+
*/
|
|
11
|
+
async function initKanbanStates() {
|
|
12
|
+
const tenant = await new Parse.Query(types_1.Tenant)
|
|
13
|
+
.ascending("createdAt")
|
|
14
|
+
.first({ useMasterKey: true });
|
|
15
|
+
const inboxState = await new Parse.Query(types_1.Maintenance_Kanban_State)
|
|
16
|
+
.equalTo("isInbox", true)
|
|
17
|
+
.first({ useMasterKey: true });
|
|
18
|
+
const finishedState = await new Parse.Query(types_1.Maintenance_Kanban_State)
|
|
19
|
+
.equalTo("isFinished", true)
|
|
20
|
+
.first({ useMasterKey: true });
|
|
21
|
+
if (!inboxState) {
|
|
22
|
+
const newInboxState = new types_1.Maintenance_Kanban_State({
|
|
23
|
+
label: "Eingang",
|
|
24
|
+
isInbox: true,
|
|
25
|
+
color: "#f0f0f0",
|
|
26
|
+
order: 99,
|
|
27
|
+
enabled: true,
|
|
28
|
+
});
|
|
29
|
+
const acl = new Parse.ACL();
|
|
30
|
+
acl.setPublicReadAccess(false);
|
|
31
|
+
acl.setPublicWriteAccess(false);
|
|
32
|
+
acl.setRoleReadAccess("od-admin", true);
|
|
33
|
+
acl.setRoleWriteAccess("od-admin", true);
|
|
34
|
+
if (tenant) {
|
|
35
|
+
acl.setRoleReadAccess(`od-tenant-user-${tenant.id}`, true);
|
|
36
|
+
acl.setRoleWriteAccess(`od-tenant-user-${tenant.id}`, true);
|
|
37
|
+
acl.setRoleReadAccess(`od-tenant-admin-${tenant.id}`, true);
|
|
38
|
+
acl.setRoleWriteAccess(`od-tenant-admin-${tenant.id}`, true);
|
|
39
|
+
}
|
|
40
|
+
newInboxState.setACL(acl);
|
|
41
|
+
await newInboxState.save(null, { useMasterKey: true });
|
|
42
|
+
}
|
|
43
|
+
if (!finishedState) {
|
|
44
|
+
const newFinishedState = new types_1.Maintenance_Kanban_State({
|
|
45
|
+
label: "Ausgang",
|
|
46
|
+
isFinished: true,
|
|
47
|
+
color: "#d4edda",
|
|
48
|
+
order: 100,
|
|
49
|
+
enabled: true,
|
|
50
|
+
});
|
|
51
|
+
const acl = new Parse.ACL();
|
|
52
|
+
acl.setPublicReadAccess(false);
|
|
53
|
+
acl.setPublicWriteAccess(false);
|
|
54
|
+
acl.setRoleReadAccess("od-admin", true);
|
|
55
|
+
acl.setRoleWriteAccess("od-admin", true);
|
|
56
|
+
if (tenant) {
|
|
57
|
+
acl.setRoleReadAccess(`od-tenant-user-${tenant.id}`, true);
|
|
58
|
+
acl.setRoleWriteAccess(`od-tenant-user-${tenant.id}`, true);
|
|
59
|
+
acl.setRoleReadAccess(`od-tenant-admin-${tenant.id}`, true);
|
|
60
|
+
acl.setRoleWriteAccess(`od-tenant-admin-${tenant.id}`, true);
|
|
61
|
+
}
|
|
62
|
+
newFinishedState.setACL(acl);
|
|
63
|
+
await newFinishedState.save(null, { useMasterKey: true });
|
|
64
|
+
}
|
|
65
|
+
}
|
|
6
66
|
/**
|
|
7
67
|
* Initialize the current ticket states table. if a ticket has no entry in the current ticket states table, create one.
|
|
8
68
|
* If the ticket has no state, initialize it with the inbox state.
|