@resolveio/server-lib 7.0.1 → 7.0.2-newrole
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/user.collection.js +39 -32
- package/collections/user.collection.js.map +1 -1
- package/methods/accounts.js.map +1 -1
- package/methods/support.js +8 -30
- package/methods/support.js.map +1 -1
- package/models/user.model.d.ts +25 -14
- package/models/user.model.js.map +1 -1
- package/package.json +1 -1
- package/publications/report-builder-libraries.js +2 -3
- package/publications/report-builder-libraries.js.map +1 -1
|
@@ -22,13 +22,6 @@ var schema = {
|
|
|
22
22
|
type: Date,
|
|
23
23
|
optional: true
|
|
24
24
|
},
|
|
25
|
-
readonly: {
|
|
26
|
-
type: Boolean,
|
|
27
|
-
optional: true
|
|
28
|
-
},
|
|
29
|
-
active: {
|
|
30
|
-
type: Boolean
|
|
31
|
-
},
|
|
32
25
|
attempts: {
|
|
33
26
|
type: Number,
|
|
34
27
|
optional: true
|
|
@@ -65,53 +58,67 @@ var schema = {
|
|
|
65
58
|
type: String
|
|
66
59
|
},
|
|
67
60
|
roles: {
|
|
61
|
+
type: Object
|
|
62
|
+
},
|
|
63
|
+
'roles.super_admin': {
|
|
64
|
+
type: Boolean
|
|
65
|
+
},
|
|
66
|
+
'roles.approvals': {
|
|
68
67
|
type: Array
|
|
69
68
|
},
|
|
70
|
-
'roles.$': {
|
|
69
|
+
'roles.approvals.$': {
|
|
70
|
+
type: Object
|
|
71
|
+
},
|
|
72
|
+
'roles.approvals.$.name': {
|
|
71
73
|
type: String
|
|
72
74
|
},
|
|
73
|
-
|
|
74
|
-
type: String
|
|
75
|
-
optional: true
|
|
75
|
+
'roles.approvals.$.type': {
|
|
76
|
+
type: String
|
|
76
77
|
},
|
|
77
|
-
|
|
78
|
-
type:
|
|
79
|
-
blackbox: true,
|
|
80
|
-
optional: true
|
|
78
|
+
'roles.approvals.$.accounting_code': {
|
|
79
|
+
type: String
|
|
81
80
|
},
|
|
82
|
-
|
|
83
|
-
type: Array
|
|
84
|
-
optional: true
|
|
81
|
+
'roles.groups': {
|
|
82
|
+
type: Array
|
|
85
83
|
},
|
|
86
|
-
'
|
|
84
|
+
'roles.groups.$': {
|
|
87
85
|
type: Object
|
|
88
86
|
},
|
|
89
|
-
'
|
|
87
|
+
'roles.groups.$.name': {
|
|
90
88
|
type: String
|
|
91
89
|
},
|
|
92
|
-
'
|
|
93
|
-
type:
|
|
90
|
+
'roles.groups.$.views': {
|
|
91
|
+
type: Array
|
|
94
92
|
},
|
|
95
|
-
'
|
|
93
|
+
'roles.groups.$.views.$': {
|
|
96
94
|
type: String
|
|
97
95
|
},
|
|
98
|
-
'
|
|
99
|
-
type: String
|
|
96
|
+
'roles.groups.$.yard': {
|
|
97
|
+
type: String,
|
|
98
|
+
optional: true
|
|
99
|
+
},
|
|
100
|
+
'roles.notifications': {
|
|
101
|
+
type: Array
|
|
100
102
|
},
|
|
101
|
-
'
|
|
103
|
+
'roles.notifications.$': {
|
|
102
104
|
type: String
|
|
103
105
|
},
|
|
104
|
-
'
|
|
105
|
-
type:
|
|
106
|
+
'roles.miscs': {
|
|
107
|
+
type: Array
|
|
106
108
|
},
|
|
107
|
-
'
|
|
108
|
-
type:
|
|
109
|
-
optional: true
|
|
109
|
+
'roles.miscs.$': {
|
|
110
|
+
type: String
|
|
110
111
|
},
|
|
111
|
-
|
|
112
|
+
active: Boolean,
|
|
113
|
+
phonenumber: {
|
|
112
114
|
type: String,
|
|
113
115
|
optional: true
|
|
114
116
|
},
|
|
117
|
+
other: {
|
|
118
|
+
type: Object,
|
|
119
|
+
optional: true,
|
|
120
|
+
blackbox: true
|
|
121
|
+
},
|
|
115
122
|
customers: {
|
|
116
123
|
type: Array,
|
|
117
124
|
optional: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/collections/user.collection.ts"],"names":[],"mappings":";;AAAA,qCAAwG;AACxG,+DAAiE;AACjE,6CAAwC;AACxC,kCAA2C;AAG3C,uE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C,MAAM,CAAC,CAAC;AAEhD,MAAM,CAAC,GAAG,GAAG;IACZ,IAAI,EAAE,iBAAM,CAAC,KAAK,CAAC,KAAK;CACxB,CAAC;AAEF,IAAI,aAAa,GAAG,IAAI,iBAAM,CAAC,MAAM,EAAE;IACtC,cAAc,EAAE,IAAI;IACpB,UAAU,EAAE,KAAK;IACjB,UAAU,EAAE,IAAI;CAChB,CAAC,CAAC;AAEH,aAAa,CAAC,KAAK,CAAC,EAAC,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAC,CAAC,CAAC;AAElD,aAAK,CAAC,mBAAmB,CAAC,GAAG,gBAAgB,CAAC;AAEjC,QAAA,YAAY,GAA0B,uBAAe,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,aAAK,CAAC,mBAAmB,CAAC,EAAE,aAAa,CAAC,CAAC;AAEhI,qCAAqC;AACrC,IAAI,SAAS,GAAmB,EAAE,CAAC;AAEnC,IAAI,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,sCAAc,CAAC,SAAS,EAAE,aAAa,EAAE,EAAE,CAAC,CAAC,CAAC;AACnF,aAAK,CAAC,UAAU,CAAC,GAAG,qCAAa,CAAC,QAAQ,CAAC,CAAC","file":"user.collection.js","sourcesContent":["import { Schema, Model, PassportLocalDocument, PassportLocalModel, PassportLocalSchema} from 'mongoose';\nimport * as passportLocalMongoose from 'passport-local-mongoose';\nimport SimpleSchema from 'simpl-schema';\nimport { ResolveIOServer } from '../index';\nimport { UserModel } from '../models/user.model';\nimport { LookupTables } from '../models/report-builder.model';\nimport { buildRbSchema, buildRbLookups } from '../util/schema-report-builder';\n\nlet schema: any = {\n\t_id: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\t__v: {\n\t\ttype: Number,\n\t\toptional: true\n\t},\n\tupdatedAt: {\n\t\ttype: Date,\n\t\toptional: true\n\t},\n\tcreatedAt: {\n\t\ttype: Date,\n\t\toptional: true\n\t},\n\tattempts: {\n\t\ttype: Number,\n\t\toptional: true\n\t},\n\tlast: {\n\t\ttype: Date,\n\t\toptional: true\n\t},\n\tservices: {\n\t\ttype: Object,\n\t\toptional: true\n\t},\n\t'services.enrollment': {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\t'services.forgot_password': {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\t'services.reset_password': {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\tusername: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\temail: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\tfullname: {\n\t\ttype: String\n\t},\n\troles: {\n\t\ttype: Object\n\t},\n\t'roles.super_admin': {\n\t\ttype: Boolean\n\t},\n\t'roles.approvals': {\n\t\ttype: Array\n\t},\n\t'roles.approvals.$': {\n\t\ttype: Object\n\t},\n\t'roles.approvals.$.name': {\n\t\ttype: String\n\t},\n\t'roles.approvals.$.type': {\n\t\ttype: String\n\t},\n\t'roles.approvals.$.accounting_code': {\n\t\ttype: String\n\t},\n\t'roles.groups': {\n\t\ttype: Array\n\t},\n\t'roles.groups.$': {\n\t\ttype: Object\n\t},\n\t'roles.groups.$.name': {\n\t\ttype: String\n\t},\n\t'roles.groups.$.views': {\n\t\ttype: Array\n\t},\n\t'roles.groups.$.views.$': {\n\t\ttype: String\n\t},\n\t'roles.groups.$.yard': {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\t'roles.notifications': {\n\t\ttype: Array\n\t},\n\t'roles.notifications.$': {\n\t\ttype: String\n\t},\n\t'roles.miscs': {\n\t\ttype: Array\n\t},\n\t'roles.miscs.$': {\n\t\ttype: String\n\t},\n\tactive: Boolean,\n\tphonenumber: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\tother: {\n\t\ttype: Object,\n\t\toptional: true,\n\t\tblackbox: true\n\t},\n\tcustomers: {\n\t\ttype: Array,\n\t\toptional: true,\n\t},\n\t'customers.$': {\n\t\ttype: Object\n\t},\n\t'customers.$.id_customer': {\n\t\ttype: String\n\t},\n\t'customers.$.customer': {\n\t\ttype: String\n\t},\n\tid_customer: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\tcustomer: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\tcustomer_type: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\tdepartments: {\n\t\ttype: Array,\n\t\toptional: true\n\t},\n\t'departments.$': {\n\t\ttype: Object\n\t},\n\t'departments.$.id_department': {\n\t\ttype: String\n\t},\n\t'departments.$.department': {\n\t\ttype: String\n\t}\n};\n\nconst DefaultSchema = <PassportLocalSchema>new Schema(schema, {\n\tskipVersioning: true,\n\tversionKey: false,\n\ttimestamps: true\n});\n\nDefaultSchema.plugin(passportLocalMongoose, {\n\tusernameUnique: true,\n\tlimitAttempts: true,\n\tmaxAttempts: 5,\n\tfindByUsername: (mongooseModel, queryParameters) => {\n\t\t// Add additional query parameter - AND condition - active: true\n\t\tqueryParameters.active = true;\n\t\treturn mongooseModel.findOne(queryParameters);\n\t}\n});\n\ninterface ResolveIOModel extends UserModel, PassportLocalDocument {}\nexport const Users: PassportLocalModel<ResolveIOModel> = (<any>ResolveIOServer.getMainDB()).model('users', DefaultSchema);\n\nUsers['simplschema'] = new SimpleSchema(schema);\n\nschema._id = {\n\ttype: Schema.Types.Mixed\n};\n\nlet VersionSchema = new Schema(schema, {\n\tskipVersioning: true,\n\tversionKey: false,\n\ttimestamps: true\n});\n\nVersionSchema.index({'_id.__v': 1, '_id._id': 1});\n\nUsers['versionCollection'] = 'users.versions';\n\nexport const UserVersions: Model<ResolveIOModel> = ResolveIOServer.getMainDB().model(Users['versionCollection'], VersionSchema);\n\n//------------- Report Builder Schema\nlet rbLookups: LookupTables[] = [];\n\nlet rbSchema = Object.assign(schema, buildRbLookups(rbLookups, DefaultSchema, []));\nUsers['rbSchema'] = buildRbSchema(rbSchema);"]}
|
package/methods/accounts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/methods/accounts.ts"],"names":[],"mapp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CAAsC,CAAC,CAAC,IAAI,CAAC,UAAA,IAAI;4CAC9D,IAAI,QAAQ,GAAG,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;4CACxC,UAAU,CAAC,cAAc,CAAC,QAAQ,EAAE,UAAC,CAAC,EAAE,CAAC;gDACxC,OAAO,CAAC,KAAK,CAAC,CAAC;4CAChB,CAAC,CAAC,CAAC;4CAEH,KAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,aAAa,GAAG,uBAAe,CAAC,aAAa,EAAE,GAAG,qBAAqB,EAAE,EAAE,EAAE,QAAQ,CAAC,WAAS,CAAC,CAAC,CAAC;4CAE7H,OAAO,CAAC,IAAI,CAAC,CAAC;wCACf,CAAC,EAAE,UAAA,QAAQ,IAAI,OAAA,MAAM,CAAC,QAAQ,CAAC,EAAhB,CAAgB,CAAC,CAAC;oCAClC,CAAC,CAAC,CAAC;iCACH;;;;qBACD,CAAC,CAAC;YACJ,CAAC;SACD;KACD,CAAC,CAAC;AACJ,CAAC;AAlMD,gDAkMC;AAED,SAAS,YAAY,CAAC,MAAM,EAAE,KAAK;IAClC,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,IAAI,CAAC,GAAG,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;KAAE;IAC/F,OAAO,MAAM,CAAC;AACf,CAAC","file":"accounts.js","sourcesContent":["import SimpleSchema from 'simpl-schema';\nimport { Types } from 'mongoose';\nimport { Users } from '../collections/user.collection';\nimport * as handlebars from 'handlebars';\nimport * as jwt from 'jsonwebtoken';\nimport { LoggedInUsers } from '../collections/logged-in-users.collection';\nimport { QueueResponses } from '../collections/queue-response.collection';\nimport { MethodManager } from '../managers/method.manager';\nimport { ResolveIOServer } from '../index';\nimport { UserModel } from '../models/user.model';\n\nexport function loadAccountMethods(methodManager: MethodManager) {\n\tmethodManager.methods({\n\t\tsetWSAppVersion: {\n\t\t\tskipQueue: true,\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tversion: Number\n\t\t\t}),\n\t\t\tfunction: function(version) {\n\t\t\t\treturn LoggedInUsers.updateOne({id_ws: this.id_ws}, {$set: {app_version: version}}).exec();\n\t\t\t}\n\t\t},\n\t\treloadWS: {\n\t\t\tskipQueue: true,\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tid_ws: String\n\t\t\t}),\n\t\t\tfunction: function(id_ws) {\n\t\t\t\treturn new Promise(async (resolve, reject) => {\n\t\t\t\t\tQueueResponses.create({\n\t\t\t\t\t\t_id: Types.ObjectId().toHexString(),\n\t\t\t\t\t\t__v: 0,\n\t\t\t\t\t\tmethod: 'reloadWSCommand',\n\t\t\t\t\t\tmethod_data: [],\n\t\t\t\t\t\tid_ws: id_ws,\n\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\tid_user: this.id_user,\n\t\t\t\t\t\tuser: this.user,\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\thasError: false,\n\t\t\t\t\t\t\tdata: 'reloadWSCommand'\n\t\t\t\t\t\t}\n\t\t\t\t\t}).then(val => {\n\t\t\t\t\t\t// console.log(val);\n\t\t\t\t\t}, err => {\n\t\t\t\t\t\tconsole.log(err);\n\t\t\t\t\t});\n\n\t\t\t\t\tresolve();\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\treconnectWS: {\n\t\t\tskipQueue: true,\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tid_ws: String\n\t\t\t}),\n\t\t\tfunction: function(id_ws) {\n\t\t\t\treturn new Promise(async (resolve, reject) => {\n\t\t\t\t\tQueueResponses.create({\n\t\t\t\t\t\t_id: Types.ObjectId().toHexString(),\n\t\t\t\t\t\t__v: 0,\n\t\t\t\t\t\tmethod: 'reconnectWSCommand',\n\t\t\t\t\t\tmethod_data: [],\n\t\t\t\t\t\tid_ws: id_ws,\n\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\tid_user: this.id_user,\n\t\t\t\t\t\tuser: this.user,\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\thasError: false,\n\t\t\t\t\t\t\tdata: 'reconnectWSCommand'\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\tresolve();\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\tdisconnectWS: {\n\t\t\tskipQueue: true,\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tid_ws: String\n\t\t\t}),\n\t\t\tfunction: function(id_ws) {\n\t\t\t\treturn new Promise(async (resolve, reject) => {\n\t\t\t\t\tQueueResponses.create({\n\t\t\t\t\t\t_id: Types.ObjectId().toHexString(),\n\t\t\t\t\t\t__v: 0,\n\t\t\t\t\t\tmethod: 'disconnectWSCommand',\n\t\t\t\t\t\tmethod_data: [],\n\t\t\t\t\t\tid_ws: id_ws,\n\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\tid_user: this.id_user,\n\t\t\t\t\t\tuser: this.user,\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\thasError: false,\n\t\t\t\t\t\t\tdata: 'disconnectWSCommand'\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\tresolve();\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\tcreateUserAndEmailEnrollment: {\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tdata: {\n\t\t\t\t\ttype: Users['simplschema']\n\t\t\t\t}\n\t\t\t}),\n\t\t\tfunction: function(data) {\n\t\t\t\treturn new Promise(async (resolve, reject) => {\n\t\t\t\t\tlet userId = Types.ObjectId().toHexString();\n\n\t\t\t\t\tlet newUser = {\n\t\t\t\t\t\t_id: userId,\n\t\t\t\t\t\t__v: 0,\n\t\t\t\t\t\tusername: data.username, \n\t\t\t\t\t\temail: data.email,\n\t\t\t\t\t\tfullname: data.fullname,\n\t\t\t\t\t\troles: data.roles,\n\t\t\t\t\t\tactive: true,\n\t\t\t\t\t\treadonly: false,\n\t\t\t\t\t\tservices: {\n\t\t\t\t\t\t\tenrollment: jwt.sign({id_user: userId}, this.serverConfig['JWT_SECRET'], {\n\t\t\t\t\t\t\t\texpiresIn : 3 * 24 * 60 * 60 * 1000 // 3 days\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t},\n\t\t\t\t\t\tphonenumber: data.phonenumber,\n\t\t\t\t\t\tother: {}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (data['departments']) {\n\t\t\t\t\t\tnewUser['departments'] = data['departments'];\n\t\t\t\t\t}\n\n\t\t\t\t\tif (data['other']) {\n\t\t\t\t\t\tnewUser['other'] = data['other'];\n\t\t\t\t\t}\n\n\t\t\t\t\tlet user = await Users.create(newUser);\n\n\t\t\t\t\tuser.setPassword(randomString(20, '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'), ((err, res) => {\n\t\t\t\t\t\tuser.resetAttempts();\n\n\t\t\t\t\t\tlet emailData = {\n\t\t\t\t\t\t\tfullname: user.fullname,\n\t\t\t\t\t\t\tuser: this.user,\n\t\t\t\t\t\t\turl: this.serverConfig['ROOT_URL'] + '/enroll-account?' + encodeURIComponent(this.serverConfig['SERVER_URL']) + '&' + user.services.enrollment\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tthis.readFile('email-templates/enrollment.html').then(html => {\n\t\t\t\t\t\t\tlet template = handlebars.compile(html);\n\t\t\t\t\t\t\thandlebars.registerHelper('equals', (a, b) => {\n\t\t\t\t\t\t\t\treturn a === b;\n\t\t\t\t\t\t\t});\n\t\t\n\t\t\t\t\t\t\tthis.sendEmail(user.email, 'ResolveIO (' + ResolveIOServer.getClientName() + ') - Enrollment Email', '', template(emailData));\n\t\t\n\t\t\t\t\t\t\tresolve(user);\n\t\t\t\t\t\t}, errEmail => reject(errEmail));\n\t\t\t\t\t}));\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\tresetUserPassword: {\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tuserId: {\n\t\t\t\t\ttype: String\n\t\t\t\t}\n\t\t\t}),\n\t\t\tfunction: function(userId: string) {\n\t\t\t\treturn new Promise(async (resolve, reject) => {\t\t\t\t\n\t\t\t\t\tlet user = await Users.findOne({_id: userId});\n\t\t\n\t\t\t\t\tif (user) {\n\n\t\t\t\t\t\tuser.services.forgot_password = jwt.sign({id_user: userId}, this.serverConfig['JWT_SECRET']);\n\n\t\t\t\t\t\tlet emailData = {\n\t\t\t\t\t\t\tuserToChangePassword: user.fullname,\n\t\t\t\t\t\t\tuserWhoResetPassword: this.user,\n\t\t\t\t\t\t\turl: this.serverConfig['ROOT_URL'] + '/forgot-password?' + encodeURIComponent(this.serverConfig['SERVER_URL']) + '&' + user.services.forgot_password\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tUsers.updateOne({_id: user._id}, {$set: {services: user.services}}).exec((err, res) => {\n\t\t\t\t\t\t\tthis.readFile('email-templates/forgot-password.html').then(html => {\n\t\t\t\t\t\t\t\tlet template = handlebars.compile(html);\n\t\t\t\t\t\t\t\thandlebars.registerHelper('equals', (a, b) => {\n\t\t\t\t\t\t\t\t\treturn a === b;\n\t\t\t\t\t\t\t\t});\n\t\t\t\n\t\t\t\t\t\t\t\tthis.sendEmail(user.email, 'ResolveIO (' + ResolveIOServer.getClientName() + ') - Forgot Password', '', template(emailData));\n\t\t\t\n\t\t\t\t\t\t\t\tresolve(true);\n\t\t\t\t\t\t\t}, errEmail => reject(errEmail));\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t});\n}\n\nfunction randomString(length, chars) {\n\tlet result = '';\n\tfor (let i = length; i > 0; --i) { result += chars[Math.floor(Math.random()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,CAAC,CAAC,IAAI,CAAC,UAAC,GAAG,EAAE,GAAG;wCACjF,KAAI,CAAC,QAAQ,CAAC,sCAAsC,CAAC,CAAC,IAAI,CAAC,UAAA,IAAI;4CAC9D,IAAI,QAAQ,GAAG,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;4CACxC,UAAU,CAAC,cAAc,CAAC,QAAQ,EAAE,UAAC,CAAC,EAAE,CAAC;gDACxC,OAAO,CAAC,KAAK,CAAC,CAAC;4CAChB,CAAC,CAAC,CAAC;4CAEH,KAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,aAAa,GAAG,uBAAe,CAAC,aAAa,EAAE,GAAG,qBAAqB,EAAE,EAAE,EAAE,QAAQ,CAAC,WAAS,CAAC,CAAC,CAAC;4CAE7H,OAAO,CAAC,IAAI,CAAC,CAAC;wCACf,CAAC,EAAE,UAAA,QAAQ,IAAI,OAAA,MAAM,CAAC,QAAQ,CAAC,EAAhB,CAAgB,CAAC,CAAC;oCAClC,CAAC,CAAC,CAAC;iCACH;;;;qBACD,CAAC,CAAC;YACJ,CAAC;SACD;KACD,CAAC,CAAC;AACJ,CAAC;AAlMD,gDAkMC;AAED,SAAS,YAAY,CAAC,MAAM,EAAE,KAAK;IAClC,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,IAAI,CAAC,GAAG,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;KAAE;IAC/F,OAAO,MAAM,CAAC;AACf,CAAC","file":"accounts.js","sourcesContent":["import SimpleSchema from 'simpl-schema';\nimport { Types } from 'mongoose';\nimport { Users } from '../collections/user.collection';\nimport * as handlebars from 'handlebars';\nimport * as jwt from 'jsonwebtoken';\nimport { LoggedInUsers } from '../collections/logged-in-users.collection';\nimport { QueueResponses } from '../collections/queue-response.collection';\nimport { MethodManager } from '../managers/method.manager';\nimport { ResolveIOServer } from '../index';\nimport { UserModel } from '../models/user.model';\n\nexport function loadAccountMethods(methodManager: MethodManager) {\n\tmethodManager.methods({\n\t\tsetWSAppVersion: {\n\t\t\tskipQueue: true,\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tversion: Number\n\t\t\t}),\n\t\t\tfunction: function(version) {\n\t\t\t\treturn LoggedInUsers.updateOne({id_ws: this.id_ws}, {$set: {app_version: version}}).exec();\n\t\t\t}\n\t\t},\n\t\treloadWS: {\n\t\t\tskipQueue: true,\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tid_ws: String\n\t\t\t}),\n\t\t\tfunction: function(id_ws) {\n\t\t\t\treturn new Promise(async (resolve, reject) => {\n\t\t\t\t\tQueueResponses.create({\n\t\t\t\t\t\t_id: Types.ObjectId().toHexString(),\n\t\t\t\t\t\t__v: 0,\n\t\t\t\t\t\tmethod: 'reloadWSCommand',\n\t\t\t\t\t\tmethod_data: [],\n\t\t\t\t\t\tid_ws: id_ws,\n\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\tid_user: this.id_user,\n\t\t\t\t\t\tuser: this.user,\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\thasError: false,\n\t\t\t\t\t\t\tdata: 'reloadWSCommand'\n\t\t\t\t\t\t}\n\t\t\t\t\t}).then(val => {\n\t\t\t\t\t\t// console.log(val);\n\t\t\t\t\t}, err => {\n\t\t\t\t\t\tconsole.log(err);\n\t\t\t\t\t});\n\n\t\t\t\t\tresolve();\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\treconnectWS: {\n\t\t\tskipQueue: true,\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tid_ws: String\n\t\t\t}),\n\t\t\tfunction: function(id_ws) {\n\t\t\t\treturn new Promise(async (resolve, reject) => {\n\t\t\t\t\tQueueResponses.create({\n\t\t\t\t\t\t_id: Types.ObjectId().toHexString(),\n\t\t\t\t\t\t__v: 0,\n\t\t\t\t\t\tmethod: 'reconnectWSCommand',\n\t\t\t\t\t\tmethod_data: [],\n\t\t\t\t\t\tid_ws: id_ws,\n\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\tid_user: this.id_user,\n\t\t\t\t\t\tuser: this.user,\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\thasError: false,\n\t\t\t\t\t\t\tdata: 'reconnectWSCommand'\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\tresolve();\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\tdisconnectWS: {\n\t\t\tskipQueue: true,\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tid_ws: String\n\t\t\t}),\n\t\t\tfunction: function(id_ws) {\n\t\t\t\treturn new Promise(async (resolve, reject) => {\n\t\t\t\t\tQueueResponses.create({\n\t\t\t\t\t\t_id: Types.ObjectId().toHexString(),\n\t\t\t\t\t\t__v: 0,\n\t\t\t\t\t\tmethod: 'disconnectWSCommand',\n\t\t\t\t\t\tmethod_data: [],\n\t\t\t\t\t\tid_ws: id_ws,\n\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\tid_user: this.id_user,\n\t\t\t\t\t\tuser: this.user,\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\thasError: false,\n\t\t\t\t\t\t\tdata: 'disconnectWSCommand'\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\tresolve();\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\tcreateUserAndEmailEnrollment: {\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tdata: {\n\t\t\t\t\ttype: Users['simplschema']\n\t\t\t\t}\n\t\t\t}),\n\t\t\tfunction: function(data) {\n\t\t\t\treturn new Promise(async (resolve, reject) => {\n\t\t\t\t\tlet userId = Types.ObjectId().toHexString();\n\n\t\t\t\t\tlet newUser = {\n\t\t\t\t\t\t_id: userId,\n\t\t\t\t\t\t__v: 0,\n\t\t\t\t\t\tusername: data.username, \n\t\t\t\t\t\temail: data.email,\n\t\t\t\t\t\tfullname: data.fullname,\n\t\t\t\t\t\troles: data.roles,\n\t\t\t\t\t\tactive: true,\n\t\t\t\t\t\treadonly: false,\n\t\t\t\t\t\tservices: {\n\t\t\t\t\t\t\tenrollment: jwt.sign({id_user: userId}, this.serverConfig['JWT_SECRET'], {\n\t\t\t\t\t\t\t\texpiresIn : 3 * 24 * 60 * 60 * 1000 // 3 days\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t},\n\t\t\t\t\t\tphonenumber: data.phonenumber,\n\t\t\t\t\t\tother: {}\n\t\t\t\t\t};\n\n\t\t\t\t\tif (data['departments']) {\n\t\t\t\t\t\tnewUser['departments'] = data['departments'];\n\t\t\t\t\t}\n\n\t\t\t\t\tif (data['other']) {\n\t\t\t\t\t\tnewUser['other'] = data['other'];\n\t\t\t\t\t}\n\n\t\t\t\t\tlet user = await Users.create(newUser);\n\n\t\t\t\t\tuser.setPassword(randomString(20, '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'), ((err, res) => {\n\t\t\t\t\t\tuser.resetAttempts();\n\n\t\t\t\t\t\tlet emailData = {\n\t\t\t\t\t\t\tfullname: user.fullname,\n\t\t\t\t\t\t\tuser: this.user,\n\t\t\t\t\t\t\turl: this.serverConfig['ROOT_URL'] + '/enroll-account?' + encodeURIComponent(this.serverConfig['SERVER_URL']) + '&' + user.services.enrollment\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tthis.readFile('email-templates/enrollment.html').then(html => {\n\t\t\t\t\t\t\tlet template = handlebars.compile(html);\n\t\t\t\t\t\t\thandlebars.registerHelper('equals', (a, b) => {\n\t\t\t\t\t\t\t\treturn a === b;\n\t\t\t\t\t\t\t});\n\t\t\n\t\t\t\t\t\t\tthis.sendEmail(user.email, 'ResolveIO (' + ResolveIOServer.getClientName() + ') - Enrollment Email', '', template(emailData));\n\t\t\n\t\t\t\t\t\t\tresolve(user);\n\t\t\t\t\t\t}, errEmail => reject(errEmail));\n\t\t\t\t\t}));\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\tresetUserPassword: {\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tuserId: {\n\t\t\t\t\ttype: String\n\t\t\t\t}\n\t\t\t}),\n\t\t\tfunction: function(userId: string) {\n\t\t\t\treturn new Promise(async (resolve, reject) => {\t\t\t\t\n\t\t\t\t\tlet user = await Users.findOne({_id: userId});\n\t\t\n\t\t\t\t\tif (user) {\n\n\t\t\t\t\t\tuser.services.forgot_password = jwt.sign({id_user: userId}, this.serverConfig['JWT_SECRET']);\n\n\t\t\t\t\t\tlet emailData = {\n\t\t\t\t\t\t\tuserToChangePassword: user.fullname,\n\t\t\t\t\t\t\tuserWhoResetPassword: this.user,\n\t\t\t\t\t\t\turl: this.serverConfig['ROOT_URL'] + '/forgot-password?' + encodeURIComponent(this.serverConfig['SERVER_URL']) + '&' + user.services.forgot_password\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tUsers.updateOne({_id: user._id}, {$set: {services: user.services}}).exec((err, res) => {\n\t\t\t\t\t\t\tthis.readFile('email-templates/forgot-password.html').then(html => {\n\t\t\t\t\t\t\t\tlet template = handlebars.compile(html);\n\t\t\t\t\t\t\t\thandlebars.registerHelper('equals', (a, b) => {\n\t\t\t\t\t\t\t\t\treturn a === b;\n\t\t\t\t\t\t\t\t});\n\t\t\t\n\t\t\t\t\t\t\t\tthis.sendEmail(user.email, 'ResolveIO (' + ResolveIOServer.getClientName() + ') - Forgot Password', '', template(emailData));\n\t\t\t\n\t\t\t\t\t\t\t\tresolve(true);\n\t\t\t\t\t\t\t}, errEmail => reject(errEmail));\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t});\n}\n\nfunction randomString(length, chars) {\n\tlet result = '';\n\tfor (let i = length; i > 0; --i) { result += chars[Math.floor(Math.random() * chars.length)]; }\n\treturn result;\n}"]}
|
package/methods/support.js
CHANGED
|
@@ -15,7 +15,7 @@ function loadSupportMethods(methodManager) {
|
|
|
15
15
|
return new Promise(function (resolve, reject) {
|
|
16
16
|
request({
|
|
17
17
|
method: 'POST',
|
|
18
|
-
url: 'https://resolveio.com/api/support/billing-user',
|
|
18
|
+
url: 'https://backend.resolveio.com/api/support/billing-user',
|
|
19
19
|
headers: {
|
|
20
20
|
'Content-Type': 'application/json; charset=UTF-8'
|
|
21
21
|
},
|
|
@@ -37,15 +37,15 @@ function loadSupportMethods(methodManager) {
|
|
|
37
37
|
type: String
|
|
38
38
|
}
|
|
39
39
|
}),
|
|
40
|
-
function: function (
|
|
40
|
+
function: function (id_support_ticket) {
|
|
41
41
|
return new Promise(function (resolve, reject) {
|
|
42
42
|
request({
|
|
43
43
|
method: 'POST',
|
|
44
|
-
url: 'https://resolveio.com/api/support/supportTicketWithId',
|
|
44
|
+
url: 'https://backend.resolveio.com/api/support/supportTicketWithId',
|
|
45
45
|
headers: {
|
|
46
46
|
'Content-Type': 'application/json; charset=UTF-8'
|
|
47
47
|
},
|
|
48
|
-
json:
|
|
48
|
+
json: { id_support_ticket: id_support_ticket }
|
|
49
49
|
}, (function (error, response, body) {
|
|
50
50
|
if (!error && body && !body.error) {
|
|
51
51
|
resolve(body.result);
|
|
@@ -63,7 +63,7 @@ function loadSupportMethods(methodManager) {
|
|
|
63
63
|
return new Promise(function (resolve, reject) {
|
|
64
64
|
request({
|
|
65
65
|
method: 'POST',
|
|
66
|
-
url: 'https://resolveio.com/api/support/supportInsertTicket',
|
|
66
|
+
url: 'https://backend.resolveio.com/api/support/supportInsertTicket',
|
|
67
67
|
headers: {
|
|
68
68
|
'Content-Type': 'application/json; charset=UTF-8'
|
|
69
69
|
},
|
|
@@ -85,29 +85,7 @@ function loadSupportMethods(methodManager) {
|
|
|
85
85
|
return new Promise(function (resolve, reject) {
|
|
86
86
|
request({
|
|
87
87
|
method: 'POST',
|
|
88
|
-
url: 'https://resolveio.com/api/support/supportUpdateTicket',
|
|
89
|
-
headers: {
|
|
90
|
-
'Content-Type': 'application/json; charset=UTF-8'
|
|
91
|
-
},
|
|
92
|
-
json: supportTicket
|
|
93
|
-
}, (function (error, response, body) {
|
|
94
|
-
if (!error && body && !body.error) {
|
|
95
|
-
resolve(body.result);
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
reject(error || body.result);
|
|
99
|
-
}
|
|
100
|
-
}));
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
supportDeleteSupportTicket: {
|
|
105
|
-
skipValidation: true,
|
|
106
|
-
function: function (supportTicket) {
|
|
107
|
-
return new Promise(function (resolve, reject) {
|
|
108
|
-
request({
|
|
109
|
-
method: 'POST',
|
|
110
|
-
url: 'https://resolveio.com/api/support/supportUpdateTicket',
|
|
88
|
+
url: 'https://backend.resolveio.com/api/support/supportUpdateTicket',
|
|
111
89
|
headers: {
|
|
112
90
|
'Content-Type': 'application/json; charset=UTF-8'
|
|
113
91
|
},
|
|
@@ -157,7 +135,7 @@ function loadSupportMethods(methodManager) {
|
|
|
157
135
|
return new Promise(function (resolve, reject) {
|
|
158
136
|
request({
|
|
159
137
|
method: 'POST',
|
|
160
|
-
url: 'https://resolveio.com/api/support/supportticketsWithOptions',
|
|
138
|
+
url: 'https://backend.resolveio.com/api/support/supportticketsWithOptions',
|
|
161
139
|
headers: {
|
|
162
140
|
'Content-Type': 'application/json; charset=UTF-8'
|
|
163
141
|
},
|
|
@@ -190,7 +168,7 @@ function loadSupportMethods(methodManager) {
|
|
|
190
168
|
return new Promise(function (resolve, reject) {
|
|
191
169
|
request({
|
|
192
170
|
method: 'POST',
|
|
193
|
-
url: 'https://resolveio.com/api/support/supportCountTickets',
|
|
171
|
+
url: 'https://backend.resolveio.com/api/support/supportCountTickets',
|
|
194
172
|
headers: {
|
|
195
173
|
'Content-Type': 'application/json; charset=UTF-8'
|
|
196
174
|
},
|
package/methods/support.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/methods/support.ts"],"names":[],"mappings":";;AAAA,6CAAwC;AAGxC,iCAAmC;AAEnC,SAAgB,kBAAkB,CAAC,aAA4B;IAC9D,aAAa,CAAC,OAAO,CAAC;QACf,wBAAwB,EAAE;YACzB,KAAK,EAAE,IAAI,sBAAY,CAAC;gBAC7B,IAAI,EAAE;oBACL,IAAI,EAAE,MAAM;oBACZ,QAAQ,EAAE,IAAI;iBACd;aACQ,CAAC;YACF,QAAQ,EAAE,UAAS,IAAI;gBACnB,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;oBAC/B,OAAO,CAAC;wBACJ,MAAM,EAAE,MAAM;wBACd,GAAG,EAAE,gDAAgD;wBACrD,OAAO,EAAE;4BACL,cAAc,EAAE,iCAAiC;yBACpD;wBACD,IAAI,EAAE,IAAI;qBACb,EAAE,CAAC,UAAC,KAAK,EAAE,QAAQ,EAAE,IAAI;wBACtB,IAAI,CAAC,KAAK,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;4BAC/B,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;yBACxB;6BACI;4BACD,MAAM,CAAC,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC;yBAChC;oBACpB,CAAC,CAAC,CAAC,CAAC;gBACO,CAAC,CAAC,CAAC;YACP,CAAC;SACV;QACD,6BAA6B,EAAE;YACxB,KAAK,EAAE,IAAI,sBAAY,CAAC;gBAC7B,iBAAiB,EAAE;oBAClB,IAAI,EAAE,MAAM;iBACZ;aACQ,CAAC;YACF,QAAQ,EAAE,UAAS,IAAI;gBACnB,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;oBAC/B,OAAO,CAAC;wBACJ,MAAM,EAAE,MAAM;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AE,KAAK;IAClC,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,IAAI,CAAC,GAAG,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;KAAE;IAC/F,OAAO,MAAM,CAAC;AACf,CAAC","file":"support.js","sourcesContent":["import SimpleSchema from 'simpl-schema';\nimport * as handlebars from 'handlebars';\nimport { MethodManager } from '../managers/method.manager';\nimport * as request from 'request';\n\nexport function loadSupportMethods(methodManager: MethodManager) {\n\tmethodManager.methods({\n supportCreateBillingUser: {\n \tcheck: new SimpleSchema({\n\t\t\t\tuser: {\n\t\t\t\t\ttype: Object,\n\t\t\t\t\tblackbox: true\n\t\t\t\t}\n }),\n function: function(user) {\n return new Promise((resolve, reject) => {\n request({\n method: 'POST',\n url: 'https://resolveio.com/api/support/billing-user',\n headers: {\n 'Content-Type': 'application/json; charset=UTF-8'\n },\n json: user\n }, ((error, response, body) => {\n if (!error && body && !body.error) {\n resolve(body.result);\n }\n else {\n reject(error || body.result);\n }\n\t\t\t\t\t}));\n });\n }\n\t\t},\n\t\tsupportGetSupportTicketWithId: {\n \tcheck: new SimpleSchema({\n\t\t\t\tid_support_ticket: {\n\t\t\t\t\ttype: String\n\t\t\t\t}\n }),\n function: function(user) {\n return new Promise((resolve, reject) => {\n request({\n method: 'POST',\n url: 'https://resolveio.com/api/support/supportTicketWithId',\n headers: {\n 'Content-Type': 'application/json; charset=UTF-8'\n },\n json: user\n }, ((error, response, body) => {\n if (!error && body && !body.error) {\n resolve(body.result);\n }\n else {\n reject(error || body.result);\n }\n\t\t\t\t\t}));\n });\n }\n\t\t},\n\t\tsupportInsertSupportTicket: {\n \tskipValidation: true,\n function: function(supportTicket) {\n return new Promise((resolve, reject) => {\n request({\n method: 'POST',\n url: 'https://resolveio.com/api/support/supportInsertTicket',\n headers: {\n 'Content-Type': 'application/json; charset=UTF-8'\n },\n json: supportTicket\n }, ((error, response, body) => {\n if (!error && body && !body.error) {\n resolve(body.result);\n }\n else {\n reject(error || body.result);\n }\n\t\t\t\t\t}));\n });\n }\n\t\t},\n\t\tsupportUpdateSupportTicket: {\n\t\t\tskipValidation: true,\n function: function(supportTicket) {\n return new Promise((resolve, reject) => {\n request({\n method: 'POST',\n url: 'https://resolveio.com/api/support/supportUpdateTicket',\n headers: {\n 'Content-Type': 'application/json; charset=UTF-8'\n },\n json: supportTicket\n }, ((error, response, body) => {\n if (!error && body && !body.error) {\n resolve(body.result);\n }\n else {\n reject(error || body.result);\n }\n\t\t\t\t\t}));\n });\n }\n\t\t},\n\t\tsupportDeleteSupportTicket: {\n\t\t\tskipValidation: true,\n function: function(supportTicket) {\n return new Promise((resolve, reject) => {\n request({\n method: 'POST',\n url: 'https://resolveio.com/api/support/supportUpdateTicket',\n headers: {\n 'Content-Type': 'application/json; charset=UTF-8'\n },\n json: supportTicket\n }, ((error, response, body) => {\n if (!error && body && !body.error) {\n resolve(body.result);\n }\n else {\n reject(error || body.result);\n }\n\t\t\t\t\t}));\n });\n }\n\t\t},\n\t\tsupportticketsWithOptions: {\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\toptions: {\n\t\t\t\t\ttype: Object\n\t\t\t\t},\n\t\t\t\t'options.limit': {\n\t\t\t\t\ttype: Number\n\t\t\t\t},\n\t\t\t\t'options.skip': {\n\t\t\t\t\ttype: Number\n\t\t\t\t},\n\t\t\t\t'options.sort': {\n\t\t\t\t\ttype: Object,\n\t\t\t\t\tblackbox: true\n\t\t\t\t},\n\t\t\t\t'options.fields': {\n\t\t\t\t\ttype: Object,\n\t\t\t\t\tblackbox: true\n\t\t\t\t},\n\t\t\t\tsearchString: {\n\t\t\t\t\ttype: String\n\t\t\t\t},\n\t\t\t\tfilters: {\n\t\t\t\t\ttype: Array\n\t\t\t\t},\n\t\t\t\t'filters.$': {\n\t\t\t\t\ttype: Object,\n\t\t\t\t\tblackbox: true\n\t\t\t\t}\n }),\n function: function(options, searchString, filters) {\n return new Promise((resolve, reject) => {\n request({\n method: 'POST',\n url: 'https://resolveio.com/api/support/supportticketsWithOptions',\n headers: {\n 'Content-Type': 'application/json; charset=UTF-8'\n },\n json: [options, searchString, filters]\n }, ((error, response, body) => {\n if (!error && body && !body.error) {\n resolve(body.result);\n }\n else {\n reject(error || body.result);\n }\n\t\t\t\t\t}));\n });\n }\n\t\t},\n\t\tsupportticketCount: {\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tsearchString: {\n\t\t\t\t\ttype: String\n\t\t\t\t},\n\t\t\t\tfilters: {\n\t\t\t\t\ttype: Array\n\t\t\t\t},\n\t\t\t\t'filters.$': {\n\t\t\t\t\ttype: Object,\n\t\t\t\t\tblackbox: true\n\t\t\t\t}\n }),\n function: function(searchString, filters) {\n return new Promise((resolve, reject) => {\n request({\n method: 'POST',\n url: 'https://resolveio.com/api/support/supportCountTickets',\n headers: {\n 'Content-Type': 'application/json; charset=UTF-8'\n },\n json: [searchString, filters]\n }, ((error, response, body) => {\n if (!error && body && !body.error) {\n resolve(body.result);\n }\n else {\n reject(error || body.result);\n }\n\t\t\t\t\t}));\n });\n }\n\t\t}\n\t\t// sendSupportTicketEmail: {\n\t\t// \tcheck: new SimpleSchema({\n\t\t// \t\tsupportTicket: {\n\t\t// \t\t\ttype: Object,\n\t\t// \t\t\tblackbox: true\n\t\t// \t\t},\n\t\t// \t\tid_files: {\n\t\t// \t\t\ttype: Array,\n\t\t// \t\t\toptional: true\t\t\t\n\t\t// \t\t},\n\t\t// \t\t'id_files.$': {\n\t\t// \t\t\ttype: String\n\t\t// \t\t}\n\t\t// \t}),\n\t\t// \tfunction: function(supportTicket: SupportTicketModel, id_files?: string[]) {\n\t\t// \t\treturn new Promise(async (resolve, reject) => {\t\t\t\t\t\n\t\t// \t\t\tif (id_files && id_files.length) {\n\t\t// \t\t\t\tlet files = await Files.find({\n\t\t// \t\t\t\t\t_id: {$in: id_files}\n\t\t// \t\t\t\t});\n\n\t\t// \t\t\t\tthis.callMethodInternal.call(this, 'getSignedUrls', files.map(a => a.key), 900, (err, res) => {\n\t\t// \t\t\t\t\tif (res) {\n\t\t// \t\t\t\t\t\tthis.readFile('email-templates/support-ticket.html').then(async html => {\n\t\t// \t\t\t\t\t\t\tlet template = handlebars.compile(html);\n\t\n\t\t// \t\t\t\t\t\t\thandlebars.registerHelper('greaterThan', (a, b) => {\n\t\t// \t\t\t\t\t\t\t\treturn a > b;\n\t\t// \t\t\t\t\t\t\t});\n\t\n\t\t// \t\t\t\t\t\t\thandlebars.registerHelper('equals', (a, b) => {\n\t\t// \t\t\t\t\t\t\t\treturn a === b;\n\t\t// \t\t\t\t\t\t\t});\n\t\n\t\t// \t\t\t\t\t\t\tlet filesAttached = [];\n\t\n\t\t// \t\t\t\t\t\t\tlet fileCnt = 0;\n\t\t// \t\t\t\t\t\t\tres.forEach(url => {\n\t\t// \t\t\t\t\t\t\t\tfilesAttached.push({filename: files[fileCnt].name, path: url});\n\t\t// \t\t\t\t\t\t\t\tfileCnt++;\n\t\t// \t\t\t\t\t\t\t});\n\t\n\t\t// \t\t\t\t\t\t\tthis.readImage('images/ResolveIO.png').then(logoData => {\n\t\t// \t\t\t\t\t\t\t\tsupportTicket['logo'] = 'data:image/png;base64,' + logoData;\n\t\t\t\t\t\t\t\t\t\t\n\t\t// \t\t\t\t\t\t\t\tif (supportTicket.client_user && supportTicket.client_user.email) {\n\t\n\t\t// \t\t\t\t\t\t\t\t\tsupportTicket['user'] = supportTicket.client_user.user;\n\t\t// \t\t\t\t\t\t\t\t\tsupportTicket['fileAttached'] = filesAttached;\n\t\n\t\t// \t\t\t\t\t\t\t\t\tthis.sendEmail(\n\t\t// \t\t\t\t\t\t\t\t\t\tsupportTicket.client_user.email, \n\t\t// \t\t\t\t\t\t\t\t\t\t'ResolveIO - ' + supportTicket.support_ticket_number_string + ' Priority: ' + supportTicket.priority, \n\t\t// \t\t\t\t\t\t\t\t\t\t'', \n\t\t// \t\t\t\t\t\t\t\t\t\ttemplate(supportTicket),\n\t\t// \t\t\t\t\t\t\t\t\t\tfilesAttached\n\t\t// \t\t\t\t\t\t\t\t\t);\n\t\t// \t\t\t\t\t\t\t\t}\n\t\t// \t\t\t\t\t\t\t}, err => {\n\t\t// \t\t\t\t\t\t\t\tconsole.log(err);\n\t\t// \t\t\t\t\t\t\t});\n\t\n\t\t// \t\t\t\t\t\t\tresolve(true);\n\t\t// \t\t\t\t\t\t}, err => {\n\t\t// \t\t\t\t\t\t\tconsole.log(err);\n\t\t// \t\t\t\t\t\t});\n\t\n\t\t// \t\t\t\t\t\tresolve(true);\n\t\t// \t\t\t\t\t}\n\t\t// \t\t\t\t\telse {\n\t\t// \t\t\t\t\t\tthis.callMethodInternal.call(this, 'insertErrorLog', 'supportTicketsmethod - getsignedurl', [\n\t\t// \t\t\t\t\t\t\tfiles.map(a => a.key), err\n\t\t// \t\t\t\t\t\t]);\n\t\t// \t\t\t\t\t\treject(err);\n\t\t// \t\t\t\t\t}\n\t\t// \t\t\t\t});\n\t\t// \t\t\t}\n\t\t// \t\t\telse {\n\t\t// \t\t\t\tthis.readFile('email-templates/support-ticket.html').then(async html => {\n\t\t// \t\t\t\t\tlet template = handlebars.compile(html);\n\n\t\t// \t\t\t\t\thandlebars.registerHelper('greaterThan', (a, b) => {\n\t\t// \t\t\t\t\t\treturn a > b;\n\t\t// \t\t\t\t\t});\n\n\t\t// \t\t\t\t\thandlebars.registerHelper('equals', (a, b) => {\n\t\t// \t\t\t\t\t\treturn a === b;\n\t\t// \t\t\t\t\t});\n\n\t\t// \t\t\t\t\tthis.readImage('images/ResolveIO.png').then(logoData => {\n\t\t// \t\t\t\t\t\tsupportTicket['logo'] = 'data:image/png;base64,' + logoData;\n\t\t\t\t\t\t\t\t\n\t\t// \t\t\t\t\t\tif (supportTicket.client_user && supportTicket.client_user.email) {\n\n\t\t// \t\t\t\t\t\t\tsupportTicket['user'] = supportTicket.client_user.user;\n\n\t\t// \t\t\t\t\t\t\tthis.sendEmail(\n\t\t// \t\t\t\t\t\t\t\tsupportTicket.client_user.email, \n\t\t// \t\t\t\t\t\t\t\t'ResolveIO - ' + supportTicket.support_ticket_number_string + ' Priority: ' + supportTicket.priority, \n\t\t// \t\t\t\t\t\t\t\t'', \n\t\t// \t\t\t\t\t\t\t\ttemplate(supportTicket),\n\t\t// \t\t\t\t\t\t\t\tnull\n\t\t// \t\t\t\t\t\t\t);\n\t\t// \t\t\t\t\t\t}\n\t\t// \t\t\t\t\t}, err => {\n\t\t// \t\t\t\t\t\tconsole.log(err);\n\t\t// \t\t\t\t\t});\n\n\t\t// \t\t\t\t\tresolve(true);\n\t\t// \t\t\t\t}, err => {\n\t\t// \t\t\t\t\tconsole.log(err);\n\t\t// \t\t\t\t});\n\n\t\t// \t\t\t\tresolve(true);\n\t\t// \t\t\t}\n\t\t// \t\t});\n\t\t// \t}\n\t\t// },\n\t\t// sendSupportTicketModifiedEmail: {\n\t\t// \tcheck: new SimpleSchema({\n\t\t// \t\tsupportTicket: {\n\t\t// \t\t\ttype: Object,\n\t\t// \t\t\tblackbox: true\n\t\t// \t\t},\n\t\t// \t\tid_files: {\n\t\t// \t\t\ttype: Array\t\t\t\t\t\n\t\t// \t\t},\n\t\t// \t\t'id_files.$': {\n\t\t// \t\t\ttype: String\n\t\t// \t\t}\n\t\t// \t}),\n\t\t// \tfunction: function(supportTicket: SupportTicketModel, id_files: string[]) {\n\t\t// \t\treturn new Promise(async (resolve, reject) => {\n\n\t\t// \t\t\tlet files = await Files.find({\n\t\t// \t\t\t\t_id: {$in: id_files}\n\t\t// \t\t\t});\n\n\t\t// \t\t\tthis.callMethodInternal.call(this, 'getSignedUrls', files.map(a => a.key), 900, (err, res) => {\n\t\t// \t\t\t\tif (res) {\n\t\t// \t\t\t\t\tthis.readFile('email-templates/support-ticket-modified.html').then(async html => {\n\t\t// \t\t\t\t\t\tlet template = handlebars.compile(html);\n\n\t\t// \t\t\t\t\t\thandlebars.registerHelper('greaterThan', (a, b) => {\n\t\t// \t\t\t\t\t\t\treturn a > b;\n\t\t// \t\t\t\t\t\t});\n\n\t\t// \t\t\t\t\t\thandlebars.registerHelper('equals', (a, b) => {\n\t\t// \t\t\t\t\t\t\treturn a === b;\n\t\t// \t\t\t\t\t\t});\n\n\t\t// \t\t\t\t\t\tlet filesAttached = [];\n\n\t\t// \t\t\t\t\t\tlet fileCnt = 0;\n\t\t// \t\t\t\t\t\tres.forEach(url => {\n\t\t// \t\t\t\t\t\t\tfilesAttached.push({filename: files[fileCnt].name, path: url});\n\t\t// \t\t\t\t\t\t\tfileCnt++;\n\t\t// \t\t\t\t\t\t});\n\n\t\t// \t\t\t\t\t\tthis.readImage('images/ResolveIO.png').then(logoData => {\n\t\t// \t\t\t\t\t\t\tsupportTicket['logo'] = 'data:image/png;base64,' + logoData;\n\t\t\t\t\t\t\t\t\n\t\t// \t\t\t\t\t\t\tsupportTicket.current_watchers.forEach(user => {\n\t\t\t\t\t\n\t\t// \t\t\t\t\t\t\t\tsupportTicket['user'] = user.user;\n\t\t// \t\t\t\t\t\t\t\tsupportTicket['fileAttached'] = filesAttached;\n\n\t\t// \t\t\t\t\t\t\t\tthis.sendEmail(\n\t\t// \t\t\t\t\t\t\t\t\tuser.email, \n\t\t// \t\t\t\t\t\t\t\t\t'ResolveIO - a ticket has been modified: ' + supportTicket.support_ticket_number_string + ' Priority: ' + supportTicket.priority, \n\t\t// \t\t\t\t\t\t\t\t\t'', \n\t\t// \t\t\t\t\t\t\t\t\ttemplate(supportTicket),\n\t\t// \t\t\t\t\t\t\t\t\tfilesAttached\n\t\t// \t\t\t\t\t\t\t\t);\n\t\t// \t\t\t\t\t\t\t});\n\n\t\t// \t\t\t\t\t\t\tif (supportTicket.client_user && supportTicket.client_user.email) {\n\n\t\t// \t\t\t\t\t\t\t\tsupportTicket['user'] = supportTicket.client_user.user;\n\t\t// \t\t\t\t\t\t\t\tsupportTicket['fileAttached'] = filesAttached;\n\n\t\t// \t\t\t\t\t\t\t\tthis.sendEmail(\n\t\t// \t\t\t\t\t\t\t\t\tsupportTicket.client_user.email, \n\t\t// \t\t\t\t\t\t\t\t\t'ResolveIO - ' + supportTicket.support_ticket_number_string + ' Priority: ' + supportTicket.priority, \n\t\t// \t\t\t\t\t\t\t\t\t'', \n\t\t// \t\t\t\t\t\t\t\t\ttemplate(supportTicket),\n\t\t// \t\t\t\t\t\t\t\t\tfilesAttached\n\t\t// \t\t\t\t\t\t\t\t);\n\t\t// \t\t\t\t\t\t\t}\n\t\t// \t\t\t\t\t\t}, err => {\n\t\t// \t\t\t\t\t\t\tconsole.log(err);\n\t\t// \t\t\t\t\t\t});\n\t\t\n\t\t// \t\t\t\t\t\tresolve(true);\n\t\t\t\t\t\t\t\t\n\t\t// \t\t\t\t\t}, err => {\n\t\t// \t\t\t\t\t\tconsole.log(err);\n\t\t// \t\t\t\t\t});\n\n\t\t// \t\t\t\t\tresolve(true);\n\t\t// \t\t\t\t}\n\t\t// \t\t\t\telse {\n\t\t// \t\t\t\t\tthis.callMethodInternal.call(this, 'insertErrorLog', 'supportTicketsmethod - getsignedurl', [\n\t\t// \t\t\t\t\t\tfiles.map(a => a.key), err\n\t\t// \t\t\t\t\t]);\n\t\t// \t\t\t\t\treject(err);\n\t\t// \t\t\t\t}\n\t\t// \t\t\t});\n\t\t// \t\t});\n\t\t// \t}\n\t\t// },\n\t\t// sendSupportTicketDeletedEmail: {\n\t\t// \tcheck: new SimpleSchema({\n\t\t// \t\tsupportTicket: {\n\t\t// \t\t\ttype: Object,\n\t\t// \t\t\tblackbox: true\n\t\t// \t\t}\n\t\t// \t}),\n\t\t// \tfunction: function(supportTicket: SupportTicketModel) {\n\t\t// \t\treturn new Promise(async (resolve, reject) => {\n\t\t// \t\t\tthis.callMethodInternal.call(this, 'getSignedUrls', [], 900, (err, res) => {\n\t\t// \t\t\t\tif (res) {\n\t\t// \t\t\t\t\tthis.readFile('email-templates/support-ticket-deleted.html').then(async html => {\n\t\t// \t\t\t\t\t\tlet template = handlebars.compile(html);\n\n\t\t// \t\t\t\t\t\thandlebars.registerHelper('greaterThan', (a, b) => {\n\t\t// \t\t\t\t\t\t\treturn a > b;\n\t\t// \t\t\t\t\t\t});\n\n\t\t// \t\t\t\t\t\thandlebars.registerHelper('equals', (a, b) => {\n\t\t// \t\t\t\t\t\t\treturn a === b;\n\t\t// \t\t\t\t\t\t});\n\n\t\t// \t\t\t\t\t\tif (supportTicket.client_user && supportTicket.client_user.email) {\n\t\t// \t\t\t\t\t\t\tthis.sendEmail(\n\t\t// \t\t\t\t\t\t\t\tsupportTicket.client_user.email, \n\t\t// \t\t\t\t\t\t\t\t'ResolveIO - ' + supportTicket.support_ticket_number_string + ' Priority: ' + supportTicket.priority, \n\t\t// \t\t\t\t\t\t\t\t'', \n\t\t// \t\t\t\t\t\t\t\ttemplate(supportTicket),\n\t\t// \t\t\t\t\t\t\t\t[]\n\t\t// \t\t\t\t\t\t\t);\n\t\t// \t\t\t\t\t\t}\n\t\t// \t\t\t\t\t}, err => {\n\t\t// \t\t\t\t\t\tconsole.log(err);\n\t\t// \t\t\t\t\t});\n\n\t\t// \t\t\t\t\tresolve(true);\n\t\t// \t\t\t\t}\n\t\t// \t\t\t\telse {\n\t\t// \t\t\t\t\tthis.callMethodInternal.call(this, 'insertErrorLog', 'supportTicketsmethod - getsignedurl', [\n\t\t// \t\t\t\t\t\t[], err\n\t\t// \t\t\t\t\t]);\n\t\t// \t\t\t\t\treject(err);\n\t\t// \t\t\t\t}\n\t\t// \t\t\t});\n\t\t// \t\t});\n\t\t// \t}\n\t\t// }\n\t});\n}\n\nfunction randomString(length, chars) {\n\tlet result = '';\n\tfor (let i = length; i > 0; --i) { result += chars[Math.floor(Math.random() * chars.length)]; }\n\treturn result;\n}"]}
|
|
1
|
+
{"version":3,"sources":["../../src/methods/support.ts"],"names":[],"mappings":";;AAAA,6CAAwC;AAGxC,iCAAmC;AAE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AuB;QACvB,YAAY;QAEZ,wDAAwD;QACxD,yBAAyB;QACzB,YAAY;QAEZ,4EAA4E;QAC5E,yBAAyB;QACzB,4CAA4C;QAC5C,iHAAiH;QACjH,eAAe;QACf,mCAAmC;QACnC,aAAa;QACb,YAAY;QACZ,UAAU;QACV,mBAAmB;QACnB,0BAA0B;QAC1B,WAAW;QAEX,sBAAsB;QACtB,QAAQ;QACR,aAAa;QACb,qGAAqG;QACrG,gBAAgB;QAChB,WAAW;QACX,oBAAoB;QACpB,QAAQ;QACR,SAAS;QACT,QAAQ;QACR,KAAK;QACL,IAAI;KACJ,CAAC,CAAC;AACJ,CAAC;AAzbD,gDAybC;AAED,SAAS,YAAY,CAAC,MAAM,EAAE,KAAK;IAClC,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,IAAI,CAAC,GAAG,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;KAAE;IAC/F,OAAO,MAAM,CAAC;AACf,CAAC","file":"support.js","sourcesContent":["import SimpleSchema from 'simpl-schema';\nimport * as handlebars from 'handlebars';\nimport { MethodManager } from '../managers/method.manager';\nimport * as request from 'request';\n\nexport function loadSupportMethods(methodManager: MethodManager) {\n\tmethodManager.methods({\n supportCreateBillingUser: {\n \tcheck: new SimpleSchema({\n\t\t\t\tuser: {\n\t\t\t\t\ttype: Object,\n\t\t\t\t\tblackbox: true\n\t\t\t\t}\n }),\n function: function(user) {\n return new Promise((resolve, reject) => {\n request({\n method: 'POST',\n url: 'https://backend.resolveio.com/api/support/billing-user',\n headers: {\n 'Content-Type': 'application/json; charset=UTF-8'\n },\n json: user\n }, ((error, response, body) => {\n if (!error && body && !body.error) {\n resolve(body.result);\n }\n else {\n reject(error || body.result);\n }\n\t\t\t\t\t}));\n });\n }\n\t\t},\n\t\tsupportGetSupportTicketWithId: {\n \tcheck: new SimpleSchema({\n\t\t\t\tid_support_ticket: {\n\t\t\t\t\ttype: String\n\t\t\t\t}\n }),\n function: function(id_support_ticket) {\n return new Promise((resolve, reject) => {\n request({\n method: 'POST',\n url: 'https://backend.resolveio.com/api/support/supportTicketWithId',\n headers: {\n 'Content-Type': 'application/json; charset=UTF-8'\n },\n json: {id_support_ticket: id_support_ticket}\n }, ((error, response, body) => {\n if (!error && body && !body.error) {\n resolve(body.result);\n }\n else {\n reject(error || body.result);\n }\n\t\t\t\t\t}));\n });\n }\n\t\t},\n\t\tsupportInsertSupportTicket: {\n \tskipValidation: true,\n function: function(supportTicket) {\n return new Promise((resolve, reject) => {\n request({\n method: 'POST',\n url: 'https://backend.resolveio.com/api/support/supportInsertTicket',\n headers: {\n 'Content-Type': 'application/json; charset=UTF-8'\n },\n json: supportTicket\n }, ((error, response, body) => {\n if (!error && body && !body.error) {\n resolve(body.result);\n }\n else {\n reject(error || body.result);\n }\n\t\t\t\t\t}));\n });\n }\n\t\t},\n\t\tsupportUpdateSupportTicket: {\n\t\t\tskipValidation: true,\n function: function(supportTicket) {\n return new Promise((resolve, reject) => {\n request({\n method: 'POST',\n url: 'https://backend.resolveio.com/api/support/supportUpdateTicket',\n headers: {\n 'Content-Type': 'application/json; charset=UTF-8'\n },\n json: supportTicket\n }, ((error, response, body) => {\n if (!error && body && !body.error) {\n resolve(body.result);\n }\n else {\n reject(error || body.result);\n }\n\t\t\t\t\t}));\n });\n }\n\t\t},\n\t\tsupportticketsWithOptions: {\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\toptions: {\n\t\t\t\t\ttype: Object\n\t\t\t\t},\n\t\t\t\t'options.limit': {\n\t\t\t\t\ttype: Number\n\t\t\t\t},\n\t\t\t\t'options.skip': {\n\t\t\t\t\ttype: Number\n\t\t\t\t},\n\t\t\t\t'options.sort': {\n\t\t\t\t\ttype: Object,\n\t\t\t\t\tblackbox: true\n\t\t\t\t},\n\t\t\t\t'options.fields': {\n\t\t\t\t\ttype: Object,\n\t\t\t\t\tblackbox: true\n\t\t\t\t},\n\t\t\t\tsearchString: {\n\t\t\t\t\ttype: String\n\t\t\t\t},\n\t\t\t\tfilters: {\n\t\t\t\t\ttype: Array\n\t\t\t\t},\n\t\t\t\t'filters.$': {\n\t\t\t\t\ttype: Object,\n\t\t\t\t\tblackbox: true\n\t\t\t\t}\n }),\n function: function(options, searchString, filters) {\n return new Promise((resolve, reject) => {\n request({\n method: 'POST',\n url: 'https://backend.resolveio.com/api/support/supportticketsWithOptions',\n headers: {\n 'Content-Type': 'application/json; charset=UTF-8'\n },\n json: [options, searchString, filters]\n }, ((error, response, body) => {\n if (!error && body && !body.error) {\n resolve(body.result);\n }\n else {\n reject(error || body.result);\n }\n\t\t\t\t\t}));\n });\n }\n\t\t},\n\t\tsupportticketCount: {\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tsearchString: {\n\t\t\t\t\ttype: String\n\t\t\t\t},\n\t\t\t\tfilters: {\n\t\t\t\t\ttype: Array\n\t\t\t\t},\n\t\t\t\t'filters.$': {\n\t\t\t\t\ttype: Object,\n\t\t\t\t\tblackbox: true\n\t\t\t\t}\n }),\n function: function(searchString, filters) {\n return new Promise((resolve, reject) => {\n request({\n method: 'POST',\n url: 'https://backend.resolveio.com/api/support/supportCountTickets',\n headers: {\n 'Content-Type': 'application/json; charset=UTF-8'\n },\n json: [searchString, filters]\n }, ((error, response, body) => {\n if (!error && body && !body.error) {\n resolve(body.result);\n }\n else {\n reject(error || body.result);\n }\n\t\t\t\t\t}));\n });\n }\n\t\t}\n\t\t// sendSupportTicketEmail: {\n\t\t// \tcheck: new SimpleSchema({\n\t\t// \t\tsupportTicket: {\n\t\t// \t\t\ttype: Object,\n\t\t// \t\t\tblackbox: true\n\t\t// \t\t},\n\t\t// \t\tid_files: {\n\t\t// \t\t\ttype: Array,\n\t\t// \t\t\toptional: true\t\t\t\n\t\t// \t\t},\n\t\t// \t\t'id_files.$': {\n\t\t// \t\t\ttype: String\n\t\t// \t\t}\n\t\t// \t}),\n\t\t// \tfunction: function(supportTicket: SupportTicketModel, id_files?: string[]) {\n\t\t// \t\treturn new Promise(async (resolve, reject) => {\t\t\t\t\t\n\t\t// \t\t\tif (id_files && id_files.length) {\n\t\t// \t\t\t\tlet files = await Files.find({\n\t\t// \t\t\t\t\t_id: {$in: id_files}\n\t\t// \t\t\t\t});\n\n\t\t// \t\t\t\tthis.callMethodInternal.call(this, 'getSignedUrls', files.map(a => a.key), 900, (err, res) => {\n\t\t// \t\t\t\t\tif (res) {\n\t\t// \t\t\t\t\t\tthis.readFile('email-templates/support-ticket.html').then(async html => {\n\t\t// \t\t\t\t\t\t\tlet template = handlebars.compile(html);\n\t\n\t\t// \t\t\t\t\t\t\thandlebars.registerHelper('greaterThan', (a, b) => {\n\t\t// \t\t\t\t\t\t\t\treturn a > b;\n\t\t// \t\t\t\t\t\t\t});\n\t\n\t\t// \t\t\t\t\t\t\thandlebars.registerHelper('equals', (a, b) => {\n\t\t// \t\t\t\t\t\t\t\treturn a === b;\n\t\t// \t\t\t\t\t\t\t});\n\t\n\t\t// \t\t\t\t\t\t\tlet filesAttached = [];\n\t\n\t\t// \t\t\t\t\t\t\tlet fileCnt = 0;\n\t\t// \t\t\t\t\t\t\tres.forEach(url => {\n\t\t// \t\t\t\t\t\t\t\tfilesAttached.push({filename: files[fileCnt].name, path: url});\n\t\t// \t\t\t\t\t\t\t\tfileCnt++;\n\t\t// \t\t\t\t\t\t\t});\n\t\n\t\t// \t\t\t\t\t\t\tthis.readImage('images/ResolveIO.png').then(logoData => {\n\t\t// \t\t\t\t\t\t\t\tsupportTicket['logo'] = 'data:image/png;base64,' + logoData;\n\t\t\t\t\t\t\t\t\t\t\n\t\t// \t\t\t\t\t\t\t\tif (supportTicket.client_user && supportTicket.client_user.email) {\n\t\n\t\t// \t\t\t\t\t\t\t\t\tsupportTicket['user'] = supportTicket.client_user.user;\n\t\t// \t\t\t\t\t\t\t\t\tsupportTicket['fileAttached'] = filesAttached;\n\t\n\t\t// \t\t\t\t\t\t\t\t\tthis.sendEmail(\n\t\t// \t\t\t\t\t\t\t\t\t\tsupportTicket.client_user.email, \n\t\t// \t\t\t\t\t\t\t\t\t\t'ResolveIO - ' + supportTicket.support_ticket_number_string + ' Priority: ' + supportTicket.priority, \n\t\t// \t\t\t\t\t\t\t\t\t\t'', \n\t\t// \t\t\t\t\t\t\t\t\t\ttemplate(supportTicket),\n\t\t// \t\t\t\t\t\t\t\t\t\tfilesAttached\n\t\t// \t\t\t\t\t\t\t\t\t);\n\t\t// \t\t\t\t\t\t\t\t}\n\t\t// \t\t\t\t\t\t\t}, err => {\n\t\t// \t\t\t\t\t\t\t\tconsole.log(err);\n\t\t// \t\t\t\t\t\t\t});\n\t\n\t\t// \t\t\t\t\t\t\tresolve(true);\n\t\t// \t\t\t\t\t\t}, err => {\n\t\t// \t\t\t\t\t\t\tconsole.log(err);\n\t\t// \t\t\t\t\t\t});\n\t\n\t\t// \t\t\t\t\t\tresolve(true);\n\t\t// \t\t\t\t\t}\n\t\t// \t\t\t\t\telse {\n\t\t// \t\t\t\t\t\tthis.callMethodInternal.call(this, 'insertErrorLog', 'supportTicketsmethod - getsignedurl', [\n\t\t// \t\t\t\t\t\t\tfiles.map(a => a.key), err\n\t\t// \t\t\t\t\t\t]);\n\t\t// \t\t\t\t\t\treject(err);\n\t\t// \t\t\t\t\t}\n\t\t// \t\t\t\t});\n\t\t// \t\t\t}\n\t\t// \t\t\telse {\n\t\t// \t\t\t\tthis.readFile('email-templates/support-ticket.html').then(async html => {\n\t\t// \t\t\t\t\tlet template = handlebars.compile(html);\n\n\t\t// \t\t\t\t\thandlebars.registerHelper('greaterThan', (a, b) => {\n\t\t// \t\t\t\t\t\treturn a > b;\n\t\t// \t\t\t\t\t});\n\n\t\t// \t\t\t\t\thandlebars.registerHelper('equals', (a, b) => {\n\t\t// \t\t\t\t\t\treturn a === b;\n\t\t// \t\t\t\t\t});\n\n\t\t// \t\t\t\t\tthis.readImage('images/ResolveIO.png').then(logoData => {\n\t\t// \t\t\t\t\t\tsupportTicket['logo'] = 'data:image/png;base64,' + logoData;\n\t\t\t\t\t\t\t\t\n\t\t// \t\t\t\t\t\tif (supportTicket.client_user && supportTicket.client_user.email) {\n\n\t\t// \t\t\t\t\t\t\tsupportTicket['user'] = supportTicket.client_user.user;\n\n\t\t// \t\t\t\t\t\t\tthis.sendEmail(\n\t\t// \t\t\t\t\t\t\t\tsupportTicket.client_user.email, \n\t\t// \t\t\t\t\t\t\t\t'ResolveIO - ' + supportTicket.support_ticket_number_string + ' Priority: ' + supportTicket.priority, \n\t\t// \t\t\t\t\t\t\t\t'', \n\t\t// \t\t\t\t\t\t\t\ttemplate(supportTicket),\n\t\t// \t\t\t\t\t\t\t\tnull\n\t\t// \t\t\t\t\t\t\t);\n\t\t// \t\t\t\t\t\t}\n\t\t// \t\t\t\t\t}, err => {\n\t\t// \t\t\t\t\t\tconsole.log(err);\n\t\t// \t\t\t\t\t});\n\n\t\t// \t\t\t\t\tresolve(true);\n\t\t// \t\t\t\t}, err => {\n\t\t// \t\t\t\t\tconsole.log(err);\n\t\t// \t\t\t\t});\n\n\t\t// \t\t\t\tresolve(true);\n\t\t// \t\t\t}\n\t\t// \t\t});\n\t\t// \t}\n\t\t// },\n\t\t// sendSupportTicketModifiedEmail: {\n\t\t// \tcheck: new SimpleSchema({\n\t\t// \t\tsupportTicket: {\n\t\t// \t\t\ttype: Object,\n\t\t// \t\t\tblackbox: true\n\t\t// \t\t},\n\t\t// \t\tid_files: {\n\t\t// \t\t\ttype: Array\t\t\t\t\t\n\t\t// \t\t},\n\t\t// \t\t'id_files.$': {\n\t\t// \t\t\ttype: String\n\t\t// \t\t}\n\t\t// \t}),\n\t\t// \tfunction: function(supportTicket: SupportTicketModel, id_files: string[]) {\n\t\t// \t\treturn new Promise(async (resolve, reject) => {\n\n\t\t// \t\t\tlet files = await Files.find({\n\t\t// \t\t\t\t_id: {$in: id_files}\n\t\t// \t\t\t});\n\n\t\t// \t\t\tthis.callMethodInternal.call(this, 'getSignedUrls', files.map(a => a.key), 900, (err, res) => {\n\t\t// \t\t\t\tif (res) {\n\t\t// \t\t\t\t\tthis.readFile('email-templates/support-ticket-modified.html').then(async html => {\n\t\t// \t\t\t\t\t\tlet template = handlebars.compile(html);\n\n\t\t// \t\t\t\t\t\thandlebars.registerHelper('greaterThan', (a, b) => {\n\t\t// \t\t\t\t\t\t\treturn a > b;\n\t\t// \t\t\t\t\t\t});\n\n\t\t// \t\t\t\t\t\thandlebars.registerHelper('equals', (a, b) => {\n\t\t// \t\t\t\t\t\t\treturn a === b;\n\t\t// \t\t\t\t\t\t});\n\n\t\t// \t\t\t\t\t\tlet filesAttached = [];\n\n\t\t// \t\t\t\t\t\tlet fileCnt = 0;\n\t\t// \t\t\t\t\t\tres.forEach(url => {\n\t\t// \t\t\t\t\t\t\tfilesAttached.push({filename: files[fileCnt].name, path: url});\n\t\t// \t\t\t\t\t\t\tfileCnt++;\n\t\t// \t\t\t\t\t\t});\n\n\t\t// \t\t\t\t\t\tthis.readImage('images/ResolveIO.png').then(logoData => {\n\t\t// \t\t\t\t\t\t\tsupportTicket['logo'] = 'data:image/png;base64,' + logoData;\n\t\t\t\t\t\t\t\t\n\t\t// \t\t\t\t\t\t\tsupportTicket.current_watchers.forEach(user => {\n\t\t\t\t\t\n\t\t// \t\t\t\t\t\t\t\tsupportTicket['user'] = user.user;\n\t\t// \t\t\t\t\t\t\t\tsupportTicket['fileAttached'] = filesAttached;\n\n\t\t// \t\t\t\t\t\t\t\tthis.sendEmail(\n\t\t// \t\t\t\t\t\t\t\t\tuser.email, \n\t\t// \t\t\t\t\t\t\t\t\t'ResolveIO - a ticket has been modified: ' + supportTicket.support_ticket_number_string + ' Priority: ' + supportTicket.priority, \n\t\t// \t\t\t\t\t\t\t\t\t'', \n\t\t// \t\t\t\t\t\t\t\t\ttemplate(supportTicket),\n\t\t// \t\t\t\t\t\t\t\t\tfilesAttached\n\t\t// \t\t\t\t\t\t\t\t);\n\t\t// \t\t\t\t\t\t\t});\n\n\t\t// \t\t\t\t\t\t\tif (supportTicket.client_user && supportTicket.client_user.email) {\n\n\t\t// \t\t\t\t\t\t\t\tsupportTicket['user'] = supportTicket.client_user.user;\n\t\t// \t\t\t\t\t\t\t\tsupportTicket['fileAttached'] = filesAttached;\n\n\t\t// \t\t\t\t\t\t\t\tthis.sendEmail(\n\t\t// \t\t\t\t\t\t\t\t\tsupportTicket.client_user.email, \n\t\t// \t\t\t\t\t\t\t\t\t'ResolveIO - ' + supportTicket.support_ticket_number_string + ' Priority: ' + supportTicket.priority, \n\t\t// \t\t\t\t\t\t\t\t\t'', \n\t\t// \t\t\t\t\t\t\t\t\ttemplate(supportTicket),\n\t\t// \t\t\t\t\t\t\t\t\tfilesAttached\n\t\t// \t\t\t\t\t\t\t\t);\n\t\t// \t\t\t\t\t\t\t}\n\t\t// \t\t\t\t\t\t}, err => {\n\t\t// \t\t\t\t\t\t\tconsole.log(err);\n\t\t// \t\t\t\t\t\t});\n\t\t\n\t\t// \t\t\t\t\t\tresolve(true);\n\t\t\t\t\t\t\t\t\n\t\t// \t\t\t\t\t}, err => {\n\t\t// \t\t\t\t\t\tconsole.log(err);\n\t\t// \t\t\t\t\t});\n\n\t\t// \t\t\t\t\tresolve(true);\n\t\t// \t\t\t\t}\n\t\t// \t\t\t\telse {\n\t\t// \t\t\t\t\tthis.callMethodInternal.call(this, 'insertErrorLog', 'supportTicketsmethod - getsignedurl', [\n\t\t// \t\t\t\t\t\tfiles.map(a => a.key), err\n\t\t// \t\t\t\t\t]);\n\t\t// \t\t\t\t\treject(err);\n\t\t// \t\t\t\t}\n\t\t// \t\t\t});\n\t\t// \t\t});\n\t\t// \t}\n\t\t// },\n\t\t// sendSupportTicketDeletedEmail: {\n\t\t// \tcheck: new SimpleSchema({\n\t\t// \t\tsupportTicket: {\n\t\t// \t\t\ttype: Object,\n\t\t// \t\t\tblackbox: true\n\t\t// \t\t}\n\t\t// \t}),\n\t\t// \tfunction: function(supportTicket: SupportTicketModel) {\n\t\t// \t\treturn new Promise(async (resolve, reject) => {\n\t\t// \t\t\tthis.callMethodInternal.call(this, 'getSignedUrls', [], 900, (err, res) => {\n\t\t// \t\t\t\tif (res) {\n\t\t// \t\t\t\t\tthis.readFile('email-templates/support-ticket-deleted.html').then(async html => {\n\t\t// \t\t\t\t\t\tlet template = handlebars.compile(html);\n\n\t\t// \t\t\t\t\t\thandlebars.registerHelper('greaterThan', (a, b) => {\n\t\t// \t\t\t\t\t\t\treturn a > b;\n\t\t// \t\t\t\t\t\t});\n\n\t\t// \t\t\t\t\t\thandlebars.registerHelper('equals', (a, b) => {\n\t\t// \t\t\t\t\t\t\treturn a === b;\n\t\t// \t\t\t\t\t\t});\n\n\t\t// \t\t\t\t\t\tif (supportTicket.client_user && supportTicket.client_user.email) {\n\t\t// \t\t\t\t\t\t\tthis.sendEmail(\n\t\t// \t\t\t\t\t\t\t\tsupportTicket.client_user.email, \n\t\t// \t\t\t\t\t\t\t\t'ResolveIO - ' + supportTicket.support_ticket_number_string + ' Priority: ' + supportTicket.priority, \n\t\t// \t\t\t\t\t\t\t\t'', \n\t\t// \t\t\t\t\t\t\t\ttemplate(supportTicket),\n\t\t// \t\t\t\t\t\t\t\t[]\n\t\t// \t\t\t\t\t\t\t);\n\t\t// \t\t\t\t\t\t}\n\t\t// \t\t\t\t\t}, err => {\n\t\t// \t\t\t\t\t\tconsole.log(err);\n\t\t// \t\t\t\t\t});\n\n\t\t// \t\t\t\t\tresolve(true);\n\t\t// \t\t\t\t}\n\t\t// \t\t\t\telse {\n\t\t// \t\t\t\t\tthis.callMethodInternal.call(this, 'insertErrorLog', 'supportTicketsmethod - getsignedurl', [\n\t\t// \t\t\t\t\t\t[], err\n\t\t// \t\t\t\t\t]);\n\t\t// \t\t\t\t\treject(err);\n\t\t// \t\t\t\t}\n\t\t// \t\t\t});\n\t\t// \t\t});\n\t\t// \t}\n\t\t// }\n\t});\n}\n\nfunction randomString(length, chars) {\n\tlet result = '';\n\tfor (let i = length; i > 0; --i) { result += chars[Math.floor(Math.random() * chars.length)]; }\n\treturn result;\n}"]}
|
package/models/user.model.d.ts
CHANGED
|
@@ -1,29 +1,27 @@
|
|
|
1
1
|
import { CollectionDocument } from './collection-document.model';
|
|
2
2
|
export interface UserModel extends CollectionDocument {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
roles: UserRoleModel;
|
|
4
|
+
attempts?: number;
|
|
5
|
+
last?: Date;
|
|
6
|
+
services?: any;
|
|
5
7
|
fullname: string;
|
|
6
|
-
roles: string[];
|
|
7
|
-
readonly?: boolean;
|
|
8
8
|
username?: string;
|
|
9
9
|
email?: string;
|
|
10
10
|
active?: boolean;
|
|
11
|
-
services?: any;
|
|
12
|
-
phonenumber?: string;
|
|
13
|
-
other?: UserObject;
|
|
14
11
|
id_customer?: string;
|
|
15
12
|
customer?: string;
|
|
16
13
|
customer_type?: string;
|
|
17
|
-
customers?:
|
|
14
|
+
customers?: UserCustomerModel[];
|
|
15
|
+
phonenumber?: string;
|
|
16
|
+
other?: UserObject;
|
|
17
|
+
assets?: UserAssetModel[];
|
|
18
|
+
id_function?: string;
|
|
19
|
+
readonly?: boolean;
|
|
18
20
|
departments?: UserDepartmentModel[];
|
|
19
21
|
}
|
|
20
22
|
export interface UserObject {
|
|
21
23
|
[key: string]: any;
|
|
22
24
|
}
|
|
23
|
-
export interface UserDepartmentModel {
|
|
24
|
-
id_department: string;
|
|
25
|
-
department: string;
|
|
26
|
-
}
|
|
27
25
|
export interface UserRoleModel {
|
|
28
26
|
super_admin: boolean;
|
|
29
27
|
approvals: UserRoleApprovalModel[];
|
|
@@ -41,7 +39,20 @@ export interface UserRoleGroupModel {
|
|
|
41
39
|
views: string[];
|
|
42
40
|
yard?: string;
|
|
43
41
|
}
|
|
44
|
-
export interface
|
|
45
|
-
|
|
42
|
+
export interface UserAssetModel {
|
|
43
|
+
type: any;
|
|
44
|
+
id_asset: string;
|
|
45
|
+
asset_number: string;
|
|
46
|
+
ownership: string;
|
|
47
|
+
ownership_driver: string;
|
|
48
|
+
date_start: Date;
|
|
49
|
+
date_end?: Date;
|
|
50
|
+
}
|
|
51
|
+
export interface UserCustomerModel {
|
|
46
52
|
customer: string;
|
|
53
|
+
id_customer: string;
|
|
54
|
+
}
|
|
55
|
+
export interface UserDepartmentModel {
|
|
56
|
+
id_department: string;
|
|
57
|
+
department: string;
|
|
47
58
|
}
|
package/models/user.model.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/models/user.model.ts"],"names":[],"mappings":"","file":"user.model.js","sourcesContent":["import { CollectionDocument } from './collection-document.model';\n\nexport interface UserModel extends CollectionDocument {\n\
|
|
1
|
+
{"version":3,"sources":["../../src/models/user.model.ts"],"names":[],"mappings":"","file":"user.model.js","sourcesContent":["import { CollectionDocument } from './collection-document.model';\n\nexport interface UserModel extends CollectionDocument {\n\troles: UserRoleModel;\n\tattempts?: number;\n\tlast?: Date;\n\tservices?: any;\n\tfullname: string;\n\tusername?: string;\n\temail?: string;\n\tactive?: boolean;\n\tid_customer?: string;\n\tcustomer?: string;\n\tcustomer_type?: string;\n\tcustomers?: UserCustomerModel[];\n\tphonenumber?: string;\n\tother?: UserObject;\n\tassets?: UserAssetModel[];\n\tid_function?: string;\n\treadonly?: boolean;\n\tdepartments?: UserDepartmentModel[];\n}\n\nexport interface UserObject {\n [key: string]: any;\n}\n\nexport interface UserRoleModel {\n\tsuper_admin: boolean;\n\tapprovals: UserRoleApprovalModel[];\n\tgroups: UserRoleGroupModel[];\n\tnotifications: string[];\n\tmiscs: string[];\n}\n\nexport interface UserRoleApprovalModel {\n\taccounting_code: string;\n\ttype: string;\n\tname: string;\n}\n\nexport interface UserRoleGroupModel {\n\tname: string;\n\tviews: string[];\n\tyard?: string;\n}\n\nexport interface UserAssetModel {\n\ttype: any;\n\tid_asset: string;\n\tasset_number: string;\n\townership: string;\n\townership_driver: string;\n\tdate_start: Date;\n\tdate_end?: Date;\n}\n\nexport interface UserCustomerModel {\n\tcustomer: string;\n\tid_customer: string;\n}\n\nexport interface UserDepartmentModel {\n\tid_department: string;\n\tdepartment: string;\n}"]}
|
package/package.json
CHANGED
|
@@ -67,14 +67,13 @@ function loadReportBuilderLibraryPublications(subscriptionManager) {
|
|
|
67
67
|
}
|
|
68
68
|
}),
|
|
69
69
|
function: function (id_user) { return __awaiter(_this, void 0, void 0, function () {
|
|
70
|
-
var user,
|
|
70
|
+
var user, userGroups;
|
|
71
71
|
return __generator(this, function (_a) {
|
|
72
72
|
switch (_a.label) {
|
|
73
73
|
case 0: return [4 /*yield*/, user_collection_1.Users.findById(id_user)];
|
|
74
74
|
case 1:
|
|
75
75
|
user = _a.sent();
|
|
76
|
-
|
|
77
|
-
return [4 /*yield*/, user_group_collection_1.UserGroups.find({ name: { $in: userGroupNames } })];
|
|
76
|
+
return [4 /*yield*/, user_group_collection_1.UserGroups.find({ name: { $in: user.roles.groups.map(function (a) { return a.name; }) } })];
|
|
78
77
|
case 2:
|
|
79
78
|
userGroups = _a.sent();
|
|
80
79
|
return [2 /*return*/, report_builder_library_collection_1.ReportBuilderLibraries.find({ 'user_groups.id_user_group': { $in: userGroups.map(function (a) { return a._id; }) } }).sort({ name: 1 }).exec()];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/publications/report-builder-libraries.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAwC;AAGxC,sGAA0F;AAC1F,kEAAuD;AACvD,8EAAkE;AAElE,SAAgB,oCAAoC,CAAC,mBAAwC;IAA7F,
|
|
1
|
+
{"version":3,"sources":["../../src/publications/report-builder-libraries.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAwC;AAGxC,sGAA0F;AAC1F,kEAAuD;AACvD,8EAAkE;AAElE,SAAgB,oCA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AAA,CAAC,IAAI,OAAA,CAAC,CAAC,GAAG,EAAL,CAAK,CAAC,EAAC,EAAC,CAAC,CAAC,IAAI,CAAC,EAAC,IAAI,EAAE,CAAC,EAAC,CAAC,CAAC,IAAI,EAAE,EAAC;;;iBAC5H;YACD,WAAW,EAAE,CAAC,OAAO,EAAE,0BAA0B,CAAC;SAClD;KACD,CAAC,CAAC;AACJ,CAAC;AAlCD,oFAkCC","file":"report-builder-libraries.js","sourcesContent":["import SimpleSchema from 'simpl-schema';\nimport { Document } from 'mongoose';\nimport { SubscriptionManager } from '../managers/subscription.manager';\nimport { ReportBuilderLibraries } from '../collections/report-builder-library.collection';\nimport { Users } from '../collections/user.collection';\nimport { UserGroups } from '../collections/user-group.collection';\n\nexport function loadReportBuilderLibraryPublications(subscriptionManager: SubscriptionManager) {\n\tsubscriptionManager.publications({\n\t\treportbuilderlibraries: {\n\t\t\tfunction: () => {\n\t\t\t\treturn ReportBuilderLibraries.find().sort({name: 1}).exec();\n\t\t\t},\n\t\t\tcollections: ['report-builder-libraries']\n\t\t},\n\t\treportbuilderlibrariesWithIdUser: {\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tid_user: {\n\t\t\t\t\ttype: String\n\t\t\t\t}\n\t\t\t}),\n\t\t\tfunction: (id_user: string) => {\n\t\t\t\treturn ReportBuilderLibraries.find({id_user_create: id_user}).sort({name: 1}).exec();\n\t\t\t},\n\t\t\tcollections: ['users', 'report-builder-libraries']\n\t\t},\n\t\treportbuilderlibrariesForUser: {\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tid_user: {\n\t\t\t\t\ttype: String\n\t\t\t\t}\n\t\t\t}),\n\t\t\tfunction: async (id_user: string) => {\n\t\t\t\tlet user = await Users.findById(id_user);\n\t\t\t\tlet userGroups = await UserGroups.find({name: {$in: user.roles.groups.map(a => a.name)}});\n\n\t\t\t\treturn ReportBuilderLibraries.find({'user_groups.id_user_group': {$in: userGroups.map(a => a._id)}}).sort({name: 1}).exec();\n\t\t\t},\n\t\t\tcollections: ['users', 'report-builder-libraries']\n\t\t},\n\t});\n}"]}
|