@kipicore/dbcore 1.1.384 → 1.1.385

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.
@@ -0,0 +1,2 @@
1
+ export function up(queryInterface: any, Sequelize: any): Promise<void>;
2
+ export function down(queryInterface: any): Promise<void>;
@@ -0,0 +1,22 @@
1
+ 'use strict';
2
+ const up = async (queryInterface, Sequelize) => {
3
+ const table = await queryInterface.describeTable('coin_purchase_offers');
4
+ if (!table.validity_in_days) {
5
+ await queryInterface.addColumn('coin_purchase_offers', 'validity_in_days', {
6
+ type: Sequelize.NUMBER,
7
+ allowNull: false,
8
+ defaultValue: 0,
9
+ field: 'validity_in_days',
10
+ });
11
+ }
12
+ };
13
+ const down = async (queryInterface) => {
14
+ const table = await queryInterface.describeTable('coin_purchase_offers');
15
+ if (table.validity_in_days) {
16
+ await queryInterface.removeColumn('coin_purchase_offers', 'validity_in_days');
17
+ }
18
+ };
19
+ module.exports = {
20
+ up,
21
+ down,
22
+ };
@@ -13,4 +13,5 @@ export interface ICoinPurchaseOfferModelAttributes extends IDefaultAttributes {
13
13
  gstCharge: number;
14
14
  payableAmount: number;
15
15
  gstPercentage: number;
16
+ validityInDays: number;
16
17
  }
@@ -174,3 +174,4 @@ export * from './internalMarkInterface';
174
174
  export * from './finalMarkSheetInterface';
175
175
  export * from './subjectInternalMarkInterface';
176
176
  export * from './pdcChequeConfigurationInterface';
177
+ export * from './modulePriceInterface';
@@ -190,3 +190,4 @@ __exportStar(require("./internalMarkInterface"), exports);
190
190
  __exportStar(require("./finalMarkSheetInterface"), exports);
191
191
  __exportStar(require("./subjectInternalMarkInterface"), exports);
192
192
  __exportStar(require("./pdcChequeConfigurationInterface"), exports);
193
+ __exportStar(require("./modulePriceInterface"), exports);
@@ -0,0 +1,15 @@
1
+ import { Document } from 'mongoose';
2
+ import { IDefaultAttributes } from './commonInterface';
3
+ import { APP_TYPE } from '../constants';
4
+ export interface IModulePriceList {
5
+ moduleId: string;
6
+ price: number;
7
+ validityInDays: number;
8
+ expiredDate?: Date;
9
+ }
10
+ export interface IModulePriceModelAttributes extends IDefaultAttributes, Document {
11
+ id: string;
12
+ title: string;
13
+ moduleList: IModulePriceList[];
14
+ appType: APP_TYPE;
15
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -59,3 +59,4 @@ export { default as AppAnalyticsEventModel } from './appAnalyticsEventModel';
59
59
  export { default as MarkSheetConfigurationModel } from './markSheetConfigurationModel';
60
60
  export { default as FinalMarkSheetModel } from './finalMarkSheetModel';
61
61
  export { default as PdcChequeConfigurationModel } from './pdcChequeConfigurationModel';
62
+ export { default as ModulePriceModel } from './modulePriceModel';
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.PollSelectionModel = exports.CreatePollModel = exports.SheetFieldMappingModel = exports.FileUploadUserDetails = exports.CompetitionUsersModel = exports.CompetitionGroupModel = exports.CompetitionModel = exports.CampusCarnivalModel = exports.AppointmentHistoryModel = exports.AppointmentModel = exports.SeatingArrangementModel = exports.AssignFileModel = exports.ThemeModel = exports.BDayWishModel = exports.AdditionalDetailModel = exports.CanteenModel = exports.WalletTransactionModel = exports.VideoAnalystModel = exports.UserSchoolMetaModel = exports.UserInstituteMetaModel = exports.UserDetailsModel = exports.UniqueNumberCounterModel = exports.TaskManagementModel = exports.SubscriptionPlanModel = exports.SubjectIndexModel = exports.ReplaceTeacherModel = exports.PlannerModel = exports.PhotosGalleryModel = exports.JobApplyModel = exports.InvoiceModel = exports.InquiryModel = exports.InformationSupportModel = exports.HolidayModel = exports.GenerateIdCardModel = exports.FeedBackModel = exports.FeeReminderTypeModel = exports.ExamModel = exports.ExamHasAnswerSheetModel = exports.ExamGroupModel = exports.EventModel = exports.DashboardManagementModel = exports.DailyBookModel = exports.ColumnModel = exports.CertificatesManagementModel = exports.CertificatesHistoryModel = exports.CareerModel = exports.BlogModel = exports.AttendanceModel = exports.ApprovalRequestModel = exports.connectMongoDb = void 0;
7
- exports.PdcChequeConfigurationModel = exports.FinalMarkSheetModel = exports.MarkSheetConfigurationModel = exports.AppAnalyticsEventModel = exports.GrantAndDonationModel = exports.TicketRaiseModel = exports.EducationOfficerModel = exports.InstituteFeeModel = exports.SchoolFee1Model = exports.FeeConfigModel = exports.EventTemplatesModel = void 0;
7
+ exports.ModulePriceModel = exports.PdcChequeConfigurationModel = exports.FinalMarkSheetModel = exports.MarkSheetConfigurationModel = exports.AppAnalyticsEventModel = exports.GrantAndDonationModel = exports.TicketRaiseModel = exports.EducationOfficerModel = exports.InstituteFeeModel = exports.SchoolFee1Model = exports.FeeConfigModel = exports.EventTemplatesModel = void 0;
8
8
  const mongoose_1 = __importDefault(require("mongoose"));
9
9
  const env_1 = require("../../configs/env");
10
10
  const transformIdInQueryPlugin_1 = __importDefault(require("./plugin/transformIdInQueryPlugin"));
@@ -145,3 +145,5 @@ var finalMarkSheetModel_1 = require("./finalMarkSheetModel");
145
145
  Object.defineProperty(exports, "FinalMarkSheetModel", { enumerable: true, get: function () { return __importDefault(finalMarkSheetModel_1).default; } });
146
146
  var pdcChequeConfigurationModel_1 = require("./pdcChequeConfigurationModel");
147
147
  Object.defineProperty(exports, "PdcChequeConfigurationModel", { enumerable: true, get: function () { return __importDefault(pdcChequeConfigurationModel_1).default; } });
148
+ var modulePriceModel_1 = require("./modulePriceModel");
149
+ Object.defineProperty(exports, "ModulePriceModel", { enumerable: true, get: function () { return __importDefault(modulePriceModel_1).default; } });
@@ -0,0 +1,4 @@
1
+ import { Model } from 'mongoose';
2
+ import { IModulePriceModelAttributes } from '../../interfaces/modulePriceInterface';
3
+ declare const ModulePriceModel: Model<IModulePriceModelAttributes>;
4
+ export default ModulePriceModel;
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ const mongoose_1 = __importStar(require("mongoose"));
37
+ const constants_1 = require("../../constants");
38
+ const psql_1 = require("../psql");
39
+ const modulePriceModelSchema = new mongoose_1.Schema({
40
+ title: { type: String, required: true },
41
+ moduleList: [
42
+ {
43
+ moduleId: {
44
+ type: String,
45
+ required: true,
46
+ validate: {
47
+ validator: async function (value) {
48
+ const appType = this.ownerDocument().appType;
49
+ const module = await psql_1.ModuleModel.findOne({
50
+ where: {
51
+ id: value,
52
+ isDefault: true,
53
+ roleId: null,
54
+ appType,
55
+ },
56
+ });
57
+ return !!module;
58
+ },
59
+ message: 'Invalid moduleId: module not found or not allowed',
60
+ },
61
+ },
62
+ price: { type: Number, required: true },
63
+ validityInDays: { type: Number, required: true },
64
+ },
65
+ ],
66
+ appType: {
67
+ type: String,
68
+ enum: Object.values(constants_1.APP_TYPE),
69
+ required: true,
70
+ },
71
+ createdBy: { type: String, required: false },
72
+ updatedBy: { type: String, required: false },
73
+ deletedBy: { type: String, required: false },
74
+ }, {
75
+ timestamps: true,
76
+ versionKey: false,
77
+ });
78
+ const ModulePriceModel = mongoose_1.default.model('module_price', modulePriceModelSchema);
79
+ exports.default = ModulePriceModel;
@@ -15,6 +15,7 @@ export declare class CoinPurchaseOfferModel extends Model<ICoinPurchaseOfferMode
15
15
  gstCharge: number;
16
16
  payableAmount: number;
17
17
  gstPercentage: number;
18
+ validityInDays: number;
18
19
  createdBy: string;
19
20
  updatedBy: string;
20
21
  deletedBy: string;
@@ -83,6 +83,11 @@ CoinPurchaseOfferModel.init({
83
83
  field: 'payable_amount',
84
84
  allowNull: false,
85
85
  },
86
+ validityInDays: {
87
+ type: sequelize_1.DataTypes.NUMBER,
88
+ field: 'validity_in_days',
89
+ allowNull: false,
90
+ },
86
91
  }, {
87
92
  modelName: 'CoinPurchaseOfferModel',
88
93
  tableName: 'coin_purchase_offers',
@@ -165,3 +165,4 @@ export * from './internalMarkType';
165
165
  export * from './finalMarkSheetType';
166
166
  export * from './subjectInternalMarkType';
167
167
  export * from './pdcChequeConfigurationType';
168
+ export * from './modulePriceType';
@@ -181,3 +181,4 @@ __exportStar(require("./internalMarkType"), exports);
181
181
  __exportStar(require("./finalMarkSheetType"), exports);
182
182
  __exportStar(require("./subjectInternalMarkType"), exports);
183
183
  __exportStar(require("./pdcChequeConfigurationType"), exports);
184
+ __exportStar(require("./modulePriceType"), exports);
@@ -0,0 +1,2 @@
1
+ import { IModulePriceModelAttributes } from '../interfaces/modulePriceInterface';
2
+ export type TModulePriceModelCreationAttributes = Omit<IModulePriceModelAttributes, 'id'>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kipicore/dbcore",
3
- "version": "1.1.384",
3
+ "version": "1.1.385",
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",