@kipicore/dbcore 1.1.417 → 1.1.419

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.
@@ -180,6 +180,23 @@ export declare enum OFFER_NAME {
180
180
  FEE = "FEE",
181
181
  COURSE = "COURSE"
182
182
  }
183
+ export declare enum OFFER_APPLICABLE_TO {
184
+ STUDENT = "STUDENT",
185
+ BATCH = "BATCH",
186
+ ALL = "ALL"
187
+ }
188
+ export declare enum OFFER_CONDITION_TYPE {
189
+ MERIT = "MERIT",
190
+ EARLY_PAYMENT = "EARLY_PAYMENT",
191
+ FULL_PAYMENT = "FULL_PAYMENT",
192
+ CUSTOM = "CUSTOM"
193
+ }
194
+ export declare enum OFFER_STATUS {
195
+ PENDING = "PENDING",
196
+ ACCEPTED = "ACCEPTED",
197
+ REJECTED = "REJECTED",
198
+ CANCELLED = "CANCELLED"
199
+ }
183
200
  export declare enum LEAVE_TYPE {
184
201
  FULL_DAY = "FULL_DAY",
185
202
  FIRST_HALF = "FIRST_HALF",
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NO_TYPE = exports.ADMISSION_TYPE = exports.INSTITUTE_ENTITY_TYPE_SEQUENCE = exports.INSTITUTE_ENTITY_TYPE_STATUS = exports.INSTITUTE_ENTITY_STATUS = exports.SCHOOL_SHIFT = exports.WORKIN_DAY_STATUS = exports.LEAVE_STATUS = exports.LEAVE = exports.LEAVE_TYPE = exports.OFFER_NAME = exports.OFFER_TYPE = exports.INSTITUTE_STATUS = exports.FEE_PAYMENT_STATUS = exports.STUDENT_FEE_COLLECTION_STATUS = exports.PAYMENT_TYPE = exports.FEE_TYPE_FREQUENCY = exports.FEE_REMINDER_SETTING_FREQUENCY = exports.FEE_REMINDER_SETTING_TYPE = exports.TERM_DURATION = exports.FEE_REMINDER_SETTING_STATUS = exports.GREETING_TYPE = exports.TRIP_TYPE = exports.USER_COURSE_STATUS = exports.COMMAN_STATUS = exports.TOKEN_TYPES = exports.USER_TYPES = exports.ACADEMIC_CALENDARS_TYPE = exports.RETURN_STATUS = exports.ASSIGN_TYPE = exports.GENDER = exports.SCHOOL_SUB_TYPE = exports.SCHOOL_TYPE = exports.ATTENDANCE_TYPE = exports.ATTENDANCE_STATUS = exports.USER_INVENTORY_ACTION = exports.INVENTORY_TYPE = exports.USER_STATUS = exports.PDF_MICRO_SERVICE_END_POINT = exports.MOBILE_VERIFICATION = exports.EMAIL_VERIFICATION = exports.PAGINATION_UPDATE_ORDER = exports.PAGINATION_ORDER = exports.DEFAULT_BATCH_TITLE = exports.DEFAULT_CLASS_ROOM_TITLE = exports.PAGINATION = exports.USER_INSTITUTE_META_STATUS_REJECTED_COUNT = exports.ONE_THOUSAND = exports.ONE_HUNDRED = exports.SIXTY = void 0;
4
- exports.QDC_NAME = exports.USER_PAYOUT_TYPE = exports.PARENTS_CHILDREN_CURRENT = exports.CHAPTER_INDEX_FILE_TYPE = exports.FEE_HISTORY_STATUS = exports.USER_CHAPTER_INDEX_STATUS = exports.CHAPTER_INDEX_TYPE = exports.IMAGE__NAME = exports.INQUIRY_STATUS = exports.INQUIRY_REFERRED_BY = exports.EXAM_GROUP_STANDARD_RESULT = exports.EXAM_GROUP_STATUS = exports.SUBJECT_INDEX_TYPE = exports.LECTURE_SLOT_DURATION = exports.EXAM_ANSWER_SHEET_QUESTION_RESULT = exports.PAYMENT_TERMS_TYPE = exports.PAYMENT_TERMS_STATUS = exports.EXAM_ANSWER_SHEET_RESULT_TYPE = exports.EXAM_ANSWER_SHEET_RESULT_STATUS = exports.EXAM_ANSWER_SHEET_STATUS = exports.EXAM_VALID_ANSWER_TYPE = exports.EXAM_ANSWER_SELECTION_TYPE = exports.EXAM_STATUS = exports.COURSE_STATUS = exports.EXAM_MODE = exports.GREETING_STATUS = exports.USER_HAS_ANNOUCEMENT_STATUS = exports.ANNOUCEMENT_STATUS = exports.TYPE_OF_USER = exports.ANNOUCEMENT_SCHEDULE_TYPE = exports.APPROVE_REQUEST_STATUS = exports.APPROVE_REQUEST_TYPE = exports.TYPE_MANAGEMENT_STATUS = exports.TYPE_MANAGEMENT_TYPE = exports.FILE_TYPE = exports.ACADEMIC_CALENDARS_STATUS = exports.BANNER_TYPE = exports.APP_TYPE = exports.FEED_BACK_STATUS = exports.FEED_BACK_TYPE = exports.FACILITY_TYPE = exports.EMPLOYMENT_TYPE = exports.USER_INSTITUTE_META_STATUS = exports.USER_HAS_PARENT_STATUS = exports.GUARDIANS_USER_META_MODEL_STATUS = exports.DISABILITY_TYPE = exports.WORK_CATEGORY = exports.BLOG_STATUS = exports.WORK_TYPE = exports.USER_DETAILS = void 0;
5
- exports.LANGUAGES = exports.HOME_WORK_STATUS = exports.SOCKET_EVENTS = exports.SUBSCRIPTION_PLAN_FILES_TYPE = exports.VALID_CURRENCY = exports.SUBSCRIPTION_PLAN_TYPE = exports.SUBSCRIPTION_PLAN_CHARGE_INTERVAL = exports.DISCOUNT_TYPE = exports.CONTACT_FEED_BACK_TYPE = exports.PLANNER_SYNC_STATUS = exports.NOTIFICATION_ACTION = exports.NOTIFICATION_MODULE_TYPE = exports.NOTIFICATION_STATUS = exports.NOTIFICATION_TYPE = exports.PROJECT_ASSESSMENT_OPTION_STATUS = exports.USER_BOOK_ASSESSMENT_STATUS = exports.BOOK_ASSESSMENT_DATE_STATUS = exports.TASK_MANAGEMENT_STATUS = exports.USER_DETAILS_FILED = exports.DEVICE_TYPE = exports.templateKeyWord = exports.bankAccountRegexMap = exports.EMAIL_SUBJECTS = exports.PDF_TEMPLATES = exports.EMAIL_TEMPLATES = exports.PINCODE_API_URL = exports.APPLE_AUTH = exports.META_AUTH = exports.GOOGLE_AUTH = exports.API_URL = exports.DEFAULT_USER_LOGO = exports.DEFAULT_INSTITUTED_LOGO = exports.UPLOAD_PATH = exports.SVG_URL_PATH = exports.TO_DO_STATUS = exports.LECTURE_TITLE = exports.LECTURE_STATUS = exports.SCHOOL_INFORMATION_STEP = exports.CASTE = exports.RELIGION_CASTE = exports.NATIONALITY = exports.CATEGORY = exports.IS_PRINCIPAL = exports.FEE_TYPE = exports.BOOLEAN_STATUS = exports.PROPERTY_STATUS = exports.DESIGNATION_OF_PERSON = exports.TRUST_REGISTERED_UNDER = exports.TRUST_TYPE = exports.SVA_NAME = void 0;
6
- exports.HOME_WORK_TYPE = exports.STUDENT_FEE_PROCESS_STATUS = exports.FEE_COLLECTION_TYPE = exports.BANK_ACCOUNT_TYPE = exports.STUDENT_LEAVE_TYPE = exports.STUDENT_LEAVE_STATUS = exports.CERTIFICATE_TYPE = exports.CERTIFICATE_FOR = exports.SHEET_TYPE = exports.COMPETITION_USER_ROLE = exports.RESULT_STATUS = exports.COMPETITION_STATUS = exports.STATUS_BY_PARENTS = exports.COMPETITION_TYPE = exports.CAMPUS_CARNIVAL_STATUS = exports.COMPETITION_TYPE_CATEGORY = exports.COMPETITION_EVENTS = exports.PAYMENT_STATUS = exports.INCOME_EXPENSE_SOURCE = exports.INCOME_EXPENSE_TYPE = exports.APPOINTMENT_STATUS = exports.MAINTENANCE_MODULE_NAME = exports.MAINTENANCE_TYPE = exports.MAINTENANCE_MODE = exports.ASSIGN_FILE_TYPE = exports.LOST_FOUND_ITEM_STATUS = exports.PAYMENT_PROCESSING_CALLBACK_URL = exports.PAYMENT_PROCESSING_PAGE_URL = exports.PAYMENT_PROCESSING_STATUS_URL = exports.WALLET_TRANSACTION_VALID_DATE_FOR_OTP_IN_MINUTES = exports.WALLET_TRANSACTION_VALID_DATE_IN_MINUTES = exports.PAYMENT_METHODS = exports.PAYMENT_GATEWAY_TYPES = exports.JOB_ACTION = exports.ONE_GB_BYTES = exports.CHARGE_PER_TRANSACTION_ITEM_UNIT = exports.INSTITUTE_SUBSCRIPTION_PLAN_STATUS = exports.WALLET_TRANSACTION_USERS_TYPE = exports.WALLET_HISTORY_STATUS = exports.WALLET_HISTORY_ACTION = exports.WALLET_HISTORY_ITEM_TYPE = exports.WALLET_HISTORY_TYPE = exports.REPLACE_TEACHER_STATUS = exports.TEACHER_TYPE = exports.INVOICE_TYPE = exports.PURCHASE_STATUS = exports.COLUMN_LIST_TITLE = exports.INVOICE_PAYMENT_TYPE = exports.PDF_CHEQUE_FREQUENCY = exports.PDF_CHEQUE_STATUS = void 0;
7
- exports.SEARCH_TYPE = exports.REPORT_TYPE = exports.DEVICE_TYPE_APP_ANALYTICS = exports.APP_ANALYTICS_EVENT_TYPE = exports.EXPORT_SHEET_TYPE = exports.GRANT_AND_DONATION_TYPE = exports.TICKET_RAISE_PRIORITY = exports.TICKET_RAISE_STATUS = exports.TERM_AND_CONDITION_STATUS = exports.EDUCATION_OFFICER_TYPE = void 0;
3
+ exports.INSTITUTE_ENTITY_TYPE_STATUS = exports.INSTITUTE_ENTITY_STATUS = exports.SCHOOL_SHIFT = exports.WORKIN_DAY_STATUS = exports.LEAVE_STATUS = exports.LEAVE = exports.LEAVE_TYPE = exports.OFFER_STATUS = exports.OFFER_CONDITION_TYPE = exports.OFFER_APPLICABLE_TO = exports.OFFER_NAME = exports.OFFER_TYPE = exports.INSTITUTE_STATUS = exports.FEE_PAYMENT_STATUS = exports.STUDENT_FEE_COLLECTION_STATUS = exports.PAYMENT_TYPE = exports.FEE_TYPE_FREQUENCY = exports.FEE_REMINDER_SETTING_FREQUENCY = exports.FEE_REMINDER_SETTING_TYPE = exports.TERM_DURATION = exports.FEE_REMINDER_SETTING_STATUS = exports.GREETING_TYPE = exports.TRIP_TYPE = exports.USER_COURSE_STATUS = exports.COMMAN_STATUS = exports.TOKEN_TYPES = exports.USER_TYPES = exports.ACADEMIC_CALENDARS_TYPE = exports.RETURN_STATUS = exports.ASSIGN_TYPE = exports.GENDER = exports.SCHOOL_SUB_TYPE = exports.SCHOOL_TYPE = exports.ATTENDANCE_TYPE = exports.ATTENDANCE_STATUS = exports.USER_INVENTORY_ACTION = exports.INVENTORY_TYPE = exports.USER_STATUS = exports.PDF_MICRO_SERVICE_END_POINT = exports.MOBILE_VERIFICATION = exports.EMAIL_VERIFICATION = exports.PAGINATION_UPDATE_ORDER = exports.PAGINATION_ORDER = exports.DEFAULT_BATCH_TITLE = exports.DEFAULT_CLASS_ROOM_TITLE = exports.PAGINATION = exports.USER_INSTITUTE_META_STATUS_REJECTED_COUNT = exports.ONE_THOUSAND = exports.ONE_HUNDRED = exports.SIXTY = void 0;
4
+ exports.CHAPTER_INDEX_FILE_TYPE = exports.FEE_HISTORY_STATUS = exports.USER_CHAPTER_INDEX_STATUS = exports.CHAPTER_INDEX_TYPE = exports.IMAGE__NAME = exports.INQUIRY_STATUS = exports.INQUIRY_REFERRED_BY = exports.EXAM_GROUP_STANDARD_RESULT = exports.EXAM_GROUP_STATUS = exports.SUBJECT_INDEX_TYPE = exports.LECTURE_SLOT_DURATION = exports.EXAM_ANSWER_SHEET_QUESTION_RESULT = exports.PAYMENT_TERMS_TYPE = exports.PAYMENT_TERMS_STATUS = exports.EXAM_ANSWER_SHEET_RESULT_TYPE = exports.EXAM_ANSWER_SHEET_RESULT_STATUS = exports.EXAM_ANSWER_SHEET_STATUS = exports.EXAM_VALID_ANSWER_TYPE = exports.EXAM_ANSWER_SELECTION_TYPE = exports.EXAM_STATUS = exports.COURSE_STATUS = exports.EXAM_MODE = exports.GREETING_STATUS = exports.USER_HAS_ANNOUCEMENT_STATUS = exports.ANNOUCEMENT_STATUS = exports.TYPE_OF_USER = exports.ANNOUCEMENT_SCHEDULE_TYPE = exports.APPROVE_REQUEST_STATUS = exports.APPROVE_REQUEST_TYPE = exports.TYPE_MANAGEMENT_STATUS = exports.TYPE_MANAGEMENT_TYPE = exports.FILE_TYPE = exports.ACADEMIC_CALENDARS_STATUS = exports.BANNER_TYPE = exports.APP_TYPE = exports.FEED_BACK_STATUS = exports.FEED_BACK_TYPE = exports.FACILITY_TYPE = exports.EMPLOYMENT_TYPE = exports.USER_INSTITUTE_META_STATUS = exports.USER_HAS_PARENT_STATUS = exports.GUARDIANS_USER_META_MODEL_STATUS = exports.DISABILITY_TYPE = exports.WORK_CATEGORY = exports.BLOG_STATUS = exports.WORK_TYPE = exports.USER_DETAILS = exports.NO_TYPE = exports.ADMISSION_TYPE = exports.INSTITUTE_ENTITY_TYPE_SEQUENCE = void 0;
5
+ exports.SUBSCRIPTION_PLAN_FILES_TYPE = exports.VALID_CURRENCY = exports.SUBSCRIPTION_PLAN_TYPE = exports.SUBSCRIPTION_PLAN_CHARGE_INTERVAL = exports.DISCOUNT_TYPE = exports.CONTACT_FEED_BACK_TYPE = exports.PLANNER_SYNC_STATUS = exports.NOTIFICATION_ACTION = exports.NOTIFICATION_MODULE_TYPE = exports.NOTIFICATION_STATUS = exports.NOTIFICATION_TYPE = exports.PROJECT_ASSESSMENT_OPTION_STATUS = exports.USER_BOOK_ASSESSMENT_STATUS = exports.BOOK_ASSESSMENT_DATE_STATUS = exports.TASK_MANAGEMENT_STATUS = exports.USER_DETAILS_FILED = exports.DEVICE_TYPE = exports.templateKeyWord = exports.bankAccountRegexMap = exports.EMAIL_SUBJECTS = exports.PDF_TEMPLATES = exports.EMAIL_TEMPLATES = exports.PINCODE_API_URL = exports.APPLE_AUTH = exports.META_AUTH = exports.GOOGLE_AUTH = exports.API_URL = exports.DEFAULT_USER_LOGO = exports.DEFAULT_INSTITUTED_LOGO = exports.UPLOAD_PATH = exports.SVG_URL_PATH = exports.TO_DO_STATUS = exports.LECTURE_TITLE = exports.LECTURE_STATUS = exports.SCHOOL_INFORMATION_STEP = exports.CASTE = exports.RELIGION_CASTE = exports.NATIONALITY = exports.CATEGORY = exports.IS_PRINCIPAL = exports.FEE_TYPE = exports.BOOLEAN_STATUS = exports.PROPERTY_STATUS = exports.DESIGNATION_OF_PERSON = exports.TRUST_REGISTERED_UNDER = exports.TRUST_TYPE = exports.SVA_NAME = exports.QDC_NAME = exports.USER_PAYOUT_TYPE = exports.PARENTS_CHILDREN_CURRENT = void 0;
6
+ exports.BANK_ACCOUNT_TYPE = exports.STUDENT_LEAVE_TYPE = exports.STUDENT_LEAVE_STATUS = exports.CERTIFICATE_TYPE = exports.CERTIFICATE_FOR = exports.SHEET_TYPE = exports.COMPETITION_USER_ROLE = exports.RESULT_STATUS = exports.COMPETITION_STATUS = exports.STATUS_BY_PARENTS = exports.COMPETITION_TYPE = exports.CAMPUS_CARNIVAL_STATUS = exports.COMPETITION_TYPE_CATEGORY = exports.COMPETITION_EVENTS = exports.PAYMENT_STATUS = exports.INCOME_EXPENSE_SOURCE = exports.INCOME_EXPENSE_TYPE = exports.APPOINTMENT_STATUS = exports.MAINTENANCE_MODULE_NAME = exports.MAINTENANCE_TYPE = exports.MAINTENANCE_MODE = exports.ASSIGN_FILE_TYPE = exports.LOST_FOUND_ITEM_STATUS = exports.PAYMENT_PROCESSING_CALLBACK_URL = exports.PAYMENT_PROCESSING_PAGE_URL = exports.PAYMENT_PROCESSING_STATUS_URL = exports.WALLET_TRANSACTION_VALID_DATE_FOR_OTP_IN_MINUTES = exports.WALLET_TRANSACTION_VALID_DATE_IN_MINUTES = exports.PAYMENT_METHODS = exports.PAYMENT_GATEWAY_TYPES = exports.JOB_ACTION = exports.ONE_GB_BYTES = exports.CHARGE_PER_TRANSACTION_ITEM_UNIT = exports.INSTITUTE_SUBSCRIPTION_PLAN_STATUS = exports.WALLET_TRANSACTION_USERS_TYPE = exports.WALLET_HISTORY_STATUS = exports.WALLET_HISTORY_ACTION = exports.WALLET_HISTORY_ITEM_TYPE = exports.WALLET_HISTORY_TYPE = exports.REPLACE_TEACHER_STATUS = exports.TEACHER_TYPE = exports.INVOICE_TYPE = exports.PURCHASE_STATUS = exports.COLUMN_LIST_TITLE = exports.INVOICE_PAYMENT_TYPE = exports.PDF_CHEQUE_FREQUENCY = exports.PDF_CHEQUE_STATUS = exports.LANGUAGES = exports.HOME_WORK_STATUS = exports.SOCKET_EVENTS = void 0;
7
+ exports.SEARCH_TYPE = exports.REPORT_TYPE = exports.DEVICE_TYPE_APP_ANALYTICS = exports.APP_ANALYTICS_EVENT_TYPE = exports.EXPORT_SHEET_TYPE = exports.GRANT_AND_DONATION_TYPE = exports.TICKET_RAISE_PRIORITY = exports.TICKET_RAISE_STATUS = exports.TERM_AND_CONDITION_STATUS = exports.EDUCATION_OFFICER_TYPE = exports.HOME_WORK_TYPE = exports.STUDENT_FEE_PROCESS_STATUS = exports.FEE_COLLECTION_TYPE = void 0;
8
8
  const env_1 = require("../configs/env");
9
9
  exports.SIXTY = 60;
10
10
  exports.ONE_HUNDRED = 100;
@@ -223,6 +223,26 @@ var OFFER_NAME;
223
223
  OFFER_NAME["FEE"] = "FEE";
224
224
  OFFER_NAME["COURSE"] = "COURSE";
225
225
  })(OFFER_NAME || (exports.OFFER_NAME = OFFER_NAME = {}));
226
+ var OFFER_APPLICABLE_TO;
227
+ (function (OFFER_APPLICABLE_TO) {
228
+ OFFER_APPLICABLE_TO["STUDENT"] = "STUDENT";
229
+ OFFER_APPLICABLE_TO["BATCH"] = "BATCH";
230
+ OFFER_APPLICABLE_TO["ALL"] = "ALL";
231
+ })(OFFER_APPLICABLE_TO || (exports.OFFER_APPLICABLE_TO = OFFER_APPLICABLE_TO = {}));
232
+ var OFFER_CONDITION_TYPE;
233
+ (function (OFFER_CONDITION_TYPE) {
234
+ OFFER_CONDITION_TYPE["MERIT"] = "MERIT";
235
+ OFFER_CONDITION_TYPE["EARLY_PAYMENT"] = "EARLY_PAYMENT";
236
+ OFFER_CONDITION_TYPE["FULL_PAYMENT"] = "FULL_PAYMENT";
237
+ OFFER_CONDITION_TYPE["CUSTOM"] = "CUSTOM";
238
+ })(OFFER_CONDITION_TYPE || (exports.OFFER_CONDITION_TYPE = OFFER_CONDITION_TYPE = {}));
239
+ var OFFER_STATUS;
240
+ (function (OFFER_STATUS) {
241
+ OFFER_STATUS["PENDING"] = "PENDING";
242
+ OFFER_STATUS["ACCEPTED"] = "ACCEPTED";
243
+ OFFER_STATUS["REJECTED"] = "REJECTED";
244
+ OFFER_STATUS["CANCELLED"] = "CANCELLED";
245
+ })(OFFER_STATUS || (exports.OFFER_STATUS = OFFER_STATUS = {}));
226
246
  var LEAVE_TYPE;
227
247
  (function (LEAVE_TYPE) {
228
248
  LEAVE_TYPE["FULL_DAY"] = "FULL_DAY";
@@ -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,210 @@
1
+ "use strict";
2
+ const up = async (queryInterface, Sequelize) => {
3
+ const tableName = 'user_has_offer_and_discount';
4
+ const tableExists = await queryInterface
5
+ .describeTable(tableName)
6
+ .then(() => true)
7
+ .catch(() => false);
8
+ if (!tableExists) {
9
+ await queryInterface.createTable(tableName, {
10
+ id: {
11
+ type: Sequelize.UUID,
12
+ defaultValue: Sequelize.UUIDV4,
13
+ allowNull: false,
14
+ primaryKey: true,
15
+ },
16
+ instituteId: {
17
+ type: Sequelize.UUID,
18
+ field: 'institute_id',
19
+ allowNull: true,
20
+ },
21
+ academicCalendarId: {
22
+ type: Sequelize.UUID,
23
+ field: 'academic_calendar_id',
24
+ allowNull: true,
25
+ },
26
+ userId: {
27
+ type: Sequelize.UUID,
28
+ field: 'user_id',
29
+ allowNull: true,
30
+ },
31
+ discount: {
32
+ type: Sequelize.INTEGER,
33
+ allowNull: true,
34
+ defaultValue: 0,
35
+ },
36
+ offerType: {
37
+ type: Sequelize.STRING,
38
+ allowNull: true,
39
+ field: 'offer_type',
40
+ },
41
+ limitUserCount: {
42
+ type: Sequelize.INTEGER,
43
+ allowNull: true,
44
+ field: 'limit_user_count',
45
+ },
46
+ status: {
47
+ type: Sequelize.STRING,
48
+ allowNull: true,
49
+ },
50
+ offerAndDiscountId: {
51
+ type: Sequelize.UUID,
52
+ field: 'offer_and_discount_id',
53
+ allowNull: true,
54
+ },
55
+ applyDiscountAmount: {
56
+ type: Sequelize.INTEGER,
57
+ field: 'apply_discount_amount',
58
+ allowNull: true,
59
+ defaultValue: 0,
60
+ },
61
+ offerApplyFor: {
62
+ type: Sequelize.STRING,
63
+ field: 'offer_apply_for',
64
+ allowNull: true,
65
+ },
66
+ createdBy: {
67
+ type: Sequelize.UUID,
68
+ allowNull: true,
69
+ field: 'created_by',
70
+ },
71
+ updatedBy: {
72
+ type: Sequelize.UUID,
73
+ allowNull: true,
74
+ field: 'updated_by',
75
+ },
76
+ deletedBy: {
77
+ type: Sequelize.UUID,
78
+ allowNull: true,
79
+ field: 'deleted_by',
80
+ },
81
+ createdAt: {
82
+ type: Sequelize.DATE,
83
+ allowNull: false,
84
+ field: 'created_at',
85
+ },
86
+ updatedAt: {
87
+ type: Sequelize.DATE,
88
+ allowNull: false,
89
+ field: 'updated_at',
90
+ },
91
+ deletedAt: {
92
+ type: Sequelize.DATE,
93
+ allowNull: true,
94
+ field: 'deleted_at',
95
+ },
96
+ });
97
+ }
98
+ else {
99
+ const tableDefinition = await queryInterface.describeTable(tableName);
100
+ const columnsToAdd = {
101
+ id: {
102
+ type: Sequelize.UUID,
103
+ defaultValue: Sequelize.UUIDV4,
104
+ allowNull: false,
105
+ primaryKey: true,
106
+ },
107
+ instituteId: {
108
+ type: Sequelize.UUID,
109
+ field: 'institute_id',
110
+ allowNull: true,
111
+ },
112
+ academicCalendarId: {
113
+ type: Sequelize.UUID,
114
+ field: 'academic_calendar_id',
115
+ allowNull: true,
116
+ },
117
+ userId: {
118
+ type: Sequelize.UUID,
119
+ field: 'user_id',
120
+ allowNull: true,
121
+ },
122
+ discount: {
123
+ type: Sequelize.INTEGER,
124
+ allowNull: true,
125
+ defaultValue: 0,
126
+ },
127
+ offerType: {
128
+ type: Sequelize.STRING,
129
+ allowNull: true,
130
+ field: 'offer_type',
131
+ },
132
+ limitUserCount: {
133
+ type: Sequelize.INTEGER,
134
+ allowNull: true,
135
+ field: 'limit_user_count',
136
+ },
137
+ status: {
138
+ type: Sequelize.STRING,
139
+ allowNull: true,
140
+ },
141
+ offerAndDiscountId: {
142
+ type: Sequelize.UUID,
143
+ field: 'offer_and_discount_id',
144
+ allowNull: true,
145
+ },
146
+ applyDiscountAmount: {
147
+ type: Sequelize.INTEGER,
148
+ field: 'apply_discount_amount',
149
+ allowNull: true,
150
+ defaultValue: 0,
151
+ },
152
+ offerApplyFor: {
153
+ type: Sequelize.STRING,
154
+ field: 'offer_apply_for',
155
+ allowNull: true,
156
+ },
157
+ createdBy: {
158
+ type: Sequelize.UUID,
159
+ allowNull: true,
160
+ field: 'created_by',
161
+ },
162
+ updatedBy: {
163
+ type: Sequelize.UUID,
164
+ allowNull: true,
165
+ field: 'updated_by',
166
+ },
167
+ deletedBy: {
168
+ type: Sequelize.UUID,
169
+ allowNull: true,
170
+ field: 'deleted_by',
171
+ },
172
+ createdAt: {
173
+ type: Sequelize.DATE,
174
+ allowNull: false,
175
+ field: 'created_at',
176
+ },
177
+ updatedAt: {
178
+ type: Sequelize.DATE,
179
+ allowNull: false,
180
+ field: 'updated_at',
181
+ },
182
+ deletedAt: {
183
+ type: Sequelize.DATE,
184
+ allowNull: true,
185
+ field: 'deleted_at',
186
+ },
187
+ };
188
+ for (const column of Object.keys(columnsToAdd)) {
189
+ const columnToAdd = columnsToAdd[column];
190
+ const tableColumn = columnToAdd.field || column;
191
+ if (!tableDefinition[tableColumn]) {
192
+ await queryInterface.addColumn(tableName, tableColumn, columnToAdd);
193
+ }
194
+ }
195
+ }
196
+ };
197
+ const down = async (queryInterface) => {
198
+ const tableName = 'user_has_offer_and_discount';
199
+ const tableExists = await queryInterface
200
+ .describeTable(tableName)
201
+ .then(() => true)
202
+ .catch(() => false);
203
+ if (tableExists) {
204
+ await queryInterface.dropTable(tableName);
205
+ }
206
+ };
207
+ module.exports = {
208
+ up,
209
+ down,
210
+ };
@@ -177,3 +177,5 @@ export * from './pdcChequeConfigurationInterface';
177
177
  export * from './modulePriceInterface';
178
178
  export * from './subscriptionConfigurationInterface';
179
179
  export * from './userAcceptedTermsAndConditionInterface';
180
+ export * from './offerAndDiscountInterface';
181
+ export * from './userHasOfferAndDiscountInterface';
@@ -193,3 +193,5 @@ __exportStar(require("./pdcChequeConfigurationInterface"), exports);
193
193
  __exportStar(require("./modulePriceInterface"), exports);
194
194
  __exportStar(require("./subscriptionConfigurationInterface"), exports);
195
195
  __exportStar(require("./userAcceptedTermsAndConditionInterface"), exports);
196
+ __exportStar(require("./offerAndDiscountInterface"), exports);
197
+ __exportStar(require("./userHasOfferAndDiscountInterface"), exports);
@@ -0,0 +1,36 @@
1
+ import { Document } from 'mongoose';
2
+ import { IDefaultAttributes } from './commonInterface';
3
+ import { COMMAN_STATUS, OFFER_APPLICABLE_TO, OFFER_CONDITION_TYPE, OFFER_NAME, OFFER_TYPE, PAYMENT_TYPE, USER_TYPES } from '../constants';
4
+ export interface ICondition {
5
+ type: OFFER_CONDITION_TYPE;
6
+ value?: string | number | boolean;
7
+ }
8
+ export interface IUsageRule {
9
+ title: string;
10
+ entityIds: string[];
11
+ limit?: number;
12
+ usedCount?: number;
13
+ }
14
+ export interface IOfferAndDiscountModelAttributes extends IDefaultAttributes, Document {
15
+ id: string;
16
+ instituteId: string;
17
+ academicCalendarId: string;
18
+ title?: string;
19
+ description?: string;
20
+ offerType: OFFER_TYPE;
21
+ offerApplicableTo: OFFER_APPLICABLE_TO;
22
+ offerFor: OFFER_NAME;
23
+ discount: number;
24
+ maximumDiscount?: number;
25
+ minimumFee?: number;
26
+ startTime?: Date;
27
+ whoCanOfferApply?: USER_TYPES[];
28
+ paymentMode?: PAYMENT_TYPE[];
29
+ endTime?: Date;
30
+ userLimit?: number;
31
+ usedCount?: number;
32
+ conditions?: ICondition[];
33
+ usageRules?: IUsageRule[];
34
+ needApproval: boolean;
35
+ status: COMMAN_STATUS;
36
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,15 @@
1
+ import { OFFER_NAME, OFFER_STATUS, OFFER_TYPE } from '../constants';
2
+ import { IDefaultAttributes } from './commonInterface';
3
+ export interface IUserHasOfferAndDiscountModelAttributes extends IDefaultAttributes {
4
+ id: string;
5
+ instituteId: string;
6
+ academicCalendarId: string;
7
+ userId: string;
8
+ discount: number;
9
+ offerType: OFFER_TYPE;
10
+ limitUserCount?: number;
11
+ status: OFFER_STATUS;
12
+ offerAndDiscountId: string;
13
+ applyDiscountAmount: number;
14
+ offerApplyFor: OFFER_NAME;
15
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -61,3 +61,4 @@ export { default as FinalMarkSheetModel } from './finalMarkSheetModel';
61
61
  export { default as PdcChequeConfigurationModel } from './pdcChequeConfigurationModel';
62
62
  export { default as ModulePriceModel } from './modulePriceModel';
63
63
  export { default as SubscriptionConfigurationModel } from './subscriptionConfigurationModel';
64
+ export { default as OfferAndDiscountModel } from './offerAndDiscountModel';
@@ -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.SubscriptionConfigurationModel = 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;
7
+ exports.OfferAndDiscountModel = exports.SubscriptionConfigurationModel = 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"));
@@ -149,3 +149,5 @@ var modulePriceModel_1 = require("./modulePriceModel");
149
149
  Object.defineProperty(exports, "ModulePriceModel", { enumerable: true, get: function () { return __importDefault(modulePriceModel_1).default; } });
150
150
  var subscriptionConfigurationModel_1 = require("./subscriptionConfigurationModel");
151
151
  Object.defineProperty(exports, "SubscriptionConfigurationModel", { enumerable: true, get: function () { return __importDefault(subscriptionConfigurationModel_1).default; } });
152
+ var offerAndDiscountModel_1 = require("./offerAndDiscountModel");
153
+ Object.defineProperty(exports, "OfferAndDiscountModel", { enumerable: true, get: function () { return __importDefault(offerAndDiscountModel_1).default; } });
@@ -0,0 +1,4 @@
1
+ import { Model } from 'mongoose';
2
+ import { IOfferAndDiscountModelAttributes } from '../../interfaces/offerAndDiscountInterface';
3
+ declare const OfferAndDiscountModel: Model<IOfferAndDiscountModelAttributes>;
4
+ export default OfferAndDiscountModel;
@@ -0,0 +1,150 @@
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
+ /**
39
+ * Condition Schema
40
+ */
41
+ const ConditionSchema = new mongoose_1.Schema({
42
+ type: {
43
+ type: String,
44
+ enum: Object.values(constants_1.OFFER_CONDITION_TYPE),
45
+ },
46
+ value: {
47
+ type: mongoose_1.Schema.Types.Mixed, // dynamic (string | number | boolean)
48
+ },
49
+ }, { _id: false });
50
+ /**
51
+ * Usage Rule Schema
52
+ */
53
+ const UsageRuleSchema = new mongoose_1.Schema({
54
+ title: {
55
+ type: String, // e.g. BATCH, FEE, STUDENT
56
+ },
57
+ entityIds: [
58
+ {
59
+ type: String,
60
+ },
61
+ ],
62
+ limit: {
63
+ type: Number,
64
+ },
65
+ usedCount: {
66
+ type: Number,
67
+ default: 0,
68
+ },
69
+ }, { _id: false });
70
+ /**
71
+ * Main Offer Schema
72
+ */
73
+ const OfferAndDiscountSchema = new mongoose_1.Schema({
74
+ instituteId: {
75
+ type: String,
76
+ trim: true,
77
+ },
78
+ academicCalendarId: {
79
+ type: String,
80
+ trim: true,
81
+ },
82
+ title: {
83
+ type: String,
84
+ trim: true,
85
+ },
86
+ description: {
87
+ type: String,
88
+ trim: true,
89
+ },
90
+ offerType: {
91
+ type: String,
92
+ enum: Object.values(constants_1.OFFER_TYPE),
93
+ },
94
+ offerApplicableTo: {
95
+ type: String,
96
+ enum: Object.values(constants_1.OFFER_APPLICABLE_TO),
97
+ },
98
+ offerFor: {
99
+ type: String,
100
+ enum: Object.values(constants_1.OFFER_NAME),
101
+ },
102
+ discount: {
103
+ type: Number,
104
+ },
105
+ maximumDiscount: {
106
+ type: Number,
107
+ },
108
+ minimumFee: {
109
+ type: Number,
110
+ },
111
+ startTime: {
112
+ type: Date,
113
+ },
114
+ endTime: {
115
+ type: Date,
116
+ },
117
+ userLimit: {
118
+ type: Number,
119
+ },
120
+ usedCount: {
121
+ type: Number,
122
+ },
123
+ whoCanOfferApply: { type: [String], default: [] },
124
+ paymentMode: { type: [String], default: [] },
125
+ conditions: [ConditionSchema],
126
+ usageRules: [UsageRuleSchema],
127
+ needApproval: {
128
+ type: Boolean,
129
+ default: false,
130
+ },
131
+ status: {
132
+ type: String,
133
+ enum: Object.values(constants_1.COMMAN_STATUS),
134
+ default: constants_1.COMMAN_STATUS.ACTIVE,
135
+ },
136
+ createdBy: {
137
+ type: String,
138
+ },
139
+ updatedBy: {
140
+ type: String,
141
+ },
142
+ deletedBy: {
143
+ type: String,
144
+ },
145
+ }, {
146
+ timestamps: true,
147
+ versionKey: false,
148
+ });
149
+ const OfferAndDiscountModel = mongoose_1.default.model('offerAndDiscounts', OfferAndDiscountSchema);
150
+ exports.default = OfferAndDiscountModel;
@@ -118,3 +118,4 @@ export { default as TermsAndConditionModel } from './termsAndConditionModel';
118
118
  export { default as InternalMarkModel } from './internalMarkModel';
119
119
  export { default as SubjectInternalMarkModel } from './subjectInternalMarkModel';
120
120
  export { default as UserAcceptedTermsAndCondition } from './userAcceptedTermsAndConditionModel';
121
+ export { default as UserHasOfferAndDiscountModel } from './userHasOfferAndDiscountModel';
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.ProjectAssessmentOptionModel = exports.ProductModel = exports.PincodeModel = exports.PdcHistoryModel = exports.PdcChequeModel = exports.OfferModel = exports.ModuleModel = exports.ModuleFeatureModel = exports.MasterLeaveModel = exports.LectureModel = exports.LectureHistoryModel = exports.InventoryModel = exports.InventoryHistoryModel = exports.InstituteSubscriptionPlanModel = exports.InstituteModel = exports.InstituteEntityTypeModel = exports.InstituteEntityModel = exports.HomeWorkModel = exports.GreetingsModel = exports.FloorManagementModel = exports.FileStorageModel = exports.FeeReminderSettingModel = exports.FeeReminderModel = exports.FeatureActionModel = exports.FacilityModel = exports.EntityGroupModel = exports.DriverModel = exports.CourseModel = exports.CourseHasVisitorsModel = exports.CountryModel = exports.ContactFeedBackModel = exports.CoinPurchaseOfferModel = exports.CloudStorageModel = exports.ClassRoomModel = exports.CityModel = exports.CategoriesModel = exports.BookAssessmentDateModel = exports.BatchSubjectProjectAssessmentModel = exports.BatchSubjectBookAssessmentModel = exports.BatchModel = exports.BannerModel = exports.BankAccountDetailsModel = exports.AreaModel = exports.AnnouncementModel = exports.AccountHasReceiptDetailsModel = exports.AcademicCalendarModel = exports.SubCategoriesModel = exports.Sequelize = exports.db = exports.sequelize = void 0;
7
7
  exports.MaintenanceModel = exports.AdvertisementModel = exports.WorkOffDaysModel = exports.EntityWiseCalendarModel = exports.CampusModel = exports.LostFoundItemModel = exports.WorkingShiftModel = exports.WorkingDayModel = exports.WalletModel = exports.WalletHistoryModel = exports.VendorManagementModel = exports.VehicleModel = exports.UserRequiredStepsModel = exports.UserProjectAssessmentOptionModel = exports.UserPayoutModel = exports.UserPayoutHistoryModel = exports.UserPayoutDetailsModel = exports.UserModel = exports.UserLeaveRequestModel = exports.UserHasSubjectFeeModel = exports.UserHasStorageModel = exports.UserHasRollNumberModel = exports.UserHasRoleModel = exports.UserHasParentModel = exports.UserHasOfferModel = exports.UserHasLeaveModel = exports.UserHasLeaveHistoryModel = exports.UserHasInventoryModel = exports.UserHasInventoryHistoryModel = exports.UserHasHomeWorkModel = exports.UserHasFileModel = exports.UserHasDeviceModel = exports.UserHasCourseModel = exports.UserHasBatchModel = exports.UserHasAnnouncementModel = exports.UserBookAssessmentModel = exports.TypeManagementModel = exports.TripModel = exports.TokenModel = exports.ToDoModel = exports.TestimonialModel = exports.SyllabusModel = exports.SubjectHasPayFeeHistoryModel = exports.SubjectHasFeeModel = exports.StateModel = exports.SlotModel = exports.SendNotificationModel = exports.SchoolOfferModel = exports.RulesRegulationModel = exports.RoleModel = void 0;
8
- exports.UserAcceptedTermsAndCondition = exports.SubjectInternalMarkModel = exports.InternalMarkModel = exports.TermsAndConditionModel = exports.FeeType1Model = exports.StudentFeeTermsModel = exports.UserHasPenaltyModel = exports.PenaltyModel = exports.ClassRoomCollectionModel = exports.ClassRoomEventModel = exports.StudentFeeTypeCollectionModel = exports.SchoolFeeTermsModel = exports.StudentFeeHistoryModel = exports.StudentFeeCollectionModel = exports.UserDirectoryModel = exports.StudentLeaveRequestModel = exports.CloneListModel = exports.IncomeExpenseModel = void 0;
8
+ exports.UserHasOfferAndDiscountModel = exports.UserAcceptedTermsAndCondition = exports.SubjectInternalMarkModel = exports.InternalMarkModel = exports.TermsAndConditionModel = exports.FeeType1Model = exports.StudentFeeTermsModel = exports.UserHasPenaltyModel = exports.PenaltyModel = exports.ClassRoomCollectionModel = exports.ClassRoomEventModel = exports.StudentFeeTypeCollectionModel = exports.SchoolFeeTermsModel = exports.StudentFeeHistoryModel = exports.StudentFeeCollectionModel = exports.UserDirectoryModel = exports.StudentLeaveRequestModel = exports.CloneListModel = exports.IncomeExpenseModel = void 0;
9
9
  const sequelize_1 = require("sequelize");
10
10
  Object.defineProperty(exports, "Sequelize", { enumerable: true, get: function () { return sequelize_1.Sequelize; } });
11
11
  const postgresConfig = require('../../configs/postgresConfig');
@@ -330,3 +330,5 @@ var subjectInternalMarkModel_1 = require("./subjectInternalMarkModel");
330
330
  Object.defineProperty(exports, "SubjectInternalMarkModel", { enumerable: true, get: function () { return __importDefault(subjectInternalMarkModel_1).default; } });
331
331
  var userAcceptedTermsAndConditionModel_1 = require("./userAcceptedTermsAndConditionModel");
332
332
  Object.defineProperty(exports, "UserAcceptedTermsAndCondition", { enumerable: true, get: function () { return __importDefault(userAcceptedTermsAndConditionModel_1).default; } });
333
+ var userHasOfferAndDiscountModel_1 = require("./userHasOfferAndDiscountModel");
334
+ Object.defineProperty(exports, "UserHasOfferAndDiscountModel", { enumerable: true, get: function () { return __importDefault(userHasOfferAndDiscountModel_1).default; } });
@@ -0,0 +1,24 @@
1
+ import { Model } from 'sequelize';
2
+ import { IUserHasOfferAndDiscountModelAttributes } from '../../interfaces/userHasOfferAndDiscountInterface';
3
+ import { OFFER_NAME, OFFER_STATUS, OFFER_TYPE } from '../../constants';
4
+ declare class UserHasOfferAndDiscountModel extends Model<IUserHasOfferAndDiscountModelAttributes> {
5
+ id: string;
6
+ instituteId: string;
7
+ academicCalendarId: string;
8
+ userId: string;
9
+ discount: number;
10
+ offerType: OFFER_TYPE;
11
+ limitUserCount?: number;
12
+ status: OFFER_STATUS;
13
+ offerAndDiscountId: string;
14
+ applyDiscountAmount: number;
15
+ offerApplyFor: OFFER_NAME;
16
+ createdBy: string;
17
+ updatedBy: string;
18
+ deletedBy: string;
19
+ readonly createdAt: Date;
20
+ readonly updatedAt: Date;
21
+ readonly deletedAt: Date;
22
+ static associate(models: any): void;
23
+ }
24
+ export default UserHasOfferAndDiscountModel;
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const sequelize_1 = require("sequelize");
4
+ const constants_1 = require("../../constants");
5
+ const index_1 = require("./index");
6
+ class UserHasOfferAndDiscountModel extends sequelize_1.Model {
7
+ static associate(models) {
8
+ const { UserModel, InstituteModel, AcademicCalendarModel } = models;
9
+ UserHasOfferAndDiscountModel.belongsTo(UserModel, {
10
+ foreignKey: {
11
+ name: 'userId',
12
+ field: 'user_id',
13
+ },
14
+ as: 'user',
15
+ });
16
+ UserModel.hasMany(UserHasOfferAndDiscountModel, {
17
+ foreignKey: 'userId',
18
+ as: 'userOffers',
19
+ });
20
+ UserHasOfferAndDiscountModel.belongsTo(InstituteModel, {
21
+ foreignKey: {
22
+ name: 'instituteId',
23
+ field: 'institute_id',
24
+ },
25
+ as: 'institute',
26
+ });
27
+ InstituteModel.hasMany(UserHasOfferAndDiscountModel, {
28
+ foreignKey: 'instituteId',
29
+ as: 'instituteUserOffers',
30
+ });
31
+ UserHasOfferAndDiscountModel.belongsTo(AcademicCalendarModel, {
32
+ foreignKey: {
33
+ name: 'academicCalendarId',
34
+ field: 'academic_calendar_id',
35
+ },
36
+ as: 'academicCalendar',
37
+ });
38
+ AcademicCalendarModel.hasMany(UserHasOfferAndDiscountModel, {
39
+ foreignKey: 'academicCalendarId',
40
+ as: 'acaCalUserOffers',
41
+ });
42
+ // audit users
43
+ UserHasOfferAndDiscountModel.belongsTo(UserModel, {
44
+ foreignKey: { name: 'createdBy', field: 'created_by' },
45
+ as: 'createdByUser',
46
+ });
47
+ UserHasOfferAndDiscountModel.belongsTo(UserModel, {
48
+ foreignKey: { name: 'updatedBy', field: 'updated_by' },
49
+ as: 'updatedByUser',
50
+ });
51
+ UserHasOfferAndDiscountModel.belongsTo(UserModel, {
52
+ foreignKey: { name: 'deletedBy', field: 'deleted_by' },
53
+ as: 'deletedByUser',
54
+ });
55
+ }
56
+ }
57
+ UserHasOfferAndDiscountModel.init({
58
+ id: {
59
+ type: sequelize_1.DataTypes.UUID,
60
+ defaultValue: sequelize_1.DataTypes.UUIDV4,
61
+ primaryKey: true,
62
+ allowNull: true,
63
+ },
64
+ instituteId: {
65
+ type: sequelize_1.DataTypes.UUID,
66
+ allowNull: true,
67
+ },
68
+ academicCalendarId: {
69
+ type: sequelize_1.DataTypes.UUID,
70
+ allowNull: true,
71
+ },
72
+ userId: {
73
+ type: sequelize_1.DataTypes.UUID,
74
+ allowNull: true,
75
+ },
76
+ discount: {
77
+ type: sequelize_1.DataTypes.INTEGER,
78
+ allowNull: true,
79
+ },
80
+ offerType: {
81
+ type: sequelize_1.DataTypes.ENUM,
82
+ values: Object.values(constants_1.OFFER_TYPE),
83
+ allowNull: true,
84
+ },
85
+ limitUserCount: {
86
+ type: sequelize_1.DataTypes.INTEGER,
87
+ allowNull: true,
88
+ },
89
+ status: {
90
+ type: sequelize_1.DataTypes.ENUM,
91
+ values: Object.values(constants_1.OFFER_STATUS),
92
+ allowNull: true,
93
+ },
94
+ offerAndDiscountId: {
95
+ type: sequelize_1.DataTypes.UUID,
96
+ allowNull: true,
97
+ },
98
+ applyDiscountAmount: {
99
+ type: sequelize_1.DataTypes.INTEGER,
100
+ allowNull: true,
101
+ },
102
+ offerApplyFor: {
103
+ type: sequelize_1.DataTypes.ENUM,
104
+ values: Object.values(constants_1.OFFER_NAME),
105
+ allowNull: true,
106
+ },
107
+ }, {
108
+ sequelize: index_1.sequelize,
109
+ modelName: 'UserHasOfferAndDiscountModel',
110
+ tableName: 'user_has_offer_and_discount',
111
+ timestamps: true,
112
+ });
113
+ exports.default = UserHasOfferAndDiscountModel;
@@ -168,3 +168,5 @@ export * from './pdcChequeConfigurationType';
168
168
  export * from './modulePriceType';
169
169
  export * from './subscriptionConfigurationType';
170
170
  export * from './userAcceptedTermsAndConditionType';
171
+ export * from './offerAndDiscountType';
172
+ export * from './userHasOfferAndDiscountType';
@@ -184,3 +184,5 @@ __exportStar(require("./pdcChequeConfigurationType"), exports);
184
184
  __exportStar(require("./modulePriceType"), exports);
185
185
  __exportStar(require("./subscriptionConfigurationType"), exports);
186
186
  __exportStar(require("./userAcceptedTermsAndConditionType"), exports);
187
+ __exportStar(require("./offerAndDiscountType"), exports);
188
+ __exportStar(require("./userHasOfferAndDiscountType"), exports);
@@ -0,0 +1,2 @@
1
+ import { IOfferAndDiscountModelAttributes } from '../interfaces/offerAndDiscountInterface';
2
+ export type TOfferAndDiscountModelCreationAttributes = Omit<IOfferAndDiscountModelAttributes, 'id'>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ import { IUserHasOfferAndDiscountModelAttributes } from '../interfaces/userHasOfferAndDiscountInterface';
2
+ export type TUserHasOfferAndDiscountModelCreationAttributes = Omit<IUserHasOfferAndDiscountModelAttributes, '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.417",
3
+ "version": "1.1.419",
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",