@kipicore/dbcore 1.1.504 → 1.1.506

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.
@@ -1,5 +1,5 @@
1
1
  import { IDefaultAttributes } from './commonInterface';
2
- import { COMMAN_STATUS } from '../constants/app';
2
+ import { APP_TYPE, COMMAN_STATUS, USER_TYPES } from '../constants/app';
3
3
  import { Document } from 'mongoose';
4
4
  export interface ICommonBannerAndSlimSchema {
5
5
  time: number;
@@ -21,4 +21,6 @@ export interface IAdvertisementModelAttributes extends IDefaultAttributes, Docum
21
21
  startDate: Date;
22
22
  endDate: Date;
23
23
  duration: ITimeDurationSchema[];
24
+ appType: APP_TYPE[];
25
+ userType: USER_TYPES[];
24
26
  }
@@ -84,6 +84,14 @@ const advertisementSchema = new mongoose_1.Schema({
84
84
  type: [TimeDurationSchema],
85
85
  required: false,
86
86
  },
87
+ appType: {
88
+ type: [String],
89
+ required: false,
90
+ },
91
+ userType: {
92
+ type: [String],
93
+ required: false,
94
+ },
87
95
  createdBy: {
88
96
  type: String,
89
97
  },
@@ -47,15 +47,13 @@ const modulePriceModelSchema = new mongoose_1.Schema({
47
47
  validate: {
48
48
  validator: async function (value) {
49
49
  const appType = this.ownerDocument().appType;
50
- const module = await psql_1.ModuleModel.findOne({
50
+ const module = await psql_1.PermissionModel.findAll({
51
51
  where: {
52
52
  code: { [sequelize_1.Op.in]: value },
53
- isDefault: true,
54
- roleId: null,
55
53
  appType,
56
54
  },
57
55
  });
58
- return !!module;
56
+ return module.length === value.length;
59
57
  },
60
58
  message: 'Invalid module code: module not found or not allowed',
61
59
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kipicore/dbcore",
3
- "version": "1.1.504",
3
+ "version": "1.1.506",
4
4
  "description": "Reusable DB core package with Postgres, MongoDB, models, services, interfaces, and types",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",