@resolveio/server-lib 1.0.11-nr → 1.0.12
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/collections/notification.collection.d.ts +7 -0
- package/collections/notification.collection.js +43 -0
- package/collections/support-ticket.collection.js +30 -24
- package/collections/user.collection.d.ts +1 -0
- package/collections/user.collection.js +1 -0
- package/fixtures/cron-jobs.js +23 -5
- package/managers/method.manager.js +2 -0
- package/models/support-ticket.model.d.ts +16 -11
- package/models/user.model.d.ts +6 -22
- package/package.json +1 -1
- package/private/email-templates/support-ticket-deleted.html +50 -0
- package/private/email-templates/support-ticket-modified.html +77 -0
- package/private/email-templates/support-ticket.html +77 -0
- package/publications/support-tickets.js +83 -0
- package/support-methods/cron-jobs.d.ts +2 -0
- package/support-methods/cron-jobs.js +92 -0
- package/support-methods/support.js +260 -4
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Model, Document } from 'mongoose';
|
|
2
|
+
import { NotificationModel } from '../models/notification.model';
|
|
3
|
+
interface ResolveIOModel extends NotificationModel, Document {
|
|
4
|
+
}
|
|
5
|
+
export declare const Notifications: Model<ResolveIOModel>;
|
|
6
|
+
export declare const NotificationVersions: Model<ResolveIOModel>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var mongoose_1 = require("mongoose");
|
|
4
|
+
var simpl_schema_1 = require("simpl-schema");
|
|
5
|
+
var index_1 = require("../index");
|
|
6
|
+
var schema = {
|
|
7
|
+
_id: {
|
|
8
|
+
type: String,
|
|
9
|
+
optional: true
|
|
10
|
+
},
|
|
11
|
+
__v: {
|
|
12
|
+
type: Number,
|
|
13
|
+
optional: true
|
|
14
|
+
},
|
|
15
|
+
updatedAt: {
|
|
16
|
+
type: Date,
|
|
17
|
+
optional: true
|
|
18
|
+
},
|
|
19
|
+
createdAt: {
|
|
20
|
+
type: Date,
|
|
21
|
+
optional: true
|
|
22
|
+
},
|
|
23
|
+
name: {
|
|
24
|
+
type: String
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
var DefaultSchema = new mongoose_1.Schema(schema, {
|
|
28
|
+
skipVersioning: true,
|
|
29
|
+
versionKey: false,
|
|
30
|
+
timestamps: true
|
|
31
|
+
});
|
|
32
|
+
exports.Notifications = index_1.ResolveIOServer.getMainDB().model('notifications', DefaultSchema);
|
|
33
|
+
exports.Notifications['simplschema'] = new simpl_schema_1.default(schema);
|
|
34
|
+
schema._id = {
|
|
35
|
+
type: mongoose_1.Schema.Types.Mixed
|
|
36
|
+
};
|
|
37
|
+
var VersionSchema = new mongoose_1.Schema(schema, {
|
|
38
|
+
skipVersioning: true,
|
|
39
|
+
versionKey: false,
|
|
40
|
+
timestamps: true
|
|
41
|
+
});
|
|
42
|
+
exports.Notifications['versionCollection'] = 'notifications.versions';
|
|
43
|
+
exports.NotificationVersions = index_1.ResolveIOServer.getMainDB().model(exports.Notifications['versionCollection'], VersionSchema);
|
|
@@ -38,6 +38,9 @@ var schema = {
|
|
|
38
38
|
status: {
|
|
39
39
|
type: String
|
|
40
40
|
},
|
|
41
|
+
substatus: {
|
|
42
|
+
type: String
|
|
43
|
+
},
|
|
41
44
|
client: {
|
|
42
45
|
type: String
|
|
43
46
|
},
|
|
@@ -80,43 +83,46 @@ var schema = {
|
|
|
80
83
|
billable: {
|
|
81
84
|
type: Boolean
|
|
82
85
|
},
|
|
83
|
-
|
|
86
|
+
date_investigation: {
|
|
87
|
+
type: Date,
|
|
88
|
+
optional: true,
|
|
89
|
+
},
|
|
90
|
+
date_closed: {
|
|
91
|
+
type: Date,
|
|
92
|
+
optional: true,
|
|
93
|
+
},
|
|
94
|
+
files: {
|
|
95
|
+
type: Array
|
|
96
|
+
},
|
|
97
|
+
'files.$': {
|
|
98
|
+
type: String
|
|
99
|
+
},
|
|
100
|
+
current_watchers: {
|
|
84
101
|
type: Array
|
|
85
102
|
},
|
|
86
|
-
'
|
|
103
|
+
'current_watchers.$': {
|
|
87
104
|
type: Object
|
|
88
105
|
},
|
|
89
|
-
'
|
|
106
|
+
'current_watchers.$.user': {
|
|
90
107
|
type: String
|
|
91
108
|
},
|
|
92
|
-
'
|
|
109
|
+
'current_watchers.$.id_user': {
|
|
93
110
|
type: String
|
|
94
111
|
},
|
|
95
|
-
'
|
|
112
|
+
'current_watchers.$.email': {
|
|
96
113
|
type: String
|
|
97
114
|
},
|
|
98
|
-
|
|
99
|
-
type:
|
|
100
|
-
},
|
|
101
|
-
'work_logs.$.date_end': {
|
|
102
|
-
type: Date,
|
|
103
|
-
optional: true
|
|
104
|
-
},
|
|
105
|
-
'work_logs.$.time_spent': {
|
|
106
|
-
type: Number,
|
|
107
|
-
optional: true
|
|
115
|
+
client_user: {
|
|
116
|
+
type: Object
|
|
108
117
|
},
|
|
109
|
-
'
|
|
110
|
-
type: String
|
|
111
|
-
optional: true
|
|
118
|
+
'client_user.id_user': {
|
|
119
|
+
type: String
|
|
112
120
|
},
|
|
113
|
-
|
|
114
|
-
type:
|
|
115
|
-
optional: true,
|
|
121
|
+
'client_user.user': {
|
|
122
|
+
type: String
|
|
116
123
|
},
|
|
117
|
-
|
|
118
|
-
type:
|
|
119
|
-
optional: true,
|
|
124
|
+
'client_user.email': {
|
|
125
|
+
type: String
|
|
120
126
|
}
|
|
121
127
|
};
|
|
122
128
|
var DefaultSchema = new mongoose_1.Schema(schema, {
|
|
@@ -4,5 +4,6 @@ import { UserModel } from '../models/user.model';
|
|
|
4
4
|
interface ResolveIOModel extends UserModel, PassportLocalDocument {
|
|
5
5
|
}
|
|
6
6
|
export declare const Users: PassportLocalModel<ResolveIOModel>;
|
|
7
|
+
export declare const ClientUsers: PassportLocalModel<ResolveIOModel>;
|
|
7
8
|
export declare const UserVersions: Model<ResolveIOModel>;
|
|
8
9
|
export {};
|
|
@@ -136,6 +136,7 @@ DefaultSchema.plugin(passportLocalMongoose, {
|
|
|
136
136
|
}
|
|
137
137
|
});
|
|
138
138
|
exports.Users = index_1.ResolveIOServer.getMainDB().model('users', DefaultSchema);
|
|
139
|
+
exports.ClientUsers = index_1.ResolveIOServer.getSupportDB().model('users', DefaultSchema);
|
|
139
140
|
exports.Users['simplschema'] = new simpl_schema_1.default(schema);
|
|
140
141
|
schema._id = {
|
|
141
142
|
type: mongoose_1.Schema.Types.Mixed
|
package/fixtures/cron-jobs.js
CHANGED
|
@@ -50,17 +50,35 @@ function loadServerCronJobs() {
|
|
|
50
50
|
_id: mongoose_1.Types.ObjectId().toHexString(),
|
|
51
51
|
__v: 0,
|
|
52
52
|
name: 'Method Queue',
|
|
53
|
+
"repeat": true,
|
|
53
54
|
reoccuring: true,
|
|
54
|
-
time_to_run:
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
next_run: new Date,
|
|
58
|
-
running: false
|
|
55
|
+
"time_to_run": "*/5 * * * * *",
|
|
56
|
+
"method_run": "methodQueue",
|
|
57
|
+
"method_run_data": null,
|
|
58
|
+
"next_run": new Date(),
|
|
59
|
+
"running": false
|
|
59
60
|
})];
|
|
60
61
|
case 2:
|
|
61
62
|
_a.sent();
|
|
62
63
|
_a.label = 3;
|
|
63
64
|
case 3:
|
|
65
|
+
if (!!cronJobs.filter(function (a) { return a.name === 'Update Client Users'; }).length) return [3 /*break*/, 5];
|
|
66
|
+
return [4 /*yield*/, cron_job_collection_1.CronJobs.create({
|
|
67
|
+
_id: mongoose_1.Types.ObjectId().toHexString(),
|
|
68
|
+
__v: 0,
|
|
69
|
+
name: 'Update Client Users',
|
|
70
|
+
"repeat": true,
|
|
71
|
+
reoccuring: true,
|
|
72
|
+
"time_to_run": "0 */1 * * *",
|
|
73
|
+
"method_run": "updateClientUsers",
|
|
74
|
+
"method_run_data": null,
|
|
75
|
+
"next_run": new Date(),
|
|
76
|
+
"running": false
|
|
77
|
+
})];
|
|
78
|
+
case 4:
|
|
79
|
+
_a.sent();
|
|
80
|
+
_a.label = 5;
|
|
81
|
+
case 5:
|
|
64
82
|
cronJobs.filter(function (a) { return a.running && a.next_run && a.next_run.getTime() < (new Date()).getTime(); }).forEach(function (cronJob) {
|
|
65
83
|
cron_job_collection_1.CronJobs.updateOne({ _id: cronJob._id }, { $set: { running: false } }).exec();
|
|
66
84
|
});
|
|
@@ -19,6 +19,7 @@ var method_response_collection_1 = require("../collections/method-response.colle
|
|
|
19
19
|
var mongoose_1 = require("mongoose");
|
|
20
20
|
var common_1 = require("../util/common");
|
|
21
21
|
var log_collection_1 = require("../collections/log.collection");
|
|
22
|
+
var cron_jobs_3 = require("../support-methods/cron-jobs");
|
|
22
23
|
var MethodManager = /** @class */ (function () {
|
|
23
24
|
function MethodManager(mainServer, serverConfig, clientDir) {
|
|
24
25
|
var _this = this;
|
|
@@ -41,6 +42,7 @@ var MethodManager = /** @class */ (function () {
|
|
|
41
42
|
pdf_1.loadPDFMethods(this);
|
|
42
43
|
cron_jobs_2.loadCronJobMethods(this);
|
|
43
44
|
flags_1.loadFlagMethods(this);
|
|
45
|
+
cron_jobs_3.loadSupportCronJobMethods(this);
|
|
44
46
|
this._mailer = nodemailer.createTransport({
|
|
45
47
|
SES: new aws.SES({
|
|
46
48
|
apiVersion: '2010-12-01',
|
|
@@ -6,6 +6,7 @@ export interface SupportTicketModel extends CollectionDocument {
|
|
|
6
6
|
support_ticket_number: number;
|
|
7
7
|
support_ticket_number_string: string;
|
|
8
8
|
status: SupportTicketStatus;
|
|
9
|
+
substatus: SupportTicketSubstatus;
|
|
9
10
|
client: string;
|
|
10
11
|
id_client: string;
|
|
11
12
|
messages: SupportTicketMessageModel[];
|
|
@@ -14,11 +15,19 @@ export interface SupportTicketModel extends CollectionDocument {
|
|
|
14
15
|
id_user_created: string;
|
|
15
16
|
user_created: string;
|
|
16
17
|
billable: boolean;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
date_investigation?: Date;
|
|
19
|
+
date_closed?: Date;
|
|
20
|
+
files: string[];
|
|
21
|
+
current_watchers: SupportTicketWatchersModel[];
|
|
22
|
+
client_user: SupportTicketClientUserModel;
|
|
20
23
|
}
|
|
21
|
-
|
|
24
|
+
export interface SupportTicketClientUserModel {
|
|
25
|
+
id_user: string;
|
|
26
|
+
user: string;
|
|
27
|
+
email: string;
|
|
28
|
+
}
|
|
29
|
+
declare type SupportTicketStatus = 'Opened' | 'Resolved';
|
|
30
|
+
export declare type SupportTicketSubstatus = 'New' | 'Work-In-Progress' | 'Idle' | 'Awaiting Customer Interaction';
|
|
22
31
|
export interface SupportTicketMessageModel {
|
|
23
32
|
message: string;
|
|
24
33
|
id_user: string;
|
|
@@ -27,13 +36,9 @@ export interface SupportTicketMessageModel {
|
|
|
27
36
|
type: SupportTicketMessageType;
|
|
28
37
|
}
|
|
29
38
|
declare type SupportTicketMessageType = 'ResolveIO' | 'Client';
|
|
30
|
-
export interface
|
|
31
|
-
note: string;
|
|
32
|
-
id_user: string;
|
|
39
|
+
export interface SupportTicketWatchersModel {
|
|
33
40
|
user: string;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
time_spent?: number;
|
|
37
|
-
time_spent_string?: string;
|
|
41
|
+
id_user: string;
|
|
42
|
+
email: string;
|
|
38
43
|
}
|
|
39
44
|
export {};
|
package/models/user.model.d.ts
CHANGED
|
@@ -1,30 +1,14 @@
|
|
|
1
1
|
import { CollectionDocument } from './collection-document.model';
|
|
2
2
|
export interface UserModel extends CollectionDocument {
|
|
3
|
+
attempts: number;
|
|
4
|
+
last: Date;
|
|
5
|
+
services?: any;
|
|
3
6
|
fullname: string;
|
|
4
|
-
roles: UserRoleModel;
|
|
5
7
|
username?: string;
|
|
6
8
|
email?: string;
|
|
9
|
+
roles?: string[];
|
|
7
10
|
active?: boolean;
|
|
8
|
-
|
|
9
|
-
id_customer?: string;
|
|
10
|
-
customer?: string;
|
|
11
|
-
customer_type?: string;
|
|
11
|
+
readonly?: boolean;
|
|
12
12
|
phonenumber?: string;
|
|
13
|
-
|
|
14
|
-
export interface UserRoleModel {
|
|
15
|
-
super_admin: boolean;
|
|
16
|
-
approvals: UserRoleApprovalModel[];
|
|
17
|
-
groups: UserRoleGroupModel[];
|
|
18
|
-
notifications: string[];
|
|
19
|
-
miscs: string[];
|
|
20
|
-
}
|
|
21
|
-
export interface UserRoleApprovalModel {
|
|
22
|
-
accounting_code: string;
|
|
23
|
-
type: string;
|
|
24
|
-
name: string;
|
|
25
|
-
}
|
|
26
|
-
export interface UserRoleGroupModel {
|
|
27
|
-
name: string;
|
|
28
|
-
views: string[];
|
|
29
|
-
yard?: string;
|
|
13
|
+
other?: object;
|
|
30
14
|
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<style type="text/css">
|
|
2
|
+
* {
|
|
3
|
+
font-size: 14px;
|
|
4
|
+
font-family: Arial;
|
|
5
|
+
background-color: white;
|
|
6
|
+
}
|
|
7
|
+
.header {
|
|
8
|
+
font-weight: bold;
|
|
9
|
+
min-width: 20px;
|
|
10
|
+
}
|
|
11
|
+
.td {
|
|
12
|
+
border: 1px solid black;
|
|
13
|
+
}
|
|
14
|
+
.tr {
|
|
15
|
+
border: 1px solid gray;
|
|
16
|
+
}
|
|
17
|
+
.tg {border-collapse:collapse;border-spacing:0;border-color:#999;}
|
|
18
|
+
.tg td{font-family:Arial, sans-serif;font-size:14px;padding:10px 5px;border-style:solid;border-width:0px;overflow:hidden;word-break:normal;border-color:#999;color:#444;background-color:#F7FDFA;border-top-width:1px;border-bottom-width:1px;}
|
|
19
|
+
.tg th{font-family:Arial, sans-serif;font-size:14px;font-weight:normal;padding:10px 5px;border-style:solid;border-width:0px;overflow:hidden;word-break:normal;border-color:#999;color:#fff;background-color:rgb(0, 183, 255);border-top-width:1px;border-bottom-width:1px;}
|
|
20
|
+
.tg .tg-baqh{text-align:left;vertical-align:top}
|
|
21
|
+
.tg .tg-yw4l{vertical-align:top;}
|
|
22
|
+
</style>
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
Good Day,<br><br>
|
|
27
|
+
|
|
28
|
+
A support ticket: (#{{support_ticket_number_string}}) has been deleted.
|
|
29
|
+
|
|
30
|
+
<br><br>
|
|
31
|
+
<div id="containter">
|
|
32
|
+
<table class="tg">
|
|
33
|
+
<thead>
|
|
34
|
+
<tr>
|
|
35
|
+
<th class="tg-yw4l" style="padding: 0; margin: 0; border-left: 1px solid #999;">
|
|
36
|
+
<img src="{{logo}}" style="width: auto; height: 90px; background-color: white; margin-left: -10px; margin-bottom: -10px;" alt="Logo">
|
|
37
|
+
</th>
|
|
38
|
+
<th class="tg-yw4l" style="min-width: 1050px; max-width: 1050px; font-size: 20px; color: white; text-align: right; padding: 30px;">Support Ticket</th>
|
|
39
|
+
</tr>
|
|
40
|
+
</thead>
|
|
41
|
+
<tbody>
|
|
42
|
+
</tbody>
|
|
43
|
+
</table>
|
|
44
|
+
</div>
|
|
45
|
+
<br><br><br>
|
|
46
|
+
|
|
47
|
+
ResolveIO, LLC<br>
|
|
48
|
+
Dustin Poole<br>
|
|
49
|
+
<a href="mailTo:ar@resolveio.com">ar@resolveio.com</a><br>
|
|
50
|
+
432-661-6150<br><br>
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<style type="text/css">
|
|
2
|
+
* {
|
|
3
|
+
font-size: 14px;
|
|
4
|
+
font-family: Arial;
|
|
5
|
+
background-color: white;
|
|
6
|
+
}
|
|
7
|
+
.header {
|
|
8
|
+
font-weight: bold;
|
|
9
|
+
min-width: 20px;
|
|
10
|
+
}
|
|
11
|
+
.td {
|
|
12
|
+
border: 1px solid black;
|
|
13
|
+
}
|
|
14
|
+
.tr {
|
|
15
|
+
border: 1px solid gray;
|
|
16
|
+
}
|
|
17
|
+
.tg {border-collapse:collapse;border-spacing:0;border-color:#999;}
|
|
18
|
+
.tg td{font-family:Arial, sans-serif;font-size:14px;padding:10px 5px;border-style:solid;border-width:0px;overflow:hidden;word-break:normal;border-color:#999;color:#444;background-color:#F7FDFA;border-top-width:1px;border-bottom-width:1px;}
|
|
19
|
+
.tg th{font-family:Arial, sans-serif;font-size:14px;font-weight:normal;padding:10px 5px;border-style:solid;border-width:0px;overflow:hidden;word-break:normal;border-color:#999;color:#fff;background-color:rgb(0, 183, 255);border-top-width:1px;border-bottom-width:1px;}
|
|
20
|
+
.tg .tg-baqh{text-align:left;vertical-align:top}
|
|
21
|
+
.tg .tg-yw4l{vertical-align:top;}
|
|
22
|
+
</style>
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
Good Day,<br><br>
|
|
27
|
+
|
|
28
|
+
A new support ticket: (#{{support_ticket_number_string}}), has been modified by {{user_created}}.
|
|
29
|
+
<br><br>
|
|
30
|
+
<div id="containter">
|
|
31
|
+
<table class="tg">
|
|
32
|
+
<thead>
|
|
33
|
+
<tr>
|
|
34
|
+
<th class="tg-yw4l" style="padding: 0; margin: 0; border-left: 1px solid #999;">
|
|
35
|
+
<img src="{{logo}}" style="width: auto; height: 90px; background-color: white; margin-left: -10px; margin-bottom: -10px;" alt="Logo">
|
|
36
|
+
</th>
|
|
37
|
+
<th class="tg-yw4l" style="min-width: 1050px; max-width: 1050px; font-size: 20px; color: white; text-align: right; padding: 30px;">Support Ticket</th>
|
|
38
|
+
</tr>
|
|
39
|
+
</thead>
|
|
40
|
+
<tbody>
|
|
41
|
+
<tr>
|
|
42
|
+
<td class="tg-baqh" style="min-width: 30%; max-width: 30%; font-weight: bold;">Support Ticket <br>Number</td>
|
|
43
|
+
<td class="tg-baqh" style="min-width: 60%; max-width: 60%;">{{support_ticket_number_string}}</td>
|
|
44
|
+
</tr>
|
|
45
|
+
<tr>
|
|
46
|
+
<td class="tg-baqh" style="min-width: 30%; max-width: 30%; font-weight: bold;">Type</td>
|
|
47
|
+
<td class="tg-baqh" style="min-width: 60%; max-width: 60%;">{{type}}</td>
|
|
48
|
+
</tr>
|
|
49
|
+
<tr>
|
|
50
|
+
<td class="tg-baqh" style="min-width: 30%; max-width: 30%; font-weight: bold;">Issue <br>Description</td>
|
|
51
|
+
<td class="tg-baqh" style="min-width: 60%; max-width: 60%;">{{issue}}</td>
|
|
52
|
+
</tr>
|
|
53
|
+
<tr>
|
|
54
|
+
<td class="tg-baqh" style="min-width: 30%; max-width: 30%; font-weight: bold;">Priority</td>
|
|
55
|
+
<td class="tg-baqh" style="min-width: 60%; max-width: 60%;">{{priority}}</td>
|
|
56
|
+
</tr>
|
|
57
|
+
<tr>
|
|
58
|
+
<td class="tg-baqh" style="min-width: 30%; max-width: 30%; font-weight: bold;">Status</td>
|
|
59
|
+
<td class="tg-baqh" style="min-width: 60%; max-width: 60%;">{{status}}</td>
|
|
60
|
+
</tr>
|
|
61
|
+
<tr>
|
|
62
|
+
<td class="tg-baqh" style="min-width: 30%; max-width: 30%; font-weight: bold;">Substatus</td>
|
|
63
|
+
<td class="tg-baqh" style="min-width: 60%; max-width: 60%;">{{substatus}}</td>
|
|
64
|
+
</tr>
|
|
65
|
+
<tr>
|
|
66
|
+
<td class="tg-baqh" style="min-width: 30%; max-width: 30%; font-weight: bold;">Date created</td>
|
|
67
|
+
<td class="tg-baqh" style="min-width: 60%; max-width: 60%;">{{date_created_string}}</td>
|
|
68
|
+
</tr>
|
|
69
|
+
</tbody>
|
|
70
|
+
</table>
|
|
71
|
+
</div>
|
|
72
|
+
<br><br><br>
|
|
73
|
+
|
|
74
|
+
ResolveIO, LLC<br>
|
|
75
|
+
Dustin Poole<br>
|
|
76
|
+
<a href="mailTo:ar@resolveio.com">ar@resolveio.com</a><br>
|
|
77
|
+
432-661-6150<br><br>
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<style type="text/css">
|
|
2
|
+
* {
|
|
3
|
+
font-size: 14px;
|
|
4
|
+
font-family: Arial;
|
|
5
|
+
background-color: white;
|
|
6
|
+
}
|
|
7
|
+
.header {
|
|
8
|
+
font-weight: bold;
|
|
9
|
+
min-width: 20px;
|
|
10
|
+
}
|
|
11
|
+
.td {
|
|
12
|
+
border: 1px solid black;
|
|
13
|
+
}
|
|
14
|
+
.tr {
|
|
15
|
+
border: 1px solid gray;
|
|
16
|
+
}
|
|
17
|
+
.tg {border-collapse:collapse;border-spacing:0;border-color:#999;}
|
|
18
|
+
.tg td{font-family:Arial, sans-serif;font-size:14px;padding:10px 5px;border-style:solid;border-width:0px;overflow:hidden;word-break:normal;border-color:#999;color:#444;background-color:#F7FDFA;border-top-width:1px;border-bottom-width:1px;}
|
|
19
|
+
.tg th{font-family:Arial, sans-serif;font-size:14px;font-weight:normal;padding:10px 5px;border-style:solid;border-width:0px;overflow:hidden;word-break:normal;border-color:#999;color:#fff;background-color:rgb(0, 137, 250);border-top-width:1px;border-bottom-width:1px;}
|
|
20
|
+
.tg .tg-baqh{text-align:left;vertical-align:top}
|
|
21
|
+
.tg .tg-yw4l{vertical-align:top;}
|
|
22
|
+
</style>
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
Good Day,<br><br>
|
|
27
|
+
|
|
28
|
+
A new support ticket: (#{{support_ticket_number_string}}), has been created by {{user_created}}.
|
|
29
|
+
<br><br>
|
|
30
|
+
<div id="containter">
|
|
31
|
+
<table class="tg">
|
|
32
|
+
<thead>
|
|
33
|
+
<tr>
|
|
34
|
+
<th class="tg-yw4l" style="padding: 0; margin: 0; border-left: 1px solid #999;">
|
|
35
|
+
<img src="{{logo}}" style="width: auto; height: 90px; background-color: white; margin-left: -10px; margin-bottom: -10px;" alt="Logo">
|
|
36
|
+
</th>
|
|
37
|
+
<th class="tg-yw4l" style="min-width: 1050px; max-width: 1050px; font-size: 20px; color: white; text-align: right; padding: 30px;">Support Ticket</th>
|
|
38
|
+
</tr>
|
|
39
|
+
</thead>
|
|
40
|
+
<tbody>
|
|
41
|
+
<tr>
|
|
42
|
+
<td class="tg-baqh" style="min-width: 30%; max-width: 30%; font-weight: bold;">Support Ticket <br>Number</td>
|
|
43
|
+
<td class="tg-baqh" style="min-width: 60%; max-width: 60%;">{{support_ticket_number_string}}</td>
|
|
44
|
+
</tr>
|
|
45
|
+
<tr>
|
|
46
|
+
<td class="tg-baqh" style="min-width: 30%; max-width: 30%; font-weight: bold;">Type</td>
|
|
47
|
+
<td class="tg-baqh" style="min-width: 60%; max-width: 60%;">{{type}}</td>
|
|
48
|
+
</tr>
|
|
49
|
+
<tr>
|
|
50
|
+
<td class="tg-baqh" style="min-width: 30%; max-width: 30%; font-weight: bold;">Issue <br>Description</td>
|
|
51
|
+
<td class="tg-baqh" style="min-width: 60%; max-width: 60%;">{{issue}}</td>
|
|
52
|
+
</tr>
|
|
53
|
+
<tr>
|
|
54
|
+
<td class="tg-baqh" style="min-width: 30%; max-width: 30%; font-weight: bold;">Priority</td>
|
|
55
|
+
<td class="tg-baqh" style="min-width: 60%; max-width: 60%;">{{priority}}</td>
|
|
56
|
+
</tr>
|
|
57
|
+
<tr>
|
|
58
|
+
<td class="tg-baqh" style="min-width: 30%; max-width: 30%; font-weight: bold;">Status</td>
|
|
59
|
+
<td class="tg-baqh" style="min-width: 60%; max-width: 60%;">{{status}}</td>
|
|
60
|
+
</tr>
|
|
61
|
+
<tr>
|
|
62
|
+
<td class="tg-baqh" style="min-width: 30%; max-width: 30%; font-weight: bold;">Substatus</td>
|
|
63
|
+
<td class="tg-baqh" style="min-width: 60%; max-width: 60%;">{{substatus}}</td>
|
|
64
|
+
</tr>
|
|
65
|
+
<tr>
|
|
66
|
+
<td class="tg-baqh" style="min-width: 30%; max-width: 30%; font-weight: bold;">Date created</td>
|
|
67
|
+
<td class="tg-baqh" style="min-width: 60%; max-width: 60%;">{{date_created_string}}</td>
|
|
68
|
+
</tr>
|
|
69
|
+
</tbody>
|
|
70
|
+
</table>
|
|
71
|
+
</div>
|
|
72
|
+
<br><br><br>
|
|
73
|
+
|
|
74
|
+
ResolveIO, LLC<br>
|
|
75
|
+
Dustin Poole<br>
|
|
76
|
+
<a href="mailTo:ar@resolveio.com">ar@resolveio.com</a><br>
|
|
77
|
+
432-661-6150<br><br>
|
|
@@ -1,4 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (_) try {
|
|
17
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
2
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
38
|
var support_ticket_collection_1 = require("../collections/support-ticket.collection");
|
|
4
39
|
var simpl_schema_1 = require("simpl-schema");
|
|
@@ -30,6 +65,54 @@ function loadSupportTicketPublications(subscriptionManager) {
|
|
|
30
65
|
return document._id === id_support_ticket;
|
|
31
66
|
}
|
|
32
67
|
},
|
|
68
|
+
supportticketDetails: {
|
|
69
|
+
function: function (id_support_ticket) {
|
|
70
|
+
return support_ticket_collection_1.SupportTickets.aggregate([
|
|
71
|
+
{
|
|
72
|
+
$match: { _id: id_support_ticket }
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
$lookup: {
|
|
76
|
+
from: 'files',
|
|
77
|
+
localField: 'files',
|
|
78
|
+
foreignField: '_id',
|
|
79
|
+
as: 'dbFiles'
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
]).exec();
|
|
83
|
+
},
|
|
84
|
+
check: new simpl_schema_1.default({
|
|
85
|
+
id_support_ticket: {
|
|
86
|
+
type: String
|
|
87
|
+
}
|
|
88
|
+
}),
|
|
89
|
+
collections: ['support-tickets', 'files'],
|
|
90
|
+
preFunction: function (id_support_ticket) { return __awaiter(_this, void 0, void 0, function () {
|
|
91
|
+
var support_ticket;
|
|
92
|
+
return __generator(this, function (_a) {
|
|
93
|
+
switch (_a.label) {
|
|
94
|
+
case 0: return [4 /*yield*/, support_ticket_collection_1.SupportTickets.findOne({ _id: id_support_ticket })];
|
|
95
|
+
case 1:
|
|
96
|
+
support_ticket = _a.sent();
|
|
97
|
+
if (!support_ticket) {
|
|
98
|
+
return [2 /*return*/, {
|
|
99
|
+
support_ticket: [],
|
|
100
|
+
logs: []
|
|
101
|
+
}];
|
|
102
|
+
}
|
|
103
|
+
return [2 /*return*/, {
|
|
104
|
+
_id: support_ticket._id,
|
|
105
|
+
files: support_ticket.files
|
|
106
|
+
}];
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
}); },
|
|
110
|
+
fetchFunction: function (document, fetchData) {
|
|
111
|
+
return document._id === fetchData['_id'] ||
|
|
112
|
+
fetchData['logs'].includes(document._id) ||
|
|
113
|
+
fetchData['files'].includes(document._id);
|
|
114
|
+
}
|
|
115
|
+
},
|
|
33
116
|
supportticketsWithOptions: {
|
|
34
117
|
function: function (options, search, filters) {
|
|
35
118
|
return support_ticket_collection_1.SupportTickets.find(searchQuery.call(_this, search, filters)).sort(options.sort).limit(options.limit).skip(options.skip).select(options.fields).exec();
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (_) try {
|
|
17
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
var user_collection_1 = require("../collections/user.collection");
|
|
39
|
+
var simpl_schema_1 = require("simpl-schema");
|
|
40
|
+
var mongoose_1 = require("mongoose");
|
|
41
|
+
function loadSupportCronJobMethods(methodManager) {
|
|
42
|
+
methodManager.methods({
|
|
43
|
+
updateClientUsers: {
|
|
44
|
+
function: function () {
|
|
45
|
+
var _this = this;
|
|
46
|
+
return new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
|
|
47
|
+
var users, count, interval;
|
|
48
|
+
var _this = this;
|
|
49
|
+
return __generator(this, function (_a) {
|
|
50
|
+
switch (_a.label) {
|
|
51
|
+
case 0: return [4 /*yield*/, user_collection_1.Users.find({})];
|
|
52
|
+
case 1:
|
|
53
|
+
users = _a.sent();
|
|
54
|
+
count = 0;
|
|
55
|
+
interval = setInterval(function () {
|
|
56
|
+
var updateChunk = users.slice(count * 10, Math.min(users.length, (count + 1) * 10));
|
|
57
|
+
_this.callMethodInternal.call(_this, 'updateClientUserChunk', updateChunk);
|
|
58
|
+
count++;
|
|
59
|
+
if (count * 10 > users.length) {
|
|
60
|
+
clearInterval(interval);
|
|
61
|
+
resolve(true);
|
|
62
|
+
}
|
|
63
|
+
}, 1000);
|
|
64
|
+
resolve();
|
|
65
|
+
return [2 /*return*/];
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}); });
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
updateClientUserChunk: {
|
|
72
|
+
check: new simpl_schema_1.default({
|
|
73
|
+
users: {
|
|
74
|
+
type: Array
|
|
75
|
+
},
|
|
76
|
+
'users.$': {
|
|
77
|
+
type: Object,
|
|
78
|
+
blackbox: true
|
|
79
|
+
}
|
|
80
|
+
}),
|
|
81
|
+
function: function (users) {
|
|
82
|
+
return new Promise(function (resolve, reject) {
|
|
83
|
+
users.forEach(function (user) {
|
|
84
|
+
user_collection_1.ClientUsers.updateOne({ _id: user._id }, { $setOnInsert: { _id: mongoose_1.Types.ObjectId().toHexString(), __v: 0 }, $set: user }, { upsert: true }).exec();
|
|
85
|
+
});
|
|
86
|
+
resolve();
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
exports.loadSupportCronJobMethods = loadSupportCronJobMethods;
|
|
@@ -1,19 +1,275 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (_) try {
|
|
17
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
2
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
38
|
var simpl_schema_1 = require("simpl-schema");
|
|
4
39
|
var support_ticket_collection_1 = require("../collections/support-ticket.collection");
|
|
40
|
+
var file_collection_1 = require("../collections/file.collection");
|
|
41
|
+
var handlebars = require("handlebars");
|
|
42
|
+
var user_collection_1 = require("../collections/user.collection");
|
|
43
|
+
var notification_collection_1 = require("../collections/notification.collection");
|
|
5
44
|
function loadSupportMethods(supportManager) {
|
|
6
45
|
supportManager.supportMethods({
|
|
7
|
-
|
|
46
|
+
sendSupportTicketEmail: {
|
|
47
|
+
check: new simpl_schema_1.default({
|
|
48
|
+
supportTicket: {
|
|
49
|
+
type: support_ticket_collection_1.SupportTickets['simplschema']
|
|
50
|
+
},
|
|
51
|
+
id_files: {
|
|
52
|
+
type: Array
|
|
53
|
+
},
|
|
54
|
+
'id_files.$': {
|
|
55
|
+
type: String
|
|
56
|
+
}
|
|
57
|
+
}),
|
|
58
|
+
function: function (supportTicket, id_files) {
|
|
59
|
+
var _this = this;
|
|
60
|
+
return new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
|
|
61
|
+
var files;
|
|
62
|
+
var _this = this;
|
|
63
|
+
return __generator(this, function (_a) {
|
|
64
|
+
switch (_a.label) {
|
|
65
|
+
case 0: return [4 /*yield*/, file_collection_1.Files.find({
|
|
66
|
+
_id: { $in: id_files }
|
|
67
|
+
})];
|
|
68
|
+
case 1:
|
|
69
|
+
files = _a.sent();
|
|
70
|
+
this.callMethodInternal.call(this, 'getSignedUrls', files.map(function (a) { return a.key; }), 900, function (err, res) {
|
|
71
|
+
if (res) {
|
|
72
|
+
_this.readFile('email-templates/support-ticket.html').then(function (html) { return __awaiter(_this, void 0, void 0, function () {
|
|
73
|
+
var template, filesAttached, fileCnt, notification, users_1;
|
|
74
|
+
var _this = this;
|
|
75
|
+
return __generator(this, function (_a) {
|
|
76
|
+
switch (_a.label) {
|
|
77
|
+
case 0:
|
|
78
|
+
template = handlebars.compile(html);
|
|
79
|
+
handlebars.registerHelper('greaterThan', function (a, b) {
|
|
80
|
+
return a > b;
|
|
81
|
+
});
|
|
82
|
+
handlebars.registerHelper('equals', function (a, b) {
|
|
83
|
+
return a === b;
|
|
84
|
+
});
|
|
85
|
+
filesAttached = [];
|
|
86
|
+
fileCnt = 0;
|
|
87
|
+
res.forEach(function (url) {
|
|
88
|
+
filesAttached.push({ filename: files[fileCnt].name, path: url });
|
|
89
|
+
fileCnt++;
|
|
90
|
+
});
|
|
91
|
+
return [4 /*yield*/, notification_collection_1.Notifications.findOne({ name: 'Support Ticket Created' })];
|
|
92
|
+
case 1:
|
|
93
|
+
notification = _a.sent();
|
|
94
|
+
if (!notification) return [3 /*break*/, 3];
|
|
95
|
+
return [4 /*yield*/, user_collection_1.Users.find({ roles: 'notify-' + notification.name })];
|
|
96
|
+
case 2:
|
|
97
|
+
users_1 = _a.sent();
|
|
98
|
+
this.readImage('images/ResolveIO.png').then(function (logoData) {
|
|
99
|
+
supportTicket['logo'] = 'data:image/png;base64,' + logoData;
|
|
100
|
+
users_1.forEach(function (user) {
|
|
101
|
+
supportTicket['user'] = user.fullname;
|
|
102
|
+
supportTicket['fileAttached'] = filesAttached;
|
|
103
|
+
_this.sendEmail(user.email, 'ResolveIO - ' + supportTicket.support_ticket_number_string + ' Priority: ' + supportTicket.priority, '', template(supportTicket), filesAttached);
|
|
104
|
+
});
|
|
105
|
+
if (supportTicket.client_user && supportTicket.client_user.email) {
|
|
106
|
+
supportTicket['user'] = supportTicket.client_user.user;
|
|
107
|
+
supportTicket['fileAttached'] = filesAttached;
|
|
108
|
+
_this.sendEmail(supportTicket.client_user.email, 'ResolveIO - ' + supportTicket.support_ticket_number_string + ' Priority: ' + supportTicket.priority, '', template(supportTicket), filesAttached);
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
resolve(true);
|
|
112
|
+
return [3 /*break*/, 4];
|
|
113
|
+
case 3:
|
|
114
|
+
reject('No Notification');
|
|
115
|
+
_a.label = 4;
|
|
116
|
+
case 4: return [2 /*return*/];
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}); });
|
|
120
|
+
resolve(true);
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
_this.callMethodInternal.call(_this, 'insertErrorLog', 'supportTicketsmethod - getsignedurl', [
|
|
124
|
+
files.map(function (a) { return a.key; }), err
|
|
125
|
+
]);
|
|
126
|
+
reject(err);
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
return [2 /*return*/];
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
}); });
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
sendSupportTicketModifiedEmail: {
|
|
8
136
|
check: new simpl_schema_1.default({
|
|
9
|
-
|
|
137
|
+
supportTicket: {
|
|
138
|
+
type: support_ticket_collection_1.SupportTickets['simplschema']
|
|
139
|
+
},
|
|
140
|
+
id_files: {
|
|
141
|
+
type: Array
|
|
142
|
+
},
|
|
143
|
+
'id_files.$': {
|
|
10
144
|
type: String
|
|
11
145
|
}
|
|
12
146
|
}),
|
|
13
|
-
function: function (
|
|
14
|
-
|
|
147
|
+
function: function (supportTicket, id_files) {
|
|
148
|
+
var _this = this;
|
|
149
|
+
return new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
|
|
150
|
+
var files;
|
|
151
|
+
var _this = this;
|
|
152
|
+
return __generator(this, function (_a) {
|
|
153
|
+
switch (_a.label) {
|
|
154
|
+
case 0: return [4 /*yield*/, file_collection_1.Files.find({
|
|
155
|
+
_id: { $in: id_files }
|
|
156
|
+
})];
|
|
157
|
+
case 1:
|
|
158
|
+
files = _a.sent();
|
|
159
|
+
this.callMethodInternal.call(this, 'getSignedUrls', files.map(function (a) { return a.key; }), 900, function (err, res) {
|
|
160
|
+
if (res) {
|
|
161
|
+
_this.readFile('email-templates/support-ticket-modified.html').then(function (html) { return __awaiter(_this, void 0, void 0, function () {
|
|
162
|
+
var template, filesAttached, fileCnt;
|
|
163
|
+
var _this = this;
|
|
164
|
+
return __generator(this, function (_a) {
|
|
165
|
+
template = handlebars.compile(html);
|
|
166
|
+
handlebars.registerHelper('greaterThan', function (a, b) {
|
|
167
|
+
return a > b;
|
|
168
|
+
});
|
|
169
|
+
handlebars.registerHelper('equals', function (a, b) {
|
|
170
|
+
return a === b;
|
|
171
|
+
});
|
|
172
|
+
filesAttached = [];
|
|
173
|
+
fileCnt = 0;
|
|
174
|
+
res.forEach(function (url) {
|
|
175
|
+
filesAttached.push({ filename: files[fileCnt].name, path: url });
|
|
176
|
+
fileCnt++;
|
|
177
|
+
});
|
|
178
|
+
this.readImage('images/ResolveIO.png').then(function (logoData) {
|
|
179
|
+
supportTicket['logo'] = 'data:image/png;base64,' + logoData;
|
|
180
|
+
supportTicket.current_watchers.forEach(function (user) {
|
|
181
|
+
supportTicket['user'] = user.user;
|
|
182
|
+
supportTicket['fileAttached'] = filesAttached;
|
|
183
|
+
_this.sendEmail(user.email, 'ResolveIO - a ticket has been modified: ' + supportTicket.support_ticket_number_string + ' Priority: ' + supportTicket.priority, '', template(supportTicket), filesAttached);
|
|
184
|
+
});
|
|
185
|
+
if (supportTicket.client_user && supportTicket.client_user.email) {
|
|
186
|
+
supportTicket['user'] = supportTicket.client_user.user;
|
|
187
|
+
supportTicket['fileAttached'] = filesAttached;
|
|
188
|
+
_this.sendEmail(supportTicket.client_user.email, 'ResolveIO - ' + supportTicket.support_ticket_number_string + ' Priority: ' + supportTicket.priority, '', template(supportTicket), filesAttached);
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
resolve(true);
|
|
192
|
+
return [2 /*return*/];
|
|
193
|
+
});
|
|
194
|
+
}); });
|
|
195
|
+
resolve(true);
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
_this.callMethodInternal.call(_this, 'insertErrorLog', 'supportTicketsmethod - getsignedurl', [
|
|
199
|
+
files.map(function (a) { return a.key; }), err
|
|
200
|
+
]);
|
|
201
|
+
reject(err);
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
return [2 /*return*/];
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
}); });
|
|
15
208
|
}
|
|
16
209
|
},
|
|
210
|
+
sendSupportTicketDeletedEmail: {
|
|
211
|
+
check: new simpl_schema_1.default({
|
|
212
|
+
supportTicket: {
|
|
213
|
+
type: support_ticket_collection_1.SupportTickets['simplschema']
|
|
214
|
+
}
|
|
215
|
+
}),
|
|
216
|
+
function: function (supportTicket) {
|
|
217
|
+
var _this = this;
|
|
218
|
+
return new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
|
|
219
|
+
var _this = this;
|
|
220
|
+
return __generator(this, function (_a) {
|
|
221
|
+
this.callMethodInternal.call(this, 'getSignedUrls', [], 900, function (err, res) {
|
|
222
|
+
if (res) {
|
|
223
|
+
_this.readFile('email-templates/support-ticket-deleted.html').then(function (html) { return __awaiter(_this, void 0, void 0, function () {
|
|
224
|
+
var template, notification, users;
|
|
225
|
+
var _this = this;
|
|
226
|
+
return __generator(this, function (_a) {
|
|
227
|
+
switch (_a.label) {
|
|
228
|
+
case 0:
|
|
229
|
+
template = handlebars.compile(html);
|
|
230
|
+
handlebars.registerHelper('greaterThan', function (a, b) {
|
|
231
|
+
return a > b;
|
|
232
|
+
});
|
|
233
|
+
handlebars.registerHelper('equals', function (a, b) {
|
|
234
|
+
return a === b;
|
|
235
|
+
});
|
|
236
|
+
return [4 /*yield*/, notification_collection_1.Notifications.findOne({ name: 'Support Ticket Deleted' })];
|
|
237
|
+
case 1:
|
|
238
|
+
notification = _a.sent();
|
|
239
|
+
if (!notification) return [3 /*break*/, 3];
|
|
240
|
+
return [4 /*yield*/, user_collection_1.Users.find({ roles: 'notify-' + notification.name })];
|
|
241
|
+
case 2:
|
|
242
|
+
users = _a.sent();
|
|
243
|
+
users.forEach(function (user) {
|
|
244
|
+
_this.sendEmail(user.email, 'ResolveIO - a ticket has been deleted: ' + supportTicket.support_ticket_number_string, '', template(null), []);
|
|
245
|
+
});
|
|
246
|
+
resolve(true);
|
|
247
|
+
return [3 /*break*/, 4];
|
|
248
|
+
case 3:
|
|
249
|
+
reject('No Notification');
|
|
250
|
+
_a.label = 4;
|
|
251
|
+
case 4:
|
|
252
|
+
if (supportTicket.client_user && supportTicket.client_user.email) {
|
|
253
|
+
this.sendEmail(supportTicket.client_user.email, 'ResolveIO - ' + supportTicket.support_ticket_number_string + ' Priority: ' + supportTicket.priority, '', template(supportTicket), []);
|
|
254
|
+
}
|
|
255
|
+
return [2 /*return*/];
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
}); });
|
|
259
|
+
resolve(true);
|
|
260
|
+
}
|
|
261
|
+
else {
|
|
262
|
+
_this.callMethodInternal.call(_this, 'insertErrorLog', 'supportTicketsmethod - getsignedurl', [
|
|
263
|
+
[], err
|
|
264
|
+
]);
|
|
265
|
+
reject(err);
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
return [2 /*return*/];
|
|
269
|
+
});
|
|
270
|
+
}); });
|
|
271
|
+
}
|
|
272
|
+
}
|
|
17
273
|
});
|
|
18
274
|
}
|
|
19
275
|
exports.loadSupportMethods = loadSupportMethods;
|