@autofleet/sadot 0.5.4-beta.13 → 0.5.4-beta.15

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.
@@ -37,7 +37,7 @@ const initTables = async (sequelize, getUser, enrichUserPermissions) => {
37
37
  ...Object.keys(user.permissions.businessModels),
38
38
  ...Object.keys(user.permissions.demandSources),
39
39
  ];
40
- if (enrichUserPermissions) {
40
+ if (enrichUserPermissions && entityIds && Array.isArray(entityIds)) {
41
41
  entityId.push(...entityIds);
42
42
  }
43
43
  logger_1.default.info('custom fields scope added updated entity:', { entityId });
@@ -9,7 +9,7 @@ const findAll = (where, options = { withDisabled: false }) => {
9
9
  const queryModel = options.withDisabled
10
10
  ? models_1.CustomFieldDefinition.unscoped()
11
11
  : models_1.CustomFieldDefinition;
12
- return queryModel.scope({ method: ['userScope', where] }).findAll({
12
+ return queryModel.scope({ method: ['userScope', where.entityId] }).findAll({
13
13
  where,
14
14
  transaction: options.transaction,
15
15
  raw: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autofleet/sadot",
3
- "version": "0.5.4-beta.13",
3
+ "version": "0.5.4-beta.15",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -32,7 +32,7 @@ const initTables = async (sequelize: Sequelize, getUser, enrichUserPermissions):
32
32
  ...Object.keys(user.permissions.businessModels),
33
33
  ...Object.keys(user.permissions.demandSources),
34
34
  ];
35
- if (enrichUserPermissions) {
35
+ if (enrichUserPermissions && entityIds && Array.isArray(entityIds)) {
36
36
  entityId.push(...entityIds);
37
37
  }
38
38
  logger.info('custom fields scope added updated entity:', { entityId });
@@ -12,7 +12,7 @@ export const findAll = (
12
12
  const queryModel = options.withDisabled
13
13
  ? CustomFieldDefinition.unscoped()
14
14
  : CustomFieldDefinition;
15
- return queryModel.scope({ method: ['userScope', where] }).findAll({
15
+ return queryModel.scope({ method: ['userScope', where.entityId] }).findAll({
16
16
  where,
17
17
  transaction: options.transaction,
18
18
  raw: true,