@kipicore/dbcore 1.1.180 → 1.1.181

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.
@@ -1000,3 +1000,12 @@ export declare enum STUDENT_LEAVE_TYPE {
1000
1000
  TODAY = "TODAY",
1001
1001
  HALF_DAY = "HALF_DAY"
1002
1002
  }
1003
+ export declare enum BANK_ACCOUNT_TYPE {
1004
+ SCHOOL = "SCHOOL",
1005
+ TRUST = "TRUST"
1006
+ }
1007
+ export declare enum FEE_COLLECTION_TYPE {
1008
+ SUBJECT_WISE = "SUBJECT_WISE",
1009
+ BATCH_WISE = "BATCH_WISE",
1010
+ STANDARD_WISE = "STANDARD_WISE"
1011
+ }
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.USER_DETAILS = 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.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
4
  exports.SVA_NAME = 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 = void 0;
5
5
  exports.PDF_CHEQUE_FREQUENCY = exports.PDF_CHEQUE_STATUS = exports.LANGUAGES = exports.HOME_WORK_STATUS = exports.SOCKET_EVENTS = exports.SUBSCRIPTION_PLAN_FILES_TYPE = exports.VALID_CURRENCY = 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 = void 0;
6
- 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.INCOME_EXPENSE_SOURCE = exports.INCOME_EXPENSE_TYPE = exports.APPOINTMENT_STATUS = exports.MAINTENANCE_TYPE = exports.MAINTENANCE_MODE = exports.MAINTENANCE_MODULE_NAME = exports.ASSIGN_FILE_TYPE = exports.LOST_FOUND_ITEM_STATUS = exports.FREE_SUBSCRIPTION_SEQUENCE = exports.INITIAL_FREE_STORAGE_IN_GB = exports.INITIAL_FREE_COIN = exports.PAYMENT_PROCESSING_CALLBACK_URL = exports.PAYMENT_PROCESSING_PAGE_URL = exports.PAYMENT_PROCESSING_STATUS_URL = exports.COIN_PURCHASE_GST_PERCENTAGE = 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 = void 0;
6
+ 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.INCOME_EXPENSE_SOURCE = exports.INCOME_EXPENSE_TYPE = exports.APPOINTMENT_STATUS = exports.MAINTENANCE_TYPE = exports.MAINTENANCE_MODE = exports.MAINTENANCE_MODULE_NAME = exports.ASSIGN_FILE_TYPE = exports.LOST_FOUND_ITEM_STATUS = exports.FREE_SUBSCRIPTION_SEQUENCE = exports.INITIAL_FREE_STORAGE_IN_GB = exports.INITIAL_FREE_COIN = exports.PAYMENT_PROCESSING_CALLBACK_URL = exports.PAYMENT_PROCESSING_PAGE_URL = exports.PAYMENT_PROCESSING_STATUS_URL = exports.COIN_PURCHASE_GST_PERCENTAGE = 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 = void 0;
7
7
  const env_1 = require("../configs/env");
8
8
  exports.SIXTY = 60;
9
9
  exports.ONE_HUNDRED = 100;
@@ -1254,3 +1254,14 @@ var STUDENT_LEAVE_TYPE;
1254
1254
  STUDENT_LEAVE_TYPE["TODAY"] = "TODAY";
1255
1255
  STUDENT_LEAVE_TYPE["HALF_DAY"] = "HALF_DAY";
1256
1256
  })(STUDENT_LEAVE_TYPE || (exports.STUDENT_LEAVE_TYPE = STUDENT_LEAVE_TYPE = {}));
1257
+ var BANK_ACCOUNT_TYPE;
1258
+ (function (BANK_ACCOUNT_TYPE) {
1259
+ BANK_ACCOUNT_TYPE["SCHOOL"] = "SCHOOL";
1260
+ BANK_ACCOUNT_TYPE["TRUST"] = "TRUST";
1261
+ })(BANK_ACCOUNT_TYPE || (exports.BANK_ACCOUNT_TYPE = BANK_ACCOUNT_TYPE = {}));
1262
+ var FEE_COLLECTION_TYPE;
1263
+ (function (FEE_COLLECTION_TYPE) {
1264
+ FEE_COLLECTION_TYPE["SUBJECT_WISE"] = "SUBJECT_WISE";
1265
+ FEE_COLLECTION_TYPE["BATCH_WISE"] = "BATCH_WISE";
1266
+ FEE_COLLECTION_TYPE["STANDARD_WISE"] = "STANDARD_WISE";
1267
+ })(FEE_COLLECTION_TYPE || (exports.FEE_COLLECTION_TYPE = FEE_COLLECTION_TYPE = {}));
@@ -1,5 +1,5 @@
1
1
  import { IDefaultAttributes } from './commonInterface';
2
- import { COMMAN_STATUS, BOOLEAN_STATUS } from '../constants/app';
2
+ import { COMMAN_STATUS, BOOLEAN_STATUS, PAYMENT_TYPE, BANK_ACCOUNT_TYPE } from '../constants/app';
3
3
  export interface IBankAccountDetailsInterfaceModelAttributes extends IDefaultAttributes {
4
4
  id: string;
5
5
  accountHolderName: string;
@@ -12,5 +12,8 @@ export interface IBankAccountDetailsInterfaceModelAttributes extends IDefaultAtt
12
12
  isDefault: BOOLEAN_STATUS;
13
13
  isSelfAccount: BOOLEAN_STATUS;
14
14
  academicCalendarId?: string;
15
+ type?: BANK_ACCOUNT_TYPE;
15
16
  oldId?: string;
17
+ paymentMethod?: PAYMENT_TYPE[];
18
+ note?: string;
16
19
  }
@@ -0,0 +1,12 @@
1
+ import { Document } from 'mongoose';
2
+ import { IDefaultAttributes } from './commonInterface';
3
+ import { FEE_COLLECTION_TYPE } from '../constants';
4
+ export interface IFeeConfigModelAttributes extends IDefaultAttributes, Document {
5
+ id: string;
6
+ instituteId: string;
7
+ academicCalendarId: string;
8
+ feeCollectionTypes: FEE_COLLECTION_TYPE[];
9
+ isRefundable: boolean;
10
+ isTaxable: boolean;
11
+ oldId?: string;
12
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -162,3 +162,5 @@ export * from './pollSelectionInterface';
162
162
  export * from './eventTemplatesInterface';
163
163
  export * from './studentLeaveRequestInterface';
164
164
  export * from './userDirectoryInterface';
165
+ export * from './feeConfigInterface';
166
+ export * from './schoolFee1Interface';
@@ -178,3 +178,5 @@ __exportStar(require("./pollSelectionInterface"), exports);
178
178
  __exportStar(require("./eventTemplatesInterface"), exports);
179
179
  __exportStar(require("./studentLeaveRequestInterface"), exports);
180
180
  __exportStar(require("./userDirectoryInterface"), exports);
181
+ __exportStar(require("./feeConfigInterface"), exports);
182
+ __exportStar(require("./schoolFee1Interface"), exports);
@@ -0,0 +1,11 @@
1
+ import { Document } from 'mongoose';
2
+ import { IDefaultAttributes } from './commonInterface';
3
+ export interface IInstituteFeeModelAttributes extends IDefaultAttributes, Document {
4
+ id: string;
5
+ instituteId: string;
6
+ academicCalendarId: string;
7
+ subjectId: string;
8
+ batchId: string;
9
+ feeAmount: number;
10
+ oldId?: string;
11
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,33 @@
1
+ import { Document } from 'mongoose';
2
+ import { PAYMENT_TERMS_TYPE, PAYMENT_TYPE } from '../constants/app';
3
+ import { IDefaultAttributes } from './commonInterface';
4
+ export interface ITerms1Schema {
5
+ date: Date;
6
+ amount: number;
7
+ }
8
+ export interface IFeeStructure {
9
+ terms: ITerms1Schema[];
10
+ totalAmount: number;
11
+ frequency: PAYMENT_TERMS_TYPE;
12
+ isNotApplicableForGirls: boolean;
13
+ isRefundable: boolean;
14
+ isTaxable: boolean;
15
+ isRequired: boolean;
16
+ title: string;
17
+ }
18
+ export interface IFee1Schema {
19
+ feeTypeId: string;
20
+ isCreditAllowed: boolean;
21
+ paymentMethod: PAYMENT_TYPE[];
22
+ bankIds: string[];
23
+ fesStructure: IFeeStructure[];
24
+ }
25
+ export interface ISchoolFee1ModelAttributes extends IDefaultAttributes, Document {
26
+ id: string;
27
+ instituteId: string;
28
+ stdId: string[];
29
+ commonDueDate: number;
30
+ fees: IFee1Schema[];
31
+ academicCalendarId: string;
32
+ oldId?: string;
33
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ import { Model } from 'mongoose';
2
+ import { IFeeConfigModelAttributes } from '../../interfaces/feeConfigInterface';
3
+ declare const FeeConfigModel: Model<IFeeConfigModelAttributes>;
4
+ export default FeeConfigModel;
@@ -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 app_1 = require("../../constants/app");
38
+ const FeeConfigSchema = new mongoose_1.Schema({
39
+ instituteId: {
40
+ type: String,
41
+ required: true,
42
+ },
43
+ academicCalendarId: {
44
+ type: String,
45
+ required: true,
46
+ },
47
+ feeCollectionTypes: [
48
+ {
49
+ type: String,
50
+ enum: Object.values(app_1.FEE_COLLECTION_TYPE),
51
+ required: true,
52
+ },
53
+ ],
54
+ isRefundable: {
55
+ type: Boolean,
56
+ required: false,
57
+ },
58
+ isTaxable: {
59
+ type: Boolean,
60
+ required: false,
61
+ },
62
+ oldId: {
63
+ type: String,
64
+ },
65
+ createdBy: {
66
+ type: String,
67
+ },
68
+ updatedBy: {
69
+ type: String,
70
+ },
71
+ deletedBy: {
72
+ type: String,
73
+ },
74
+ }, {
75
+ timestamps: true,
76
+ versionKey: false,
77
+ });
78
+ const FeeConfigModel = mongoose_1.default.model('feeConfigs', FeeConfigSchema);
79
+ exports.default = FeeConfigModel;
@@ -50,3 +50,5 @@ export { default as SheetFieldMappingModel } from './sheetFieldModel';
50
50
  export { default as CreatePollModel } from './createPollModel';
51
51
  export { default as PollSelectionModel } from './pollSelectionModel';
52
52
  export { default as EventTemplatesModel } from './eventTemplatesModel';
53
+ export { default as FeeConfigModel } from './feeConfigModel';
54
+ export { default as SchoolFee1Model } from './schoolFee1Model';
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  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.SchoolFeeModel = 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.EventTemplatesModel = exports.PollSelectionModel = void 0;
7
+ exports.SchoolFee1Model = exports.FeeConfigModel = exports.EventTemplatesModel = exports.PollSelectionModel = 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"));
@@ -126,3 +126,7 @@ var pollSelectionModel_1 = require("./pollSelectionModel");
126
126
  Object.defineProperty(exports, "PollSelectionModel", { enumerable: true, get: function () { return __importDefault(pollSelectionModel_1).default; } });
127
127
  var eventTemplatesModel_1 = require("./eventTemplatesModel");
128
128
  Object.defineProperty(exports, "EventTemplatesModel", { enumerable: true, get: function () { return __importDefault(eventTemplatesModel_1).default; } });
129
+ var feeConfigModel_1 = require("./feeConfigModel");
130
+ Object.defineProperty(exports, "FeeConfigModel", { enumerable: true, get: function () { return __importDefault(feeConfigModel_1).default; } });
131
+ var schoolFee1Model_1 = require("./schoolFee1Model");
132
+ Object.defineProperty(exports, "SchoolFee1Model", { enumerable: true, get: function () { return __importDefault(schoolFee1Model_1).default; } });
@@ -0,0 +1,4 @@
1
+ import { Model } from 'mongoose';
2
+ import { IInstituteFeeModelAttributes } from '../../interfaces/instituteFeeInterface';
3
+ declare const InstituteFeeModel: Model<IInstituteFeeModelAttributes>;
4
+ export default InstituteFeeModel;
@@ -0,0 +1,73 @@
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 InstituteFeeSchema = new mongoose_1.Schema({
38
+ instituteId: {
39
+ type: String,
40
+ required: true,
41
+ },
42
+ academicCalendarId: {
43
+ type: String,
44
+ required: true,
45
+ },
46
+ subjectId: {
47
+ type: String,
48
+ },
49
+ batchId: {
50
+ type: String,
51
+ },
52
+ feeAmount: {
53
+ type: Number,
54
+ required: true,
55
+ },
56
+ oldId: {
57
+ type: String,
58
+ },
59
+ createdBy: {
60
+ type: String,
61
+ },
62
+ updatedBy: {
63
+ type: String,
64
+ },
65
+ deletedBy: {
66
+ type: String,
67
+ },
68
+ }, {
69
+ timestamps: true,
70
+ versionKey: false,
71
+ });
72
+ const InstituteFeeModel = mongoose_1.default.model('instituteFees', InstituteFeeSchema);
73
+ exports.default = InstituteFeeModel;
@@ -0,0 +1,4 @@
1
+ import { Model } from 'mongoose';
2
+ import { ISchoolFee1ModelAttributes } from '../../interfaces/schoolFee1Interface';
3
+ declare const SchoolFee1Model: Model<ISchoolFee1ModelAttributes>;
4
+ export default SchoolFee1Model;
@@ -0,0 +1,228 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ const mongoose_1 = __importStar(require("mongoose"));
40
+ const app_1 = require("../../constants/app");
41
+ const errorMessages_1 = require("../../constants/errorMessages");
42
+ const instituteModel_1 = __importDefault(require("../psql/instituteModel"));
43
+ const userInstituteMetaModel_1 = __importDefault(require("./userInstituteMetaModel"));
44
+ const feeTypeModel_1 = __importDefault(require("../psql/feeTypeModel"));
45
+ const termsSchema = new mongoose_1.Schema({
46
+ date: {
47
+ type: Date,
48
+ required: true,
49
+ },
50
+ amount: {
51
+ type: Number,
52
+ default: 0,
53
+ required: true,
54
+ },
55
+ // paidAmount: {
56
+ // type: Number,
57
+ // default: 0,
58
+ // required: false,
59
+ // },
60
+ }, { _id: false });
61
+ const feeStructureSchema = new mongoose_1.Schema({
62
+ title: {
63
+ type: String,
64
+ required: true,
65
+ },
66
+ frequency: {
67
+ type: String,
68
+ enum: Object.values(app_1.PAYMENT_TERMS_TYPE),
69
+ required: true,
70
+ },
71
+ terms: {
72
+ type: [termsSchema],
73
+ required: true,
74
+ default: [],
75
+ },
76
+ totalAmount: {
77
+ type: Number,
78
+ required: true,
79
+ default: 0,
80
+ },
81
+ isNotApplicableForGirls: {
82
+ type: Boolean,
83
+ default: false,
84
+ },
85
+ isRefundable: {
86
+ type: Boolean,
87
+ default: false,
88
+ },
89
+ isTaxable: {
90
+ type: Boolean,
91
+ default: false,
92
+ },
93
+ isRequired: {
94
+ type: Boolean,
95
+ },
96
+ }, { _id: false });
97
+ const feeSchema = new mongoose_1.Schema({
98
+ feeTypeId: {
99
+ type: String,
100
+ required: true,
101
+ },
102
+ isCreditAllowed: {
103
+ type: Boolean,
104
+ },
105
+ paymentMethod: {
106
+ type: [String],
107
+ enum: Object.values(app_1.PAYMENT_TYPE),
108
+ default: [],
109
+ },
110
+ bankIds: {
111
+ type: [String],
112
+ default: [],
113
+ },
114
+ fesStructure: {
115
+ type: [feeStructureSchema],
116
+ required: true,
117
+ default: [],
118
+ },
119
+ }, { _id: false });
120
+ const schoolFee1Schema = new mongoose_1.Schema({
121
+ instituteId: {
122
+ type: String,
123
+ required: true,
124
+ },
125
+ stdId: {
126
+ type: [String],
127
+ required: true,
128
+ },
129
+ commonDueDate: {
130
+ type: Number,
131
+ required: true,
132
+ },
133
+ fees: {
134
+ type: [feeSchema],
135
+ default: [],
136
+ required: true,
137
+ },
138
+ oldId: {
139
+ type: String,
140
+ required: false,
141
+ },
142
+ academicCalendarId: {
143
+ type: String,
144
+ required: false,
145
+ },
146
+ createdBy: {
147
+ type: String,
148
+ required: false,
149
+ },
150
+ updatedBy: {
151
+ type: String,
152
+ required: false,
153
+ },
154
+ deletedBy: {
155
+ type: String,
156
+ required: false,
157
+ },
158
+ }, {
159
+ timestamps: true,
160
+ versionKey: false,
161
+ });
162
+ schoolFee1Schema.pre('save', async function (next) {
163
+ const schoolFee1 = this;
164
+ try {
165
+ if (!schoolFee1.fees || schoolFee1.fees.length === 0 || schoolFee1.fees.every(fee => fee.fesStructure.length === 0)) {
166
+ return next(new Error('Fees array cannot be empty.'));
167
+ }
168
+ if (schoolFee1.instituteId) {
169
+ const institute = await instituteModel_1.default.findByPk(schoolFee1.instituteId);
170
+ if (!institute) {
171
+ return next(new Error(errorMessages_1.INSTITUTE_ERROR_MESSAGES.NOT_FOUND));
172
+ }
173
+ }
174
+ if (schoolFee1.stdId) {
175
+ const stdExits = await userInstituteMetaModel_1.default.findOne({
176
+ userId: schoolFee1.instituteId,
177
+ instituteId: schoolFee1.instituteId,
178
+ ...(schoolFee1.academicCalendarId && { academicCalendarId: schoolFee1.academicCalendarId }),
179
+ entities: { $all: schoolFee1.stdId },
180
+ });
181
+ if (!stdExits) {
182
+ return next(new Error(errorMessages_1.USER_INSTITUTE_META_ERROR_MESSAGES.STD_NOT_FOUND));
183
+ }
184
+ }
185
+ // const expectedLengths: Record<PAYMENT_TERMS_TYPE, number> = {
186
+ // YEARLY: 1,
187
+ // MONTHLY: 12,
188
+ // HALF_YEARLY: 2,
189
+ // QUARTERLY: 4,
190
+ // FULL_PAYMENT: 1,
191
+ // };
192
+ for (const fee of schoolFee1.fees) {
193
+ if (fee.feeTypeId) {
194
+ const feeType = await feeTypeModel_1.default.findByPk(fee.feeTypeId);
195
+ if (!feeType)
196
+ return next(new Error(errorMessages_1.FEE_TYPE_ERROR_MESSAGES.NOT_FOUND));
197
+ }
198
+ for (const structure of fee.fesStructure) {
199
+ // OPTIONAL: Frequency-based term length validation
200
+ // if (
201
+ // structure.frequency &&
202
+ // expectedLengths[structure.frequency] !== structure.terms.length
203
+ // ) {
204
+ // return next(
205
+ // new Error(
206
+ // `Invalid terms length for ${structure.frequency}. Expected ${expectedLengths[structure.frequency]}, but got ${structure.terms.length}.`
207
+ // )
208
+ // );
209
+ // }
210
+ const totalTermsAmount = structure.terms.reduce((sum, term) => sum + term.amount, 0);
211
+ if (totalTermsAmount !== structure.totalAmount) {
212
+ return next(new Error(`Total amount mismatch for feeTypeId ${fee.feeTypeId}(${structure.title}): Expected ${structure.totalAmount}, but sum of terms is ${totalTermsAmount}.`));
213
+ }
214
+ for (const term of structure.terms) {
215
+ if (!(term.date instanceof Date) || isNaN(term.date.getTime())) {
216
+ return next(new Error(`Invalid date format in terms for feeTypeId ${fee.feeTypeId} (${structure.title}).`));
217
+ }
218
+ }
219
+ }
220
+ }
221
+ next();
222
+ }
223
+ catch (error) {
224
+ return next(error);
225
+ }
226
+ });
227
+ const SchoolFee1Model = mongoose_1.default.model('schoolFee1', schoolFee1Schema);
228
+ exports.default = SchoolFee1Model;
@@ -0,0 +1,2 @@
1
+ import { IFeeConfigModelAttributes } from '../interfaces/feeConfigInterface';
2
+ export type TFeeConfigModelCreationAttributes = Omit<IFeeConfigModelAttributes, 'id'>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -153,3 +153,5 @@ export * from './campusCarnivalType';
153
153
  export * from './eventTemplatesType';
154
154
  export * from './studentLeaveRequestType';
155
155
  export * from './userDirectoryType';
156
+ export * from './feeConfigType';
157
+ export * from './schoolFee1Type';
@@ -169,3 +169,5 @@ __exportStar(require("./campusCarnivalType"), exports);
169
169
  __exportStar(require("./eventTemplatesType"), exports);
170
170
  __exportStar(require("./studentLeaveRequestType"), exports);
171
171
  __exportStar(require("./userDirectoryType"), exports);
172
+ __exportStar(require("./feeConfigType"), exports);
173
+ __exportStar(require("./schoolFee1Type"), exports);
@@ -0,0 +1,2 @@
1
+ import { IInstituteFeeModelAttributes } from '../interfaces/instituteFeeInterface';
2
+ export type TInstituteFeeModelCreationAttributes = Omit<IInstituteFeeModelAttributes, 'id'>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ import { Optional } from 'sequelize';
2
+ import { ISchoolFee1ModelAttributes } from '../interfaces/schoolFee1Interface';
3
+ export type TSchoolFee1ModelCreationAttributes = Optional<ISchoolFee1ModelAttributes, '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.180",
3
+ "version": "1.1.181",
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",