@kipicore/dbcore 1.1.238 → 1.1.240
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.
- package/dist/constants/app.d.ts +11 -5
- package/dist/constants/app.js +446 -2
- package/dist/db/psql/migrations/20260202072445-update-entity-wise-calendar-structure.d.ts +2 -0
- package/dist/db/psql/migrations/20260202072445-update-entity-wise-calendar-structure.js +102 -0
- package/dist/db/psql/migrations/20260202105643-update-academic-calendars-add-hierarchy-and-entity.d.ts +2 -0
- package/dist/db/psql/migrations/20260202105643-update-academic-calendars-add-hierarchy-and-entity.js +90 -0
- package/dist/interfaces/academicCalendarInterface.d.ts +6 -0
- package/dist/interfaces/entityWiseCalendarInterface.d.ts +5 -2
- package/dist/models/psql/academicCalendarModel.d.ts +5 -0
- package/dist/models/psql/academicCalendarModel.js +49 -1
- package/dist/models/psql/entityWiseCalendarModel.d.ts +5 -2
- package/dist/models/psql/entityWiseCalendarModel.js +36 -39
- package/package.json +1 -1
package/dist/constants/app.d.ts
CHANGED
|
@@ -300,7 +300,8 @@ export declare enum BANNER_TYPE {
|
|
|
300
300
|
export declare enum ACADEMIC_CALENDARS_STATUS {
|
|
301
301
|
CURRENT_ACADEMIC_CALENDAR = "CURRENT_ACADEMIC_CALENDAR",
|
|
302
302
|
FUTURE_ACADEMIC_CALENDAR = "FUTURE_ACADEMIC_CALENDAR",
|
|
303
|
-
PAST_ACADEMIC_CALENDAR = "PAST_ACADEMIC_CALENDAR"
|
|
303
|
+
PAST_ACADEMIC_CALENDAR = "PAST_ACADEMIC_CALENDAR",
|
|
304
|
+
SUB_ACADEMIC_CALENDAR = "SUB_ACADEMIC_CALENDAR"
|
|
304
305
|
}
|
|
305
306
|
export declare enum FILE_TYPE {
|
|
306
307
|
FILE_IMAGE = "FILE_IMAGE",
|
|
@@ -485,8 +486,7 @@ export declare enum USER_CHAPTER_INDEX_STATUS {
|
|
|
485
486
|
}
|
|
486
487
|
export declare enum FEE_HISTORY_STATUS {
|
|
487
488
|
COMPLETED = "COMPLETED",
|
|
488
|
-
PENDING = "PENDING"
|
|
489
|
-
DELETED = "DELETED"
|
|
489
|
+
PENDING = "PENDING"
|
|
490
490
|
}
|
|
491
491
|
export declare enum CHAPTER_INDEX_FILE_TYPE {
|
|
492
492
|
VIDEO = "VIDEO",
|
|
@@ -585,7 +585,8 @@ export declare enum RELIGION_CASTE {
|
|
|
585
585
|
BUDDHIST = "BUDDHIST",
|
|
586
586
|
JAIN = "JAIN",
|
|
587
587
|
JEWISH = "JEWISH",
|
|
588
|
-
PARSI = "PARSI"
|
|
588
|
+
PARSI = "PARSI",
|
|
589
|
+
OTHER = "OTHER"
|
|
589
590
|
}
|
|
590
591
|
export declare enum CASTE {
|
|
591
592
|
GENERAL = "GENERAL",
|
|
@@ -607,7 +608,8 @@ export declare enum CASTE {
|
|
|
607
608
|
IYER = "IYER",
|
|
608
609
|
YADAV = "YADAV",
|
|
609
610
|
BHUMIHAR = "BHUMIHAR",
|
|
610
|
-
KOLI = "KOLI"
|
|
611
|
+
KOLI = "KOLI",
|
|
612
|
+
OTHER = "OTHER"
|
|
611
613
|
}
|
|
612
614
|
export declare const SCHOOL_INFORMATION_STEP: 7;
|
|
613
615
|
export declare enum LECTURE_STATUS {
|
|
@@ -1143,3 +1145,7 @@ export declare enum HOME_WORK_TYPE {
|
|
|
1143
1145
|
HOME_WORK = "HOME_WORK",
|
|
1144
1146
|
CLASS_WORK = "CLASS_WORK"
|
|
1145
1147
|
}
|
|
1148
|
+
export declare const ACADEMIC_YEAR_LIST: {
|
|
1149
|
+
startYear: number;
|
|
1150
|
+
endYear: number;
|
|
1151
|
+
}[];
|
package/dist/constants/app.js
CHANGED
|
@@ -4,7 +4,7 @@ exports.NO_TYPE = exports.ADMISSION_TYPE = exports.INSTITUTE_ENTITY_TYPE_SEQUENC
|
|
|
4
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
5
|
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 = exports.SVA_NAME = void 0;
|
|
6
6
|
exports.PAYMENT_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.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.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 = exports.PDF_CHEQUE_FREQUENCY = void 0;
|
|
7
|
-
exports.HOME_WORK_TYPE = exports.STUDENT_FEE_PROCESS_STATUS = void 0;
|
|
7
|
+
exports.ACADEMIC_YEAR_LIST = exports.HOME_WORK_TYPE = exports.STUDENT_FEE_PROCESS_STATUS = void 0;
|
|
8
8
|
const env_1 = require("../configs/env");
|
|
9
9
|
exports.SIXTY = 60;
|
|
10
10
|
exports.ONE_HUNDRED = 100;
|
|
@@ -370,6 +370,7 @@ var ACADEMIC_CALENDARS_STATUS;
|
|
|
370
370
|
ACADEMIC_CALENDARS_STATUS["CURRENT_ACADEMIC_CALENDAR"] = "CURRENT_ACADEMIC_CALENDAR";
|
|
371
371
|
ACADEMIC_CALENDARS_STATUS["FUTURE_ACADEMIC_CALENDAR"] = "FUTURE_ACADEMIC_CALENDAR";
|
|
372
372
|
ACADEMIC_CALENDARS_STATUS["PAST_ACADEMIC_CALENDAR"] = "PAST_ACADEMIC_CALENDAR";
|
|
373
|
+
ACADEMIC_CALENDARS_STATUS["SUB_ACADEMIC_CALENDAR"] = "SUB_ACADEMIC_CALENDAR";
|
|
373
374
|
})(ACADEMIC_CALENDARS_STATUS || (exports.ACADEMIC_CALENDARS_STATUS = ACADEMIC_CALENDARS_STATUS = {}));
|
|
374
375
|
var FILE_TYPE;
|
|
375
376
|
(function (FILE_TYPE) {
|
|
@@ -590,7 +591,6 @@ var FEE_HISTORY_STATUS;
|
|
|
590
591
|
(function (FEE_HISTORY_STATUS) {
|
|
591
592
|
FEE_HISTORY_STATUS["COMPLETED"] = "COMPLETED";
|
|
592
593
|
FEE_HISTORY_STATUS["PENDING"] = "PENDING";
|
|
593
|
-
FEE_HISTORY_STATUS["DELETED"] = "DELETED";
|
|
594
594
|
})(FEE_HISTORY_STATUS || (exports.FEE_HISTORY_STATUS = FEE_HISTORY_STATUS = {}));
|
|
595
595
|
var CHAPTER_INDEX_FILE_TYPE;
|
|
596
596
|
(function (CHAPTER_INDEX_FILE_TYPE) {
|
|
@@ -710,6 +710,7 @@ var RELIGION_CASTE;
|
|
|
710
710
|
RELIGION_CASTE["JAIN"] = "JAIN";
|
|
711
711
|
RELIGION_CASTE["JEWISH"] = "JEWISH";
|
|
712
712
|
RELIGION_CASTE["PARSI"] = "PARSI";
|
|
713
|
+
RELIGION_CASTE["OTHER"] = "OTHER";
|
|
713
714
|
})(RELIGION_CASTE || (exports.RELIGION_CASTE = RELIGION_CASTE = {}));
|
|
714
715
|
var CASTE;
|
|
715
716
|
(function (CASTE) {
|
|
@@ -733,6 +734,7 @@ var CASTE;
|
|
|
733
734
|
CASTE["YADAV"] = "YADAV";
|
|
734
735
|
CASTE["BHUMIHAR"] = "BHUMIHAR";
|
|
735
736
|
CASTE["KOLI"] = "KOLI";
|
|
737
|
+
CASTE["OTHER"] = "OTHER";
|
|
736
738
|
})(CASTE || (exports.CASTE = CASTE = {}));
|
|
737
739
|
exports.SCHOOL_INFORMATION_STEP = 7;
|
|
738
740
|
// SCHOOL_INFORMATION = 'SCHOOL_INFORMATION',
|
|
@@ -1404,3 +1406,445 @@ var HOME_WORK_TYPE;
|
|
|
1404
1406
|
HOME_WORK_TYPE["HOME_WORK"] = "HOME_WORK";
|
|
1405
1407
|
HOME_WORK_TYPE["CLASS_WORK"] = "CLASS_WORK";
|
|
1406
1408
|
})(HOME_WORK_TYPE || (exports.HOME_WORK_TYPE = HOME_WORK_TYPE = {}));
|
|
1409
|
+
exports.ACADEMIC_YEAR_LIST = [
|
|
1410
|
+
{
|
|
1411
|
+
startYear: 1990,
|
|
1412
|
+
endYear: 1991,
|
|
1413
|
+
},
|
|
1414
|
+
{
|
|
1415
|
+
startYear: 1991,
|
|
1416
|
+
endYear: 1992,
|
|
1417
|
+
},
|
|
1418
|
+
{
|
|
1419
|
+
startYear: 1992,
|
|
1420
|
+
endYear: 1993,
|
|
1421
|
+
},
|
|
1422
|
+
{
|
|
1423
|
+
startYear: 1993,
|
|
1424
|
+
endYear: 1994,
|
|
1425
|
+
},
|
|
1426
|
+
{
|
|
1427
|
+
startYear: 1994,
|
|
1428
|
+
endYear: 1995,
|
|
1429
|
+
},
|
|
1430
|
+
{
|
|
1431
|
+
startYear: 1995,
|
|
1432
|
+
endYear: 1996,
|
|
1433
|
+
},
|
|
1434
|
+
{
|
|
1435
|
+
startYear: 1996,
|
|
1436
|
+
endYear: 1997,
|
|
1437
|
+
},
|
|
1438
|
+
{
|
|
1439
|
+
startYear: 1997,
|
|
1440
|
+
endYear: 1998,
|
|
1441
|
+
},
|
|
1442
|
+
{
|
|
1443
|
+
startYear: 1998,
|
|
1444
|
+
endYear: 1999,
|
|
1445
|
+
},
|
|
1446
|
+
{
|
|
1447
|
+
startYear: 1999,
|
|
1448
|
+
endYear: 2000,
|
|
1449
|
+
},
|
|
1450
|
+
{
|
|
1451
|
+
startYear: 2000,
|
|
1452
|
+
endYear: 2001,
|
|
1453
|
+
},
|
|
1454
|
+
{
|
|
1455
|
+
startYear: 2001,
|
|
1456
|
+
endYear: 2002,
|
|
1457
|
+
},
|
|
1458
|
+
{
|
|
1459
|
+
startYear: 2002,
|
|
1460
|
+
endYear: 2003,
|
|
1461
|
+
},
|
|
1462
|
+
{
|
|
1463
|
+
startYear: 2003,
|
|
1464
|
+
endYear: 2004,
|
|
1465
|
+
},
|
|
1466
|
+
{
|
|
1467
|
+
startYear: 2004,
|
|
1468
|
+
endYear: 2005,
|
|
1469
|
+
},
|
|
1470
|
+
{
|
|
1471
|
+
startYear: 2005,
|
|
1472
|
+
endYear: 2006,
|
|
1473
|
+
},
|
|
1474
|
+
{
|
|
1475
|
+
startYear: 2006,
|
|
1476
|
+
endYear: 2007,
|
|
1477
|
+
},
|
|
1478
|
+
{
|
|
1479
|
+
startYear: 2007,
|
|
1480
|
+
endYear: 2008,
|
|
1481
|
+
},
|
|
1482
|
+
{
|
|
1483
|
+
startYear: 2008,
|
|
1484
|
+
endYear: 2009,
|
|
1485
|
+
},
|
|
1486
|
+
{
|
|
1487
|
+
startYear: 2009,
|
|
1488
|
+
endYear: 2010,
|
|
1489
|
+
},
|
|
1490
|
+
{
|
|
1491
|
+
startYear: 2010,
|
|
1492
|
+
endYear: 2011,
|
|
1493
|
+
},
|
|
1494
|
+
{
|
|
1495
|
+
startYear: 2011,
|
|
1496
|
+
endYear: 2012,
|
|
1497
|
+
},
|
|
1498
|
+
{
|
|
1499
|
+
startYear: 2012,
|
|
1500
|
+
endYear: 2013,
|
|
1501
|
+
},
|
|
1502
|
+
{
|
|
1503
|
+
startYear: 2013,
|
|
1504
|
+
endYear: 2014,
|
|
1505
|
+
},
|
|
1506
|
+
{
|
|
1507
|
+
startYear: 2014,
|
|
1508
|
+
endYear: 2015,
|
|
1509
|
+
},
|
|
1510
|
+
{
|
|
1511
|
+
startYear: 2015,
|
|
1512
|
+
endYear: 2016,
|
|
1513
|
+
},
|
|
1514
|
+
{
|
|
1515
|
+
startYear: 2016,
|
|
1516
|
+
endYear: 2017,
|
|
1517
|
+
},
|
|
1518
|
+
{
|
|
1519
|
+
startYear: 2017,
|
|
1520
|
+
endYear: 2018,
|
|
1521
|
+
},
|
|
1522
|
+
{
|
|
1523
|
+
startYear: 2018,
|
|
1524
|
+
endYear: 2019,
|
|
1525
|
+
},
|
|
1526
|
+
{
|
|
1527
|
+
startYear: 2019,
|
|
1528
|
+
endYear: 2020,
|
|
1529
|
+
},
|
|
1530
|
+
{
|
|
1531
|
+
startYear: 2020,
|
|
1532
|
+
endYear: 2021,
|
|
1533
|
+
},
|
|
1534
|
+
{
|
|
1535
|
+
startYear: 2021,
|
|
1536
|
+
endYear: 2022,
|
|
1537
|
+
},
|
|
1538
|
+
{
|
|
1539
|
+
startYear: 2022,
|
|
1540
|
+
endYear: 2023,
|
|
1541
|
+
},
|
|
1542
|
+
{
|
|
1543
|
+
startYear: 2023,
|
|
1544
|
+
endYear: 2024,
|
|
1545
|
+
},
|
|
1546
|
+
{
|
|
1547
|
+
startYear: 2024,
|
|
1548
|
+
endYear: 2025,
|
|
1549
|
+
},
|
|
1550
|
+
{
|
|
1551
|
+
startYear: 2025,
|
|
1552
|
+
endYear: 2026,
|
|
1553
|
+
},
|
|
1554
|
+
{
|
|
1555
|
+
startYear: 2026,
|
|
1556
|
+
endYear: 2027,
|
|
1557
|
+
},
|
|
1558
|
+
{
|
|
1559
|
+
startYear: 2027,
|
|
1560
|
+
endYear: 2028,
|
|
1561
|
+
},
|
|
1562
|
+
{
|
|
1563
|
+
startYear: 2028,
|
|
1564
|
+
endYear: 2029,
|
|
1565
|
+
},
|
|
1566
|
+
{
|
|
1567
|
+
startYear: 2029,
|
|
1568
|
+
endYear: 2030,
|
|
1569
|
+
},
|
|
1570
|
+
{
|
|
1571
|
+
startYear: 2030,
|
|
1572
|
+
endYear: 2031,
|
|
1573
|
+
},
|
|
1574
|
+
{
|
|
1575
|
+
startYear: 2031,
|
|
1576
|
+
endYear: 2032,
|
|
1577
|
+
},
|
|
1578
|
+
{
|
|
1579
|
+
startYear: 2032,
|
|
1580
|
+
endYear: 2033,
|
|
1581
|
+
},
|
|
1582
|
+
{
|
|
1583
|
+
startYear: 2033,
|
|
1584
|
+
endYear: 2034,
|
|
1585
|
+
},
|
|
1586
|
+
{
|
|
1587
|
+
startYear: 2034,
|
|
1588
|
+
endYear: 2035,
|
|
1589
|
+
},
|
|
1590
|
+
{
|
|
1591
|
+
startYear: 2035,
|
|
1592
|
+
endYear: 2036,
|
|
1593
|
+
},
|
|
1594
|
+
{
|
|
1595
|
+
startYear: 2036,
|
|
1596
|
+
endYear: 2037,
|
|
1597
|
+
},
|
|
1598
|
+
{
|
|
1599
|
+
startYear: 2037,
|
|
1600
|
+
endYear: 2038,
|
|
1601
|
+
},
|
|
1602
|
+
{
|
|
1603
|
+
startYear: 2038,
|
|
1604
|
+
endYear: 2039,
|
|
1605
|
+
},
|
|
1606
|
+
{
|
|
1607
|
+
startYear: 2039,
|
|
1608
|
+
endYear: 2040,
|
|
1609
|
+
},
|
|
1610
|
+
{
|
|
1611
|
+
startYear: 2040,
|
|
1612
|
+
endYear: 2041,
|
|
1613
|
+
},
|
|
1614
|
+
{
|
|
1615
|
+
startYear: 2041,
|
|
1616
|
+
endYear: 2042,
|
|
1617
|
+
},
|
|
1618
|
+
{
|
|
1619
|
+
startYear: 2042,
|
|
1620
|
+
endYear: 2043,
|
|
1621
|
+
},
|
|
1622
|
+
{
|
|
1623
|
+
startYear: 2043,
|
|
1624
|
+
endYear: 2044,
|
|
1625
|
+
},
|
|
1626
|
+
{
|
|
1627
|
+
startYear: 2044,
|
|
1628
|
+
endYear: 2045,
|
|
1629
|
+
},
|
|
1630
|
+
{
|
|
1631
|
+
startYear: 2045,
|
|
1632
|
+
endYear: 2046,
|
|
1633
|
+
},
|
|
1634
|
+
{
|
|
1635
|
+
startYear: 2046,
|
|
1636
|
+
endYear: 2047,
|
|
1637
|
+
},
|
|
1638
|
+
{
|
|
1639
|
+
startYear: 2047,
|
|
1640
|
+
endYear: 2048,
|
|
1641
|
+
},
|
|
1642
|
+
{
|
|
1643
|
+
startYear: 2048,
|
|
1644
|
+
endYear: 2049,
|
|
1645
|
+
},
|
|
1646
|
+
{
|
|
1647
|
+
startYear: 2049,
|
|
1648
|
+
endYear: 2050,
|
|
1649
|
+
},
|
|
1650
|
+
{
|
|
1651
|
+
startYear: 2050,
|
|
1652
|
+
endYear: 2051,
|
|
1653
|
+
},
|
|
1654
|
+
{
|
|
1655
|
+
startYear: 2051,
|
|
1656
|
+
endYear: 2052,
|
|
1657
|
+
},
|
|
1658
|
+
{
|
|
1659
|
+
startYear: 2052,
|
|
1660
|
+
endYear: 2053,
|
|
1661
|
+
},
|
|
1662
|
+
{
|
|
1663
|
+
startYear: 2053,
|
|
1664
|
+
endYear: 2054,
|
|
1665
|
+
},
|
|
1666
|
+
{
|
|
1667
|
+
startYear: 2054,
|
|
1668
|
+
endYear: 2055,
|
|
1669
|
+
},
|
|
1670
|
+
{
|
|
1671
|
+
startYear: 2055,
|
|
1672
|
+
endYear: 2056,
|
|
1673
|
+
},
|
|
1674
|
+
{
|
|
1675
|
+
startYear: 2056,
|
|
1676
|
+
endYear: 2057,
|
|
1677
|
+
},
|
|
1678
|
+
{
|
|
1679
|
+
startYear: 2057,
|
|
1680
|
+
endYear: 2058,
|
|
1681
|
+
},
|
|
1682
|
+
{
|
|
1683
|
+
startYear: 2058,
|
|
1684
|
+
endYear: 2059,
|
|
1685
|
+
},
|
|
1686
|
+
{
|
|
1687
|
+
startYear: 2059,
|
|
1688
|
+
endYear: 2060,
|
|
1689
|
+
},
|
|
1690
|
+
{
|
|
1691
|
+
startYear: 2060,
|
|
1692
|
+
endYear: 2061,
|
|
1693
|
+
},
|
|
1694
|
+
{
|
|
1695
|
+
startYear: 2061,
|
|
1696
|
+
endYear: 2062,
|
|
1697
|
+
},
|
|
1698
|
+
{
|
|
1699
|
+
startYear: 2062,
|
|
1700
|
+
endYear: 2063,
|
|
1701
|
+
},
|
|
1702
|
+
{
|
|
1703
|
+
startYear: 2063,
|
|
1704
|
+
endYear: 2064,
|
|
1705
|
+
},
|
|
1706
|
+
{
|
|
1707
|
+
startYear: 2064,
|
|
1708
|
+
endYear: 2065,
|
|
1709
|
+
},
|
|
1710
|
+
{
|
|
1711
|
+
startYear: 2065,
|
|
1712
|
+
endYear: 2066,
|
|
1713
|
+
},
|
|
1714
|
+
{
|
|
1715
|
+
startYear: 2066,
|
|
1716
|
+
endYear: 2067,
|
|
1717
|
+
},
|
|
1718
|
+
{
|
|
1719
|
+
startYear: 2067,
|
|
1720
|
+
endYear: 2068,
|
|
1721
|
+
},
|
|
1722
|
+
{
|
|
1723
|
+
startYear: 2068,
|
|
1724
|
+
endYear: 2069,
|
|
1725
|
+
},
|
|
1726
|
+
{
|
|
1727
|
+
startYear: 2069,
|
|
1728
|
+
endYear: 2070,
|
|
1729
|
+
},
|
|
1730
|
+
{
|
|
1731
|
+
startYear: 2070,
|
|
1732
|
+
endYear: 2071,
|
|
1733
|
+
},
|
|
1734
|
+
{
|
|
1735
|
+
startYear: 2071,
|
|
1736
|
+
endYear: 2072,
|
|
1737
|
+
},
|
|
1738
|
+
{
|
|
1739
|
+
startYear: 2072,
|
|
1740
|
+
endYear: 2073,
|
|
1741
|
+
},
|
|
1742
|
+
{
|
|
1743
|
+
startYear: 2073,
|
|
1744
|
+
endYear: 2074,
|
|
1745
|
+
},
|
|
1746
|
+
{
|
|
1747
|
+
startYear: 2074,
|
|
1748
|
+
endYear: 2075,
|
|
1749
|
+
},
|
|
1750
|
+
{
|
|
1751
|
+
startYear: 2075,
|
|
1752
|
+
endYear: 2076,
|
|
1753
|
+
},
|
|
1754
|
+
{
|
|
1755
|
+
startYear: 2076,
|
|
1756
|
+
endYear: 2077,
|
|
1757
|
+
},
|
|
1758
|
+
{
|
|
1759
|
+
startYear: 2077,
|
|
1760
|
+
endYear: 2078,
|
|
1761
|
+
},
|
|
1762
|
+
{
|
|
1763
|
+
startYear: 2078,
|
|
1764
|
+
endYear: 2079,
|
|
1765
|
+
},
|
|
1766
|
+
{
|
|
1767
|
+
startYear: 2079,
|
|
1768
|
+
endYear: 2080,
|
|
1769
|
+
},
|
|
1770
|
+
{
|
|
1771
|
+
startYear: 2080,
|
|
1772
|
+
endYear: 2081,
|
|
1773
|
+
},
|
|
1774
|
+
{
|
|
1775
|
+
startYear: 2081,
|
|
1776
|
+
endYear: 2082,
|
|
1777
|
+
},
|
|
1778
|
+
{
|
|
1779
|
+
startYear: 2082,
|
|
1780
|
+
endYear: 2083,
|
|
1781
|
+
},
|
|
1782
|
+
{
|
|
1783
|
+
startYear: 2083,
|
|
1784
|
+
endYear: 2084,
|
|
1785
|
+
},
|
|
1786
|
+
{
|
|
1787
|
+
startYear: 2084,
|
|
1788
|
+
endYear: 2085,
|
|
1789
|
+
},
|
|
1790
|
+
{
|
|
1791
|
+
startYear: 2085,
|
|
1792
|
+
endYear: 2086,
|
|
1793
|
+
},
|
|
1794
|
+
{
|
|
1795
|
+
startYear: 2086,
|
|
1796
|
+
endYear: 2087,
|
|
1797
|
+
},
|
|
1798
|
+
{
|
|
1799
|
+
startYear: 2087,
|
|
1800
|
+
endYear: 2088,
|
|
1801
|
+
},
|
|
1802
|
+
{
|
|
1803
|
+
startYear: 2088,
|
|
1804
|
+
endYear: 2089,
|
|
1805
|
+
},
|
|
1806
|
+
{
|
|
1807
|
+
startYear: 2089,
|
|
1808
|
+
endYear: 2090,
|
|
1809
|
+
},
|
|
1810
|
+
{
|
|
1811
|
+
startYear: 2090,
|
|
1812
|
+
endYear: 2091,
|
|
1813
|
+
},
|
|
1814
|
+
{
|
|
1815
|
+
startYear: 2091,
|
|
1816
|
+
endYear: 2092,
|
|
1817
|
+
},
|
|
1818
|
+
{
|
|
1819
|
+
startYear: 2092,
|
|
1820
|
+
endYear: 2093,
|
|
1821
|
+
},
|
|
1822
|
+
{
|
|
1823
|
+
startYear: 2093,
|
|
1824
|
+
endYear: 2094,
|
|
1825
|
+
},
|
|
1826
|
+
{
|
|
1827
|
+
startYear: 2094,
|
|
1828
|
+
endYear: 2095,
|
|
1829
|
+
},
|
|
1830
|
+
{
|
|
1831
|
+
startYear: 2095,
|
|
1832
|
+
endYear: 2096,
|
|
1833
|
+
},
|
|
1834
|
+
{
|
|
1835
|
+
startYear: 2096,
|
|
1836
|
+
endYear: 2097,
|
|
1837
|
+
},
|
|
1838
|
+
{
|
|
1839
|
+
startYear: 2097,
|
|
1840
|
+
endYear: 2098,
|
|
1841
|
+
},
|
|
1842
|
+
{
|
|
1843
|
+
startYear: 2098,
|
|
1844
|
+
endYear: 2099,
|
|
1845
|
+
},
|
|
1846
|
+
{
|
|
1847
|
+
startYear: 2099,
|
|
1848
|
+
endYear: 2100,
|
|
1849
|
+
},
|
|
1850
|
+
];
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const up = async (queryInterface, Sequelize) => {
|
|
3
|
+
const table = await queryInterface.describeTable('entity_wise_calendar');
|
|
4
|
+
// Add parent_id (self reference)
|
|
5
|
+
if (!table.parent_id) {
|
|
6
|
+
await queryInterface.addColumn('entity_wise_calendar', 'parent_id', {
|
|
7
|
+
type: Sequelize.UUID,
|
|
8
|
+
allowNull: true,
|
|
9
|
+
defaultValue: null,
|
|
10
|
+
field: 'parent_id',
|
|
11
|
+
references: {
|
|
12
|
+
model: 'entity_wise_calendar',
|
|
13
|
+
key: 'id',
|
|
14
|
+
},
|
|
15
|
+
onUpdate: 'CASCADE',
|
|
16
|
+
onDelete: 'SET NULL',
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
// Add start_date
|
|
20
|
+
if (!table.start_date) {
|
|
21
|
+
await queryInterface.addColumn('entity_wise_calendar', 'start_date', {
|
|
22
|
+
type: Sequelize.DATE,
|
|
23
|
+
allowNull: true,
|
|
24
|
+
field: 'start_date',
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
// Add end_date
|
|
28
|
+
if (!table.end_date) {
|
|
29
|
+
await queryInterface.addColumn('entity_wise_calendar', 'end_date', {
|
|
30
|
+
type: Sequelize.DATE,
|
|
31
|
+
allowNull: true,
|
|
32
|
+
field: 'end_date',
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
// Add start_year
|
|
36
|
+
if (!table.start_year) {
|
|
37
|
+
await queryInterface.addColumn('entity_wise_calendar', 'start_year', {
|
|
38
|
+
type: Sequelize.INTEGER,
|
|
39
|
+
allowNull: true,
|
|
40
|
+
field: 'start_year',
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
// Add end_year
|
|
44
|
+
if (!table.end_year) {
|
|
45
|
+
await queryInterface.addColumn('entity_wise_calendar', 'end_year', {
|
|
46
|
+
type: Sequelize.INTEGER,
|
|
47
|
+
allowNull: true,
|
|
48
|
+
field: 'end_year',
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
// Remove academic_calendar_id (old design)
|
|
52
|
+
if (table.academic_calendar_id) {
|
|
53
|
+
await queryInterface.removeColumn('entity_wise_calendar', 'academic_calendar_id');
|
|
54
|
+
}
|
|
55
|
+
// Remove institute_id (old design)
|
|
56
|
+
if (table.institute_id) {
|
|
57
|
+
await queryInterface.removeColumn('entity_wise_calendar', 'institute_id');
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
const down = async (queryInterface, Sequelize) => {
|
|
61
|
+
const table = await queryInterface.describeTable('entity_wise_calendar');
|
|
62
|
+
// Re-add academic_calendar_id
|
|
63
|
+
if (!table.academic_calendar_id) {
|
|
64
|
+
await queryInterface.addColumn('entity_wise_calendar', 'academic_calendar_id', {
|
|
65
|
+
type: Sequelize.UUID,
|
|
66
|
+
allowNull: true,
|
|
67
|
+
field: 'academic_calendar_id',
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
// Re-add institute_id
|
|
71
|
+
if (!table.institute_id) {
|
|
72
|
+
await queryInterface.addColumn('entity_wise_calendar', 'institute_id', {
|
|
73
|
+
type: Sequelize.UUID,
|
|
74
|
+
allowNull: true,
|
|
75
|
+
field: 'institute_id',
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
// Remove parent_id
|
|
79
|
+
if (table.parent_id) {
|
|
80
|
+
await queryInterface.removeColumn('entity_wise_calendar', 'parent_id');
|
|
81
|
+
}
|
|
82
|
+
// Remove start_date
|
|
83
|
+
if (table.start_date) {
|
|
84
|
+
await queryInterface.removeColumn('entity_wise_calendar', 'start_date');
|
|
85
|
+
}
|
|
86
|
+
// Remove end_date
|
|
87
|
+
if (table.end_date) {
|
|
88
|
+
await queryInterface.removeColumn('entity_wise_calendar', 'end_date');
|
|
89
|
+
}
|
|
90
|
+
// Remove start_year
|
|
91
|
+
if (table.start_year) {
|
|
92
|
+
await queryInterface.removeColumn('entity_wise_calendar', 'start_year');
|
|
93
|
+
}
|
|
94
|
+
// Remove end_year
|
|
95
|
+
if (table.end_year) {
|
|
96
|
+
await queryInterface.removeColumn('entity_wise_calendar', 'end_year');
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
module.exports = {
|
|
100
|
+
up,
|
|
101
|
+
down,
|
|
102
|
+
};
|
package/dist/db/psql/migrations/20260202105643-update-academic-calendars-add-hierarchy-and-entity.js
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const up = async (queryInterface, Sequelize) => {
|
|
3
|
+
const table = await queryInterface.describeTable('academic_calendars');
|
|
4
|
+
// start_year
|
|
5
|
+
if (!table.start_year) {
|
|
6
|
+
await queryInterface.addColumn('academic_calendars', 'start_year', {
|
|
7
|
+
type: Sequelize.INTEGER,
|
|
8
|
+
allowNull: true,
|
|
9
|
+
field: 'start_year',
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
// end_year
|
|
13
|
+
if (!table.end_year) {
|
|
14
|
+
await queryInterface.addColumn('academic_calendars', 'end_year', {
|
|
15
|
+
type: Sequelize.INTEGER,
|
|
16
|
+
allowNull: true,
|
|
17
|
+
field: 'end_year',
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
// parent_id (self reference)
|
|
21
|
+
if (!table.parent_id) {
|
|
22
|
+
await queryInterface.addColumn('academic_calendars', 'parent_id', {
|
|
23
|
+
type: Sequelize.UUID,
|
|
24
|
+
allowNull: true,
|
|
25
|
+
field: 'parent_id',
|
|
26
|
+
references: {
|
|
27
|
+
model: 'academic_calendars',
|
|
28
|
+
key: 'id',
|
|
29
|
+
},
|
|
30
|
+
onUpdate: 'CASCADE',
|
|
31
|
+
onDelete: 'SET NULL',
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
// entity_id (InstituteEntityModel)
|
|
35
|
+
if (!table.entity_id) {
|
|
36
|
+
await queryInterface.addColumn('academic_calendars', 'entity_id', {
|
|
37
|
+
type: Sequelize.UUID,
|
|
38
|
+
allowNull: true,
|
|
39
|
+
field: 'entity_id',
|
|
40
|
+
references: {
|
|
41
|
+
model: 'institute_entities',
|
|
42
|
+
key: 'id',
|
|
43
|
+
},
|
|
44
|
+
onUpdate: 'CASCADE',
|
|
45
|
+
onDelete: 'SET NULL',
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
// base_id (logical root / grouping)
|
|
49
|
+
if (!table.base_id) {
|
|
50
|
+
await queryInterface.addColumn('academic_calendars', 'base_id', {
|
|
51
|
+
type: Sequelize.UUID,
|
|
52
|
+
allowNull: true,
|
|
53
|
+
field: 'base_id',
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
// is_updated flag
|
|
57
|
+
if (!table.is_updated) {
|
|
58
|
+
await queryInterface.addColumn('academic_calendars', 'is_updated', {
|
|
59
|
+
type: Sequelize.BOOLEAN,
|
|
60
|
+
allowNull: false,
|
|
61
|
+
defaultValue: false,
|
|
62
|
+
field: 'is_updated',
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
const down = async (queryInterface, Sequelize) => {
|
|
67
|
+
const table = await queryInterface.describeTable('academic_calendars');
|
|
68
|
+
if (table.is_updated) {
|
|
69
|
+
await queryInterface.removeColumn('academic_calendars', 'is_updated');
|
|
70
|
+
}
|
|
71
|
+
if (table.base_id) {
|
|
72
|
+
await queryInterface.removeColumn('academic_calendars', 'base_id');
|
|
73
|
+
}
|
|
74
|
+
if (table.entity_id) {
|
|
75
|
+
await queryInterface.removeColumn('academic_calendars', 'entity_id');
|
|
76
|
+
}
|
|
77
|
+
if (table.parent_id) {
|
|
78
|
+
await queryInterface.removeColumn('academic_calendars', 'parent_id');
|
|
79
|
+
}
|
|
80
|
+
if (table.end_year) {
|
|
81
|
+
await queryInterface.removeColumn('academic_calendars', 'end_year');
|
|
82
|
+
}
|
|
83
|
+
if (table.start_year) {
|
|
84
|
+
await queryInterface.removeColumn('academic_calendars', 'start_year');
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
module.exports = {
|
|
88
|
+
up,
|
|
89
|
+
down,
|
|
90
|
+
};
|
|
@@ -6,4 +6,10 @@ export interface IAcademicCalendarModelAttributes extends IDefaultAttributes {
|
|
|
6
6
|
endDate: Date;
|
|
7
7
|
instituteId: string;
|
|
8
8
|
status: ACADEMIC_CALENDARS_STATUS;
|
|
9
|
+
parentId: string;
|
|
10
|
+
entityId: string;
|
|
11
|
+
baseId: string;
|
|
12
|
+
startYear: number;
|
|
13
|
+
endYear: number;
|
|
14
|
+
isUpdated?: boolean;
|
|
9
15
|
}
|
|
@@ -2,8 +2,11 @@ import { ACADEMIC_CALENDARS_STATUS } from '../constants/app';
|
|
|
2
2
|
import { IDefaultAttributes } from './commonInterface';
|
|
3
3
|
export interface IEntityWiseCalendarModelAttributes extends IDefaultAttributes {
|
|
4
4
|
id: string;
|
|
5
|
+
parentId?: string;
|
|
5
6
|
entityId: string;
|
|
6
|
-
instituteId?: string;
|
|
7
|
-
academicCalendarId?: string;
|
|
8
7
|
status: ACADEMIC_CALENDARS_STATUS;
|
|
8
|
+
startDate: Date;
|
|
9
|
+
endDate: Date;
|
|
10
|
+
startYear: number;
|
|
11
|
+
endYear: number;
|
|
9
12
|
}
|
|
@@ -8,6 +8,11 @@ export declare class AcademicCalendarModel extends Model<IAcademicCalendarModelA
|
|
|
8
8
|
startDate: Date;
|
|
9
9
|
endDate: Date;
|
|
10
10
|
status: ACADEMIC_CALENDARS_STATUS;
|
|
11
|
+
parentId: string;
|
|
12
|
+
entityId: string;
|
|
13
|
+
baseId: string;
|
|
14
|
+
startYear: number;
|
|
15
|
+
endYear: number;
|
|
11
16
|
createdBy: string;
|
|
12
17
|
updatedBy: string;
|
|
13
18
|
deletedBy: string;
|
|
@@ -6,7 +6,7 @@ const app_1 = require("../../constants/app");
|
|
|
6
6
|
const index_1 = require("./index");
|
|
7
7
|
class AcademicCalendarModel extends sequelize_1.Model {
|
|
8
8
|
static associate(models) {
|
|
9
|
-
const { InstituteModel, UserModel } = models;
|
|
9
|
+
const { InstituteModel, UserModel, InstituteEntityModel } = models;
|
|
10
10
|
AcademicCalendarModel.belongsTo(InstituteModel, {
|
|
11
11
|
foreignKey: {
|
|
12
12
|
name: 'instituteId',
|
|
@@ -42,6 +42,24 @@ class AcademicCalendarModel extends sequelize_1.Model {
|
|
|
42
42
|
foreignKey: 'instituteId',
|
|
43
43
|
as: 'instituteHasAcademicCalendars',
|
|
44
44
|
});
|
|
45
|
+
// Self-referencing hierarchy
|
|
46
|
+
AcademicCalendarModel.belongsTo(AcademicCalendarModel, {
|
|
47
|
+
foreignKey: { name: 'parentId', field: 'parent_id' },
|
|
48
|
+
as: 'parentAcademicCalendar',
|
|
49
|
+
});
|
|
50
|
+
AcademicCalendarModel.hasMany(AcademicCalendarModel, {
|
|
51
|
+
foreignKey: { name: 'parentId', field: 'parent_id' },
|
|
52
|
+
as: 'subAcademicCalendarList',
|
|
53
|
+
});
|
|
54
|
+
// Entity relation
|
|
55
|
+
AcademicCalendarModel.belongsTo(InstituteEntityModel, {
|
|
56
|
+
foreignKey: { name: 'entityId', field: 'entity_id' },
|
|
57
|
+
as: 'academicCalendarEntity',
|
|
58
|
+
});
|
|
59
|
+
InstituteEntityModel.hasMany(AcademicCalendarModel, {
|
|
60
|
+
foreignKey: { name: 'entityId', field: 'entity_id' },
|
|
61
|
+
as: 'academicCalendarEntityList',
|
|
62
|
+
});
|
|
45
63
|
}
|
|
46
64
|
}
|
|
47
65
|
exports.AcademicCalendarModel = AcademicCalendarModel;
|
|
@@ -73,6 +91,36 @@ AcademicCalendarModel.init({
|
|
|
73
91
|
allowNull: false,
|
|
74
92
|
defaultValue: app_1.ACADEMIC_CALENDARS_STATUS.FUTURE_ACADEMIC_CALENDAR,
|
|
75
93
|
},
|
|
94
|
+
startYear: {
|
|
95
|
+
type: sequelize_1.DataTypes.INTEGER,
|
|
96
|
+
field: 'start_year',
|
|
97
|
+
allowNull: true,
|
|
98
|
+
},
|
|
99
|
+
endYear: {
|
|
100
|
+
type: sequelize_1.DataTypes.INTEGER,
|
|
101
|
+
field: 'end_year',
|
|
102
|
+
allowNull: true,
|
|
103
|
+
},
|
|
104
|
+
parentId: {
|
|
105
|
+
type: sequelize_1.DataTypes.UUID,
|
|
106
|
+
field: 'parent_id',
|
|
107
|
+
allowNull: true,
|
|
108
|
+
},
|
|
109
|
+
entityId: {
|
|
110
|
+
type: sequelize_1.DataTypes.UUID,
|
|
111
|
+
field: 'entity_id',
|
|
112
|
+
allowNull: true,
|
|
113
|
+
},
|
|
114
|
+
baseId: {
|
|
115
|
+
type: sequelize_1.DataTypes.UUID,
|
|
116
|
+
field: 'base_id',
|
|
117
|
+
allowNull: true,
|
|
118
|
+
},
|
|
119
|
+
isUpdated: {
|
|
120
|
+
type: sequelize_1.DataTypes.BOOLEAN,
|
|
121
|
+
field: 'is_updated',
|
|
122
|
+
defaultValue: false,
|
|
123
|
+
},
|
|
76
124
|
}, {
|
|
77
125
|
modelName: 'AcademicCalendarModel',
|
|
78
126
|
tableName: 'academic_calendars',
|
|
@@ -4,10 +4,13 @@ import { TEntityWiseCalendarModelCreationAttributes } from '../../types/entityWi
|
|
|
4
4
|
import { ACADEMIC_CALENDARS_STATUS } from '../../constants/app';
|
|
5
5
|
declare class EntityWiseCalendarModel extends Model<IEntityWiseCalendarModelAttributes, TEntityWiseCalendarModelCreationAttributes> {
|
|
6
6
|
id: string;
|
|
7
|
-
|
|
8
|
-
academicCalendarId?: string;
|
|
7
|
+
parentId?: string;
|
|
9
8
|
entityId: string;
|
|
10
9
|
status: ACADEMIC_CALENDARS_STATUS;
|
|
10
|
+
startDate: Date;
|
|
11
|
+
endDate: Date;
|
|
12
|
+
startYear: number;
|
|
13
|
+
endYear: number;
|
|
11
14
|
createdBy: string;
|
|
12
15
|
updatedBy: string;
|
|
13
16
|
deletedBy: string;
|
|
@@ -5,54 +5,36 @@ const index_1 = require("./index");
|
|
|
5
5
|
const app_1 = require("../../constants/app");
|
|
6
6
|
class EntityWiseCalendarModel extends sequelize_1.Model {
|
|
7
7
|
static associate(models) {
|
|
8
|
-
const { UserModel,
|
|
8
|
+
const { UserModel, InstituteEntityModel } = models;
|
|
9
9
|
EntityWiseCalendarModel.belongsTo(UserModel, {
|
|
10
|
-
foreignKey: {
|
|
11
|
-
name: 'createdBy',
|
|
12
|
-
allowNull: true,
|
|
13
|
-
field: 'created_by',
|
|
14
|
-
},
|
|
10
|
+
foreignKey: { name: 'createdBy', field: 'created_by' },
|
|
15
11
|
as: 'createdByUser',
|
|
16
12
|
});
|
|
17
13
|
EntityWiseCalendarModel.belongsTo(UserModel, {
|
|
18
|
-
foreignKey: {
|
|
19
|
-
name: 'updatedBy',
|
|
20
|
-
allowNull: true,
|
|
21
|
-
field: 'updated_by',
|
|
22
|
-
},
|
|
14
|
+
foreignKey: { name: 'updatedBy', field: 'updated_by' },
|
|
23
15
|
as: 'updatedByUser',
|
|
24
16
|
});
|
|
25
17
|
EntityWiseCalendarModel.belongsTo(UserModel, {
|
|
26
|
-
foreignKey: {
|
|
27
|
-
name: 'deletedBy',
|
|
28
|
-
allowNull: true,
|
|
29
|
-
field: 'deleted_by',
|
|
30
|
-
},
|
|
18
|
+
foreignKey: { name: 'deletedBy', field: 'deleted_by' },
|
|
31
19
|
as: 'deletedByUser',
|
|
32
20
|
});
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
21
|
+
// Self-referencing hierarchy
|
|
22
|
+
EntityWiseCalendarModel.belongsTo(EntityWiseCalendarModel, {
|
|
23
|
+
foreignKey: { name: 'parentId', field: 'parent_id' },
|
|
24
|
+
as: 'parentEntityWiseCalendar',
|
|
36
25
|
});
|
|
37
|
-
|
|
38
|
-
foreignKey: { name: '
|
|
39
|
-
as: '
|
|
40
|
-
});
|
|
41
|
-
EntityWiseCalendarModel.belongsTo(AcademicCalendarModel, {
|
|
42
|
-
foreignKey: { name: 'academicCalendarId', field: 'academic_calendar_id' },
|
|
43
|
-
as: 'entityWiseAcademicCalendar',
|
|
44
|
-
});
|
|
45
|
-
AcademicCalendarModel.hasMany(EntityWiseCalendarModel, {
|
|
46
|
-
foreignKey: { name: 'academicCalendarId', field: 'academic_calendar_id' },
|
|
47
|
-
as: 'academicCalendarIdHasEntityWiseCalendar',
|
|
26
|
+
EntityWiseCalendarModel.hasMany(EntityWiseCalendarModel, {
|
|
27
|
+
foreignKey: { name: 'parentId', field: 'parent_id' },
|
|
28
|
+
as: 'subEntityWiseCalendarList',
|
|
48
29
|
});
|
|
30
|
+
// Entity relation
|
|
49
31
|
EntityWiseCalendarModel.belongsTo(InstituteEntityModel, {
|
|
50
32
|
foreignKey: { name: 'entityId', field: 'entity_id' },
|
|
51
33
|
as: 'entityWiseCalendarEntity',
|
|
52
34
|
});
|
|
53
35
|
InstituteEntityModel.hasMany(EntityWiseCalendarModel, {
|
|
54
36
|
foreignKey: { name: 'entityId', field: 'entity_id' },
|
|
55
|
-
as: '
|
|
37
|
+
as: 'entityWiseCalendarEntityList',
|
|
56
38
|
});
|
|
57
39
|
}
|
|
58
40
|
}
|
|
@@ -63,14 +45,9 @@ EntityWiseCalendarModel.init({
|
|
|
63
45
|
allowNull: false,
|
|
64
46
|
primaryKey: true,
|
|
65
47
|
},
|
|
66
|
-
|
|
67
|
-
type: sequelize_1.DataTypes.UUID,
|
|
68
|
-
field: 'academic_calendar_id',
|
|
69
|
-
allowNull: true,
|
|
70
|
-
},
|
|
71
|
-
instituteId: {
|
|
48
|
+
parentId: {
|
|
72
49
|
type: sequelize_1.DataTypes.UUID,
|
|
73
|
-
field: '
|
|
50
|
+
field: 'parent_id',
|
|
74
51
|
allowNull: true,
|
|
75
52
|
},
|
|
76
53
|
entityId: {
|
|
@@ -80,8 +57,28 @@ EntityWiseCalendarModel.init({
|
|
|
80
57
|
},
|
|
81
58
|
status: {
|
|
82
59
|
type: sequelize_1.DataTypes.STRING,
|
|
60
|
+
allowNull: false,
|
|
83
61
|
defaultValue: app_1.ACADEMIC_CALENDARS_STATUS.CURRENT_ACADEMIC_CALENDAR,
|
|
84
|
-
|
|
62
|
+
},
|
|
63
|
+
startDate: {
|
|
64
|
+
type: sequelize_1.DataTypes.DATE,
|
|
65
|
+
field: 'start_date',
|
|
66
|
+
allowNull: false,
|
|
67
|
+
},
|
|
68
|
+
endDate: {
|
|
69
|
+
type: sequelize_1.DataTypes.DATE,
|
|
70
|
+
field: 'end_date',
|
|
71
|
+
allowNull: false,
|
|
72
|
+
},
|
|
73
|
+
startYear: {
|
|
74
|
+
type: sequelize_1.DataTypes.INTEGER,
|
|
75
|
+
field: 'start_year',
|
|
76
|
+
allowNull: false,
|
|
77
|
+
},
|
|
78
|
+
endYear: {
|
|
79
|
+
type: sequelize_1.DataTypes.INTEGER,
|
|
80
|
+
field: 'end_year',
|
|
81
|
+
allowNull: false,
|
|
85
82
|
},
|
|
86
83
|
}, {
|
|
87
84
|
modelName: 'EntityWiseCalendar',
|
package/package.json
CHANGED