@kipicore/dbcore 1.1.505 → 1.1.507

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,6 +1,6 @@
1
1
  import { Document } from 'mongoose';
2
2
  import { IDefaultAttributes } from './commonInterface';
3
- import { APP_ANALYTICS_EVENT_TYPE, DEVICE_TYPE_APP_ANALYTICS } from '../constants/app';
3
+ import { APP_ANALYTICS_EVENT_TYPE, APP_TYPE, DEVICE_TYPE_APP_ANALYTICS } from '../constants/app';
4
4
  export interface IDeviceInfoAttributionSchema {
5
5
  id: string;
6
6
  platform: DEVICE_TYPE_APP_ANALYTICS;
@@ -29,4 +29,5 @@ export interface IAppAnalyticsEventModelAttributes extends IDefaultAttributes, D
29
29
  usedTime?: number;
30
30
  createdAt: Date;
31
31
  subscriptionPlanId?: string;
32
+ appType: APP_TYPE;
32
33
  }
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  const mongoose_1 = __importStar(require("mongoose"));
37
+ const constants_1 = require("../../constants");
37
38
  const deviceInfoSchema = new mongoose_1.Schema({
38
39
  id: {
39
40
  type: String,
@@ -124,6 +125,10 @@ const appAnalyticsEvent = new mongoose_1.Schema({
124
125
  default: 1,
125
126
  required: false,
126
127
  },
128
+ appType: {
129
+ type: String,
130
+ default: constants_1.APP_TYPE.SCHOOL_APP,
131
+ },
127
132
  }, {
128
133
  timestamps: true,
129
134
  versionKey: false,
@@ -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.505",
3
+ "version": "1.1.507",
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",