@resolveio/server-lib 3.2.0 → 3.2.1-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.
@@ -49,7 +49,7 @@ var DefaultSchema = new mongoose_1.Schema(schema, {
49
49
  versionKey: false,
50
50
  timestamps: true
51
51
  });
52
- DefaultSchema.index({ date: 1 }, { expireAfterSeconds: 60 * 60 * 24 * 10 });
52
+ DefaultSchema.index({ date: 1 }, { expireAfterSeconds: 60 * 60 * 24 * 30 });
53
53
  DefaultSchema.index({ type: 1 });
54
54
  DefaultSchema.index({ date: 1, type: 1 });
55
55
  exports.Logs = index_1.ResolveIOServer.getMainDB().model('logs', DefaultSchema);
@@ -21,13 +21,6 @@ var schema = {
21
21
  type: Date,
22
22
  optional: true
23
23
  },
24
- readonly: {
25
- type: Boolean,
26
- optional: true
27
- },
28
- active: {
29
- type: Boolean
30
- },
31
24
  attempts: {
32
25
  type: Number,
33
26
  optional: true
@@ -64,60 +57,78 @@ var schema = {
64
57
  type: String
65
58
  },
66
59
  roles: {
60
+ type: Object
61
+ },
62
+ 'roles.super_admin': {
63
+ type: Boolean
64
+ },
65
+ 'roles.approvals': {
67
66
  type: Array
68
67
  },
69
- 'roles.$': {
68
+ 'roles.approvals.$': {
69
+ type: Object
70
+ },
71
+ 'roles.approvals.$.name': {
70
72
  type: String
71
73
  },
72
- phonenumber: {
73
- type: String,
74
- optional: true
74
+ 'roles.approvals.$.type': {
75
+ type: String
75
76
  },
76
- other: {
77
- type: Object,
78
- blackbox: true,
79
- optional: true
77
+ 'roles.approvals.$.accounting_code': {
78
+ type: String
80
79
  },
81
- assets: {
82
- type: Array,
83
- optional: true
80
+ 'roles.groups': {
81
+ type: Array
84
82
  },
85
- 'assets.$': {
83
+ 'roles.groups.$': {
86
84
  type: Object
87
85
  },
88
- 'assets.$.type': {
86
+ 'roles.groups.$.name': {
89
87
  type: String
90
88
  },
91
- 'assets.$.id_asset': {
92
- type: String
89
+ 'roles.groups.$.views': {
90
+ type: Array
93
91
  },
94
- 'assets.$.asset_number': {
92
+ 'roles.groups.$.views.$': {
95
93
  type: String
96
94
  },
97
- 'assets.$.ownership': {
98
- type: String
95
+ 'roles.groups.$.yard': {
96
+ type: String,
97
+ optional: true
99
98
  },
100
- 'assets.$.ownership_driver': {
99
+ 'roles.notifications': {
100
+ type: Array
101
+ },
102
+ 'roles.notifications.$': {
101
103
  type: String
102
104
  },
103
- 'assets.$.date_start': {
104
- type: Date
105
+ 'roles.miscs': {
106
+ type: Array
105
107
  },
106
- 'assets.$.date_end': {
107
- type: Date,
108
- optional: true
108
+ 'roles.miscs.$': {
109
+ type: String
109
110
  },
110
- id_function: {
111
+ active: Boolean,
112
+ id_customer: {
111
113
  type: String,
112
114
  optional: true
113
115
  },
114
116
  customer: {
115
117
  type: String,
116
- optional: true,
118
+ optional: true
117
119
  },
118
- id_customer: {
120
+ customer_type: {
121
+ type: String,
122
+ optional: true
123
+ },
124
+ phonenumber: {
119
125
  type: String,
126
+ optional: true
127
+ },
128
+ other: {
129
+ type: Object,
120
130
  optional: true,
131
+ blackbox: true
121
132
  }
122
133
  };
123
134
  var DefaultSchema = new mongoose_1.Schema(schema, {
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;
@@ -0,0 +1,6 @@
1
+ export declare class DatabaseManager {
2
+ private _queue;
3
+ private _server;
4
+ constructor(mainServer: any);
5
+ addDatabaseQueue(): void;
6
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var DatabaseManager = /** @class */ (function () {
4
+ function DatabaseManager(mainServer) {
5
+ this._queue = [];
6
+ this._server = mainServer;
7
+ }
8
+ DatabaseManager.prototype.addDatabaseQueue = function () {
9
+ };
10
+ return DatabaseManager;
11
+ }());
12
+ exports.DatabaseManager = DatabaseManager;
@@ -213,7 +213,7 @@ var MethodManager = /** @class */ (function () {
213
213
  _this._runningQueue = false;
214
214
  }
215
215
  }
216
- }, 50);
216
+ }, 25);
217
217
  }
218
218
  MethodManager.prototype.getMainServer = function () {
219
219
  return this._mainServer;
@@ -109,7 +109,7 @@ var QueueMethodManager = /** @class */ (function () {
109
109
  _this._runningQueue = false;
110
110
  }
111
111
  }
112
- }, 50);
112
+ }, 25);
113
113
  }
114
114
  QueueMethodManager.prototype.addMethodToQueue = function (id_ws, id_user, user, messageDate, messageId, method, data) {
115
115
  // console.log('Add Method To Queue', method);
@@ -111,7 +111,7 @@ var SubscriptionManager = /** @class */ (function () {
111
111
  _this._runningQueue = false;
112
112
  }
113
113
  }
114
- }, 50);
114
+ }, 25);
115
115
  }
116
116
  // Add all files to publications private object
117
117
  SubscriptionManager.prototype.publications = function (method) {
@@ -525,7 +525,7 @@ var SubscriptionManager = /** @class */ (function () {
525
525
  }
526
526
  }
527
527
  });
528
- }, 1000);
528
+ }, 25);
529
529
  };
530
530
  SubscriptionManager.prototype.resendPubsForDelete = function (collection) {
531
531
  var that = this;
@@ -91,7 +91,7 @@ var SupportManager = /** @class */ (function () {
91
91
  _this._runningQueue = false;
92
92
  }
93
93
  }
94
- }, 250);
94
+ }, 25);
95
95
  }
96
96
  SupportManager.prototype.getMainServer = function () {
97
97
  return this._mainServer;
@@ -1,14 +1,31 @@
1
1
  import { CollectionDocument } from './collection-document.model';
2
2
  export interface UserModel extends CollectionDocument {
3
- attempts: number;
4
- last: Date;
5
- services?: any;
6
3
  fullname: string;
4
+ roles: UserRoleModel;
7
5
  username?: string;
8
6
  email?: string;
9
- roles?: string[];
10
7
  active?: boolean;
11
- readonly?: boolean;
8
+ services?: any;
9
+ id_customer?: string;
10
+ customer?: string;
11
+ customer_type?: string;
12
12
  phonenumber?: string;
13
13
  other?: object;
14
14
  }
15
+ export interface UserRoleModel {
16
+ super_admin: boolean;
17
+ approvals: UserRoleApprovalModel[];
18
+ groups: UserRoleGroupModel[];
19
+ notifications: string[];
20
+ miscs: string[];
21
+ }
22
+ export interface UserRoleApprovalModel {
23
+ accounting_code: string;
24
+ type: string;
25
+ name: string;
26
+ }
27
+ export interface UserRoleGroupModel {
28
+ name: string;
29
+ views: string[];
30
+ yard?: string;
31
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@resolveio/server-lib",
3
- "version": "3.2.0",
3
+ "version": "3.2.1-newrole",
4
4
  "description": "",
5
5
  "main": "index.ts",
6
6
  "scripts": {
package/server-app.js CHANGED
@@ -626,7 +626,7 @@ var ResolveIOMainServer = /** @class */ (function () {
626
626
  case 5: return [2 /*return*/];
627
627
  }
628
628
  });
629
- }); }, 100);
629
+ }); }, 25);
630
630
  };
631
631
  ResolveIOMainServer.prototype.unsubscribeWS = function (ws) {
632
632
  this._subscriptionManager.unsubscribeAll(ws);