@resolveio/server-lib 5.2.7 → 5.2.9-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.
@@ -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
- phonenumber: {
74
- type: String,
75
- optional: true
75
+ 'roles.approvals.$.type': {
76
+ type: String
76
77
  },
77
- other: {
78
- type: Object,
79
- blackbox: true,
80
- optional: true
78
+ 'roles.approvals.$.accounting_code': {
79
+ type: String
81
80
  },
82
- assets: {
83
- type: Array,
84
- optional: true
81
+ 'roles.groups': {
82
+ type: Array
85
83
  },
86
- 'assets.$': {
84
+ 'roles.groups.$': {
87
85
  type: Object
88
86
  },
89
- 'assets.$.type': {
87
+ 'roles.groups.$.name': {
90
88
  type: String
91
89
  },
92
- 'assets.$.id_asset': {
93
- type: String
90
+ 'roles.groups.$.views': {
91
+ type: Array
94
92
  },
95
- 'assets.$.asset_number': {
93
+ 'roles.groups.$.views.$': {
96
94
  type: String
97
95
  },
98
- 'assets.$.ownership': {
99
- type: String
96
+ 'roles.groups.$.yard': {
97
+ type: String,
98
+ optional: true
99
+ },
100
+ 'roles.notifications': {
101
+ type: Array
100
102
  },
101
- 'assets.$.ownership_driver': {
103
+ 'roles.notifications.$': {
102
104
  type: String
103
105
  },
104
- 'assets.$.date_start': {
105
- type: Date
106
+ 'roles.miscs': {
107
+ type: Array
106
108
  },
107
- 'assets.$.date_end': {
108
- type: Date,
109
- optional: true
109
+ 'roles.miscs.$': {
110
+ type: String
110
111
  },
111
- id_function: {
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,
package/fixtures/init.js CHANGED
@@ -37,8 +37,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
37
37
  Object.defineProperty(exports, "__esModule", { value: true });
38
38
  var app_version_collection_1 = require("../collections/app-version.collection");
39
39
  var logged_in_users_collection_1 = require("../collections/logged-in-users.collection");
40
- var active_subscription_collection_1 = require("../collections/active-subscription.collection");
41
40
  var mongoose_1 = require("mongoose");
41
+ var active_subscription_collection_1 = require("../collections/active-subscription.collection");
42
42
  function loadServerInit() {
43
43
  return __awaiter(this, void 0, void 0, function () {
44
44
  var appVersion;
package/methods/aws.js CHANGED
@@ -65,34 +65,45 @@ function loadAWSMethods(methodManager) {
65
65
  function: function (fileName, fileData, fileSize, fileOrder, fileType) {
66
66
  var _this = this;
67
67
  var that = this;
68
- return new Promise(function (resolve, reject) {
69
- if (fileName) {
70
- var key_1 = 'uploads/' + Date.now() + '-' + (pdfCnt++) + '-' + fileName;
71
- if (fileData.split(',')[0].split(':')[1].split(';')[0] === 'application/pdf') {
72
- _this.callMethodInternal.call(_this, 'compressAndUploadPDF', key_1, fileData.replace('data:' + fileData.split(',')[0].split(':')[1].split(';')[0] + ';base64,', ''));
73
- file_collection_1.Files.create({
74
- _id: mongoose_1.Types.ObjectId().toHexString(), __v: 0, name: fileName, size: fileSize, key: key_1, order: fileOrder, type: fileType
75
- }).then(function (resFile) {
76
- resolve(resFile);
77
- }, function (errFile) { return reject(errFile); });
78
- }
79
- else {
80
- var newParams = { Bucket: that.serverConfig.AWSBUCKET, Key: key_1, Body: Buffer.from(fileData.replace('data:' + fileData.split(',')[0].split(':')[1].split(';')[0] + ';base64,', ''), 'base64'), ACL: 'private', ContentType: fileData.split(',')[0].split(':')[1].split(';')[0], ContentDisposition: 'inline' };
81
- that.getAWS().upload(newParams, function (err, res) {
82
- if (err) {
83
- reject(err);
84
- }
85
- else if (res) {
86
- file_collection_1.Files.create({
87
- _id: mongoose_1.Types.ObjectId().toHexString(), __v: 0, name: fileName, size: fileSize, key: key_1, order: fileOrder, type: fileType
88
- }).then(function (resFile) {
89
- resolve(resFile);
90
- }, function (errFile) { return reject(errFile); });
91
- }
92
- });
68
+ return new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
69
+ var key_1, file, newParams;
70
+ return __generator(this, function (_a) {
71
+ if (fileName) {
72
+ key_1 = 'uploads/' + Date.now() + '-' + (pdfCnt++) + '-' + fileName;
73
+ if (fileData.split(',')[0].split(':')[1].split(';')[0] === 'application/pdf') {
74
+ file = {
75
+ _id: mongoose_1.Types.ObjectId().toHexString(),
76
+ __v: 0,
77
+ name: fileName,
78
+ size: fileSize,
79
+ key: key_1,
80
+ order: fileOrder,
81
+ type: fileType
82
+ };
83
+ file_collection_1.Files.create(file).then(function (resFile) {
84
+ resolve(resFile);
85
+ }, function (errFile) { return reject(errFile); });
86
+ this.callMethodInternal.call(this, 'compressAndUploadPDF', file._id, fileName, key_1, fileData.replace('data:' + fileData.split(',')[0].split(':')[1].split(';')[0] + ';base64,', ''));
87
+ }
88
+ else {
89
+ newParams = { Bucket: that.serverConfig.AWSBUCKET, Key: key_1, Body: Buffer.from(fileData.replace('data:' + fileData.split(',')[0].split(':')[1].split(';')[0] + ';base64,', ''), 'base64'), ACL: 'private', ContentType: fileData.split(',')[0].split(':')[1].split(';')[0], ContentDisposition: 'inline' };
90
+ that.getAWS().upload(newParams, function (err, res) {
91
+ if (err) {
92
+ reject(err);
93
+ }
94
+ else if (res) {
95
+ file_collection_1.Files.create({
96
+ _id: mongoose_1.Types.ObjectId().toHexString(), __v: 0, name: fileName, size: fileSize, key: key_1, order: fileOrder, type: fileType
97
+ }).then(function (resFile) {
98
+ resolve(resFile);
99
+ }, function (errFile) { return reject(errFile); });
100
+ }
101
+ });
102
+ }
93
103
  }
94
- }
95
- });
104
+ return [2 /*return*/];
105
+ });
106
+ }); });
96
107
  }
97
108
  },
98
109
  uploadNonPDFFileAndSave: {
package/methods/pdf.js CHANGED
@@ -4,6 +4,7 @@ var fs = require('fs');
4
4
  var request = require("request");
5
5
  var mongoose_1 = require("mongoose");
6
6
  var simpl_schema_1 = require("simpl-schema");
7
+ var file_collection_1 = require("../collections/file.collection");
7
8
  var pdfCnt = 0;
8
9
  function loadPDFMethods(methodManager) {
9
10
  methodManager.methods({
@@ -122,6 +123,12 @@ function loadPDFMethods(methodManager) {
122
123
  compressAndUploadPDF: {
123
124
  skipQueue: true,
124
125
  check: new simpl_schema_1.default({
126
+ id_file: {
127
+ type: String
128
+ },
129
+ fileName: {
130
+ type: String
131
+ },
125
132
  filePath: {
126
133
  type: String
127
134
  },
@@ -129,7 +136,7 @@ function loadPDFMethods(methodManager) {
129
136
  type: String
130
137
  }
131
138
  }),
132
- function: function (filePath, fileContent) {
139
+ function: function (id_file, fileName, filePath, fileContent) {
133
140
  var _this = this;
134
141
  return new Promise(function (resolve, reject) {
135
142
  _this.callMethodInternal.call(_this, 'getCCProcessURL').then(function (resCC) {
@@ -144,6 +151,7 @@ function loadPDFMethods(methodManager) {
144
151
  mode: 'compress',
145
152
  input: 'base64',
146
153
  file: fileContent,
154
+ filename: fileName,
147
155
  outputformat: 'pdf',
148
156
  wait: true,
149
157
  output: {
@@ -159,6 +167,7 @@ function loadPDFMethods(methodManager) {
159
167
  }, function (error, response, body) {
160
168
  if (!error) {
161
169
  if (body.output.size) {
170
+ file_collection_1.Files.updateOne({ _id: id_file }, { $set: { size: body.output.size } }).exec();
162
171
  resolve();
163
172
  }
164
173
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@resolveio/server-lib",
3
- "version": "5.2.7",
3
+ "version": "5.2.9-newrole",
4
4
  "description": "",
5
5
  "main": "index.ts",
6
6
  "scripts": {