@kipicore/dbcore 1.1.730 → 1.1.732
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/db/psql/migrations/20260818184500-change_announcements_enums_to_string.js +28 -29
- package/dist/db/psql/migrations/20260818185000-change_user_has_announcements_status_enum_to_string.js +1 -0
- package/dist/db/psql/migrations/20260819070134-create-master-designations.d.ts +2 -0
- package/dist/db/psql/migrations/20260819070134-create-master-designations.js +81 -0
- package/dist/db/psql/migrations/20260819120000-rename_announcements_user_types_column.d.ts +2 -0
- package/dist/db/psql/migrations/20260819120000-rename_announcements_user_types_column.js +23 -0
- package/dist/db/psql/migrations/20260819140000-fix_announcements_user_types_to_array.d.ts +2 -0
- package/dist/db/psql/migrations/20260819140000-fix_announcements_user_types_to_array.js +38 -0
- package/dist/interfaces/index.d.ts +1 -0
- package/dist/interfaces/index.js +1 -0
- package/dist/interfaces/masterDesignationInterface.d.ts +12 -0
- package/dist/interfaces/masterDesignationInterface.js +2 -0
- package/dist/models/psql/index.d.ts +1 -0
- package/dist/models/psql/index.js +3 -1
- package/dist/models/psql/masterDesignationModel.d.ts +22 -0
- package/dist/models/psql/masterDesignationModel.js +83 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/masterDesignationType.d.ts +9 -0
- package/dist/types/masterDesignationType.js +2 -0
- package/package.json +1 -1
- package/dist/db/psql/migrations/20260819160514-change_announcements_user_types_enum_to_string.d.ts +0 -2
- package/dist/db/psql/migrations/20260819160514-change_announcements_user_types_enum_to_string.js +0 -164
|
@@ -8,7 +8,6 @@ module.exports = {
|
|
|
8
8
|
return;
|
|
9
9
|
const fieldsToUpdate = [
|
|
10
10
|
{ name: 'schedule_type', defaultValue: null, allowNull: false },
|
|
11
|
-
{ name: 'userTypes', defaultValue: null, allowNull: true },
|
|
12
11
|
{ name: 'status', defaultValue: 'PENDING', allowNull: false },
|
|
13
12
|
];
|
|
14
13
|
for (const field of fieldsToUpdate) {
|
|
@@ -34,6 +33,13 @@ module.exports = {
|
|
|
34
33
|
}
|
|
35
34
|
}
|
|
36
35
|
}
|
|
36
|
+
// userTypes is an ARRAY column (an announcement can target multiple user
|
|
37
|
+
// types) — it must stay ARRAY(VARCHAR), never collapse to a scalar VARCHAR.
|
|
38
|
+
if (table.userTypes) {
|
|
39
|
+
await queryInterface.sequelize.query('ALTER TABLE announcementes ALTER COLUMN "userTypes" DROP DEFAULT;');
|
|
40
|
+
await queryInterface.sequelize.query('ALTER TABLE announcementes ALTER COLUMN "userTypes" TYPE VARCHAR(255)[] USING "userTypes"::text[]::VARCHAR(255)[];');
|
|
41
|
+
await queryInterface.sequelize.query('ALTER TABLE announcementes ALTER COLUMN "userTypes" SET DEFAULT ARRAY[]::VARCHAR(255)[];');
|
|
42
|
+
}
|
|
37
43
|
},
|
|
38
44
|
down: async (queryInterface, Sequelize) => {
|
|
39
45
|
const table = await queryInterface
|
|
@@ -57,36 +63,29 @@ module.exports = {
|
|
|
57
63
|
}
|
|
58
64
|
}
|
|
59
65
|
if (table.userTypes) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
66
|
+
await queryInterface.sequelize.query(`
|
|
67
|
+
DO $$ BEGIN
|
|
68
|
+
CREATE TYPE "enum_announcementes_userTypes" AS ENUM (
|
|
69
|
+
'MASTER_ADMIN', 'ADMIN', 'INSTITUTE_MASTER_ADMIN', 'INSTITUTE_ADMIN',
|
|
70
|
+
'TEACHER', 'STUDENT', 'PARENTS', 'DRIVER', 'VENDOR',
|
|
71
|
+
'SPORT_INSTITUTE_OWNER', 'SPORT_TRAINER', 'SPORT_ATHLETE'
|
|
72
|
+
);
|
|
73
|
+
EXCEPTION WHEN duplicate_object THEN null;
|
|
74
|
+
END $$;
|
|
75
|
+
`);
|
|
76
|
+
await queryInterface.sequelize.query('ALTER TABLE announcementes ALTER COLUMN "userTypes" DROP DEFAULT;');
|
|
77
|
+
await queryInterface.sequelize.query('ALTER TABLE announcementes ALTER COLUMN "userTypes" TYPE "enum_announcementes_userTypes"[] USING "userTypes"::text[]::"enum_announcementes_userTypes"[];');
|
|
73
78
|
}
|
|
74
79
|
if (table.status) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
await queryInterface.changeColumn('announcementes', 'status', {
|
|
85
|
-
type: Sequelize.ENUM('PENDING', 'PROCESSING', 'CREATED'),
|
|
86
|
-
allowNull: false,
|
|
87
|
-
defaultValue: 'PENDING',
|
|
88
|
-
});
|
|
89
|
-
}
|
|
80
|
+
await queryInterface.sequelize.query(`
|
|
81
|
+
DO $$ BEGIN
|
|
82
|
+
CREATE TYPE "enum_announcementes_status" AS ENUM ('PENDING', 'PROCESSING', 'CREATED');
|
|
83
|
+
EXCEPTION WHEN duplicate_object THEN null;
|
|
84
|
+
END $$;
|
|
85
|
+
`);
|
|
86
|
+
await queryInterface.sequelize.query('ALTER TABLE announcementes ALTER COLUMN status DROP DEFAULT;');
|
|
87
|
+
await queryInterface.sequelize.query('ALTER TABLE announcementes ALTER COLUMN status TYPE "enum_announcementes_status" USING status::text::"enum_announcementes_status";');
|
|
88
|
+
await queryInterface.sequelize.query(`ALTER TABLE announcementes ALTER COLUMN status SET DEFAULT 'PENDING'::"enum_announcementes_status";`);
|
|
90
89
|
}
|
|
91
90
|
}
|
|
92
91
|
};
|
|
@@ -34,6 +34,7 @@ module.exports = {
|
|
|
34
34
|
return;
|
|
35
35
|
if (table.status) {
|
|
36
36
|
try {
|
|
37
|
+
await queryInterface.sequelize.query('ALTER TABLE user_has_announcementes ALTER COLUMN status DROP DEFAULT;');
|
|
37
38
|
await queryInterface.sequelize.query('ALTER TABLE user_has_announcementes ALTER COLUMN status TYPE "enum_user_has_announcementes_status" USING status::text::"enum_user_has_announcementes_status";');
|
|
38
39
|
await queryInterface.changeColumn('user_has_announcementes', 'status', {
|
|
39
40
|
type: Sequelize.ENUM('SENT', 'VIEW'),
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/** @type {import('sequelize-cli').Migration} */
|
|
3
|
+
module.exports = {
|
|
4
|
+
async up(queryInterface, Sequelize) {
|
|
5
|
+
await queryInterface.createDatabase('master_designations', {
|
|
6
|
+
id: {
|
|
7
|
+
type: Sequelize.UUID,
|
|
8
|
+
defaultValue: Sequelize.UUIDV4,
|
|
9
|
+
allowNull: false,
|
|
10
|
+
primaryKey: true,
|
|
11
|
+
},
|
|
12
|
+
designationTitle: {
|
|
13
|
+
type: Sequelize.ARRAY(Sequelize.STRING),
|
|
14
|
+
allowNull: true,
|
|
15
|
+
field: 'designation_title',
|
|
16
|
+
},
|
|
17
|
+
title: {
|
|
18
|
+
type: Sequelize.STRING,
|
|
19
|
+
allowNull: true,
|
|
20
|
+
},
|
|
21
|
+
appType: {
|
|
22
|
+
type: Sequelize.ARRAY(Sequelize.STRING),
|
|
23
|
+
allowNull: true,
|
|
24
|
+
field: 'app_type',
|
|
25
|
+
},
|
|
26
|
+
userType: {
|
|
27
|
+
type: Sequelize.ARRAY(Sequelize.STRING),
|
|
28
|
+
allowNull: true,
|
|
29
|
+
field: 'user_type',
|
|
30
|
+
},
|
|
31
|
+
isInstituteDefault: {
|
|
32
|
+
type: Sequelize.BOOLEAN,
|
|
33
|
+
allowNull: true,
|
|
34
|
+
field: 'is_institute_default',
|
|
35
|
+
},
|
|
36
|
+
instituteId: {
|
|
37
|
+
type: Sequelize.UUID,
|
|
38
|
+
allowNull: true,
|
|
39
|
+
field: 'institute_id',
|
|
40
|
+
},
|
|
41
|
+
masterId: {
|
|
42
|
+
type: Sequelize.UUID,
|
|
43
|
+
allowNull: true,
|
|
44
|
+
field: 'master_id',
|
|
45
|
+
},
|
|
46
|
+
createdBy: {
|
|
47
|
+
type: Sequelize.UUID,
|
|
48
|
+
allowNull: true,
|
|
49
|
+
field: 'created_by',
|
|
50
|
+
},
|
|
51
|
+
updatedBy: {
|
|
52
|
+
type: Sequelize.UUID,
|
|
53
|
+
allowNull: true,
|
|
54
|
+
field: 'updated_by',
|
|
55
|
+
},
|
|
56
|
+
deletedBy: {
|
|
57
|
+
type: Sequelize.UUID,
|
|
58
|
+
allowNull: true,
|
|
59
|
+
field: 'deleted_by',
|
|
60
|
+
},
|
|
61
|
+
createdAt: {
|
|
62
|
+
type: Sequelize.DATE,
|
|
63
|
+
allowNull: false,
|
|
64
|
+
field: 'created_at',
|
|
65
|
+
},
|
|
66
|
+
updatedAt: {
|
|
67
|
+
type: Sequelize.DATE,
|
|
68
|
+
allowNull: false,
|
|
69
|
+
field: 'updated_at',
|
|
70
|
+
},
|
|
71
|
+
deletedAt: {
|
|
72
|
+
type: Sequelize.DATE,
|
|
73
|
+
allowNull: true,
|
|
74
|
+
field: 'deleted_at',
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
},
|
|
78
|
+
async down(queryInterface) {
|
|
79
|
+
await queryInterface.dropTable('master_designations');
|
|
80
|
+
},
|
|
81
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
module.exports = {
|
|
3
|
+
up: async (queryInterface) => {
|
|
4
|
+
const table = await queryInterface
|
|
5
|
+
.describeTable('announcementes')
|
|
6
|
+
.catch(() => null);
|
|
7
|
+
if (!table)
|
|
8
|
+
return;
|
|
9
|
+
if (table.userTypes && !table.user_types) {
|
|
10
|
+
await queryInterface.renameColumn('announcementes', 'userTypes', 'user_types');
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
down: async (queryInterface) => {
|
|
14
|
+
const table = await queryInterface
|
|
15
|
+
.describeTable('announcementes')
|
|
16
|
+
.catch(() => null);
|
|
17
|
+
if (!table)
|
|
18
|
+
return;
|
|
19
|
+
if (table.user_types && !table.userTypes) {
|
|
20
|
+
await queryInterface.renameColumn('announcementes', 'user_types', 'userTypes');
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const getDataType = async (queryInterface, column) => {
|
|
3
|
+
const [rows] = await queryInterface.sequelize.query(`SELECT data_type FROM information_schema.columns WHERE table_name = 'announcementes' AND column_name = '${column}';`);
|
|
4
|
+
return rows[0]?.data_type ?? null;
|
|
5
|
+
};
|
|
6
|
+
module.exports = {
|
|
7
|
+
up: async (queryInterface) => {
|
|
8
|
+
const table = await queryInterface
|
|
9
|
+
.describeTable('announcementes')
|
|
10
|
+
.catch(() => null);
|
|
11
|
+
if (!table)
|
|
12
|
+
return;
|
|
13
|
+
const column = table.user_types ? 'user_types' : table.userTypes ? 'userTypes' : null;
|
|
14
|
+
if (!column)
|
|
15
|
+
return;
|
|
16
|
+
const dataType = await getDataType(queryInterface, column);
|
|
17
|
+
if (dataType === 'ARRAY')
|
|
18
|
+
return;
|
|
19
|
+
await queryInterface.sequelize.query(`ALTER TABLE announcementes ALTER COLUMN "${column}" DROP DEFAULT;`);
|
|
20
|
+
await queryInterface.sequelize.query(`ALTER TABLE announcementes ALTER COLUMN "${column}" TYPE VARCHAR(255)[] USING "${column}"::text[]::VARCHAR(255)[];`);
|
|
21
|
+
await queryInterface.sequelize.query(`ALTER TABLE announcementes ALTER COLUMN "${column}" SET DEFAULT ARRAY[]::VARCHAR(255)[];`);
|
|
22
|
+
},
|
|
23
|
+
down: async (queryInterface) => {
|
|
24
|
+
const table = await queryInterface
|
|
25
|
+
.describeTable('announcementes')
|
|
26
|
+
.catch(() => null);
|
|
27
|
+
if (!table)
|
|
28
|
+
return;
|
|
29
|
+
const column = table.user_types ? 'user_types' : table.userTypes ? 'userTypes' : null;
|
|
30
|
+
if (!column)
|
|
31
|
+
return;
|
|
32
|
+
const dataType = await getDataType(queryInterface, column);
|
|
33
|
+
if (dataType !== 'ARRAY')
|
|
34
|
+
return;
|
|
35
|
+
await queryInterface.sequelize.query(`ALTER TABLE announcementes ALTER COLUMN "${column}" DROP DEFAULT;`);
|
|
36
|
+
await queryInterface.sequelize.query(`ALTER TABLE announcementes ALTER COLUMN "${column}" TYPE VARCHAR(255) USING "${column}"::text;`);
|
|
37
|
+
},
|
|
38
|
+
};
|
package/dist/interfaces/index.js
CHANGED
|
@@ -295,3 +295,4 @@ __exportStar(require("./sportAcademyWorkingDayInterface"), exports);
|
|
|
295
295
|
__exportStar(require("./sportBatchHasTimeInterface"), exports);
|
|
296
296
|
__exportStar(require("./userHasSportBatchInterface"), exports);
|
|
297
297
|
__exportStar(require("./sportAttendanceInterface"), exports);
|
|
298
|
+
__exportStar(require("./masterDesignationInterface"), exports);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { APP_TYPE, DESIGNATION_TYPE, USER_TYPES } from '../constants';
|
|
2
|
+
import { IDefaultAttributes } from './commonInterface';
|
|
3
|
+
export interface IMasterDesignationAttributes extends IDefaultAttributes {
|
|
4
|
+
id: string;
|
|
5
|
+
designationTitle: DESIGNATION_TYPE[];
|
|
6
|
+
title: string;
|
|
7
|
+
appType: APP_TYPE[];
|
|
8
|
+
userType: USER_TYPES[];
|
|
9
|
+
isInstituteDefault: boolean;
|
|
10
|
+
instituteId: string;
|
|
11
|
+
masterId: string;
|
|
12
|
+
}
|
|
@@ -191,3 +191,4 @@ export { default as SportAcademyBatchModel } from './sportAcademyBatchModel';
|
|
|
191
191
|
export { default as SportAcademyWorkingDayModel } from './sportAcademyWorkingDayModel';
|
|
192
192
|
export { default as SportBatchHasTimeModel } from './sportBatchHasTimeModel';
|
|
193
193
|
export { default as UserHasSportBatchModel } from './userHasSportBatchModel';
|
|
194
|
+
export { default as MasterDesignationModel } from './masterDesignationModel';
|
|
@@ -6,7 +6,7 @@ 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.StudentLeaveRequestModel = exports.CloneListModel = exports.IncomeExpenseModel = exports.MaintenanceModel = 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.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
8
|
exports.RmsPurchaseRequestItemModel = exports.RmsPurchaseRequestModel = exports.RmsVendorDocumentModel = exports.RmsVendorModel = exports.RmsStockTransactionModel = exports.RmsStockModel = exports.RmsResourceModel = exports.RmsLocationModel = exports.RmsDepartmentModel = exports.AiModelKeyModel = exports.ModuleDocsModel = exports.DynamicVariableLabelModel = exports.DynamicVariableModel = exports.CertificateRequestModel = exports.FeeSubmissionTrackModel = exports.UserHasFeeSubmissionModel = exports.AssignSubjectModel = exports.InstitutePartnersModel = exports.InstituteOwnershipHistoryModel = exports.UserHasPenaltyHistoryModel = exports.PastYearRecordModel = exports.PayoutTransactionHistoryModel = exports.AdditionalPayoutModel = exports.LoanEmiModel = exports.UserLoanModel = exports.NoticeboardModel = exports.UserPermissionModel = exports.RoleManagementModel = exports.PermissionModel = exports.DesignationModel = exports.AdditionalPayoutTypeModel = exports.VisitorBookModel = exports.PostalDispatchModel = exports.CallRegisterModel = 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 = void 0;
|
|
9
|
-
exports.UserHasSportBatchModel = exports.SportBatchHasTimeModel = exports.SportAcademyWorkingDayModel = exports.SportAcademyBatchModel = exports.SchoolHasSportModel = exports.AgeGroupModel = exports.SkillModel = exports.UnitModel = exports.SportGroupDataModel = exports.FacilityMasterModel = exports.EquipmentModel = exports.SportRoleModel = exports.SportSubCategoryModel = exports.SportCategoryModel = exports.SportModel = exports.AccountVoucherTypeModel = exports.AccountCostCenterModel = exports.AccountLedgerOpeningModel = exports.AccountLedgerModel = exports.AccountGroupModel = exports.AccountNumberSequenceModel = exports.AccountPeriodLockModel = exports.AccountFinancialYearModel = exports.RmsExpenseEntryModel = exports.RmsBudgetModel = exports.RmsFacilityBookingModel = exports.RmsFacilityModel = exports.RmsMaintenanceActivityModel = exports.RmsMaintenanceTicketModel = exports.RefundCollectionModule = exports.RmsAssetTransactionModel = exports.RmsStorageSlotModel = exports.RmsStorageRackModel = exports.UserHasGraceMarksModel = exports.GraceMarksModel = exports.RmsAssetModel = exports.RmsGrnItemTransactionModel = exports.RmsGrnItemModel = exports.RmsGrnModel = exports.RmsPurchaseOrderItemModel = exports.RmsPurchaseOrderModel = void 0;
|
|
9
|
+
exports.MasterDesignationModel = exports.UserHasSportBatchModel = exports.SportBatchHasTimeModel = exports.SportAcademyWorkingDayModel = exports.SportAcademyBatchModel = exports.SchoolHasSportModel = exports.AgeGroupModel = exports.SkillModel = exports.UnitModel = exports.SportGroupDataModel = exports.FacilityMasterModel = exports.EquipmentModel = exports.SportRoleModel = exports.SportSubCategoryModel = exports.SportCategoryModel = exports.SportModel = exports.AccountVoucherTypeModel = exports.AccountCostCenterModel = exports.AccountLedgerOpeningModel = exports.AccountLedgerModel = exports.AccountGroupModel = exports.AccountNumberSequenceModel = exports.AccountPeriodLockModel = exports.AccountFinancialYearModel = exports.RmsExpenseEntryModel = exports.RmsBudgetModel = exports.RmsFacilityBookingModel = exports.RmsFacilityModel = exports.RmsMaintenanceActivityModel = exports.RmsMaintenanceTicketModel = exports.RefundCollectionModule = exports.RmsAssetTransactionModel = exports.RmsStorageSlotModel = exports.RmsStorageRackModel = exports.UserHasGraceMarksModel = exports.GraceMarksModel = exports.RmsAssetModel = exports.RmsGrnItemTransactionModel = exports.RmsGrnItemModel = exports.RmsGrnModel = exports.RmsPurchaseOrderItemModel = exports.RmsPurchaseOrderModel = void 0;
|
|
10
10
|
const sequelize_1 = require("sequelize");
|
|
11
11
|
Object.defineProperty(exports, "Sequelize", { enumerable: true, get: function () { return sequelize_1.Sequelize; } });
|
|
12
12
|
const postgresConfig = require('../../configs/postgresConfig');
|
|
@@ -479,3 +479,5 @@ var sportBatchHasTimeModel_1 = require("./sportBatchHasTimeModel");
|
|
|
479
479
|
Object.defineProperty(exports, "SportBatchHasTimeModel", { enumerable: true, get: function () { return __importDefault(sportBatchHasTimeModel_1).default; } });
|
|
480
480
|
var userHasSportBatchModel_1 = require("./userHasSportBatchModel");
|
|
481
481
|
Object.defineProperty(exports, "UserHasSportBatchModel", { enumerable: true, get: function () { return __importDefault(userHasSportBatchModel_1).default; } });
|
|
482
|
+
var masterDesignationModel_1 = require("./masterDesignationModel");
|
|
483
|
+
Object.defineProperty(exports, "MasterDesignationModel", { enumerable: true, get: function () { return __importDefault(masterDesignationModel_1).default; } });
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Model } from 'sequelize';
|
|
2
|
+
import { APP_TYPE, DESIGNATION_TYPE, USER_TYPES } from '../../constants';
|
|
3
|
+
import { IMasterDesignationAttributes } from '../../interfaces';
|
|
4
|
+
import { TMasterDesignationCreationAttributes } from '../../types/masterDesignationType';
|
|
5
|
+
declare class MasterDesignationModel extends Model<IMasterDesignationAttributes, TMasterDesignationCreationAttributes> {
|
|
6
|
+
id: string;
|
|
7
|
+
designationTitle: DESIGNATION_TYPE[];
|
|
8
|
+
title: string;
|
|
9
|
+
appType: APP_TYPE[];
|
|
10
|
+
userType: USER_TYPES[];
|
|
11
|
+
isInstituteDefault: boolean;
|
|
12
|
+
instituteId: string;
|
|
13
|
+
masterId: string;
|
|
14
|
+
createdBy: string;
|
|
15
|
+
updatedBy: string;
|
|
16
|
+
deletedBy: string;
|
|
17
|
+
readonly createdAt: Date;
|
|
18
|
+
readonly updatedAt: Date;
|
|
19
|
+
readonly deletedAt: string;
|
|
20
|
+
static associate(models: any): void;
|
|
21
|
+
}
|
|
22
|
+
export default MasterDesignationModel;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const sequelize_1 = require("sequelize");
|
|
4
|
+
const index_1 = require("./index");
|
|
5
|
+
class MasterDesignationModel extends sequelize_1.Model {
|
|
6
|
+
static associate(models) {
|
|
7
|
+
const { UserModel, InstituteModel } = models;
|
|
8
|
+
MasterDesignationModel.belongsTo(UserModel, {
|
|
9
|
+
foreignKey: { name: 'createdBy', allowNull: true, field: 'created_by' },
|
|
10
|
+
as: 'createdByUser',
|
|
11
|
+
});
|
|
12
|
+
MasterDesignationModel.belongsTo(UserModel, {
|
|
13
|
+
foreignKey: { name: 'updatedBy', allowNull: true, field: 'updated_by' },
|
|
14
|
+
as: 'updatedByUser',
|
|
15
|
+
});
|
|
16
|
+
MasterDesignationModel.belongsTo(UserModel, {
|
|
17
|
+
foreignKey: { name: 'deletedBy', allowNull: true, field: 'deleted_by' },
|
|
18
|
+
as: 'deletedByUser',
|
|
19
|
+
});
|
|
20
|
+
MasterDesignationModel.belongsTo(InstituteModel, {
|
|
21
|
+
foreignKey: {
|
|
22
|
+
name: 'instituteId',
|
|
23
|
+
field: 'institute_id',
|
|
24
|
+
},
|
|
25
|
+
as: 'masterDesignationInstitute',
|
|
26
|
+
});
|
|
27
|
+
InstituteModel.hasMany(MasterDesignationModel, {
|
|
28
|
+
foreignKey: {
|
|
29
|
+
name: 'instituteId',
|
|
30
|
+
field: 'institute_id',
|
|
31
|
+
},
|
|
32
|
+
as: 'instituteMasterDesignations',
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
MasterDesignationModel.init({
|
|
37
|
+
id: {
|
|
38
|
+
type: sequelize_1.DataTypes.UUID,
|
|
39
|
+
defaultValue: sequelize_1.DataTypes.UUIDV4,
|
|
40
|
+
allowNull: false,
|
|
41
|
+
primaryKey: true,
|
|
42
|
+
},
|
|
43
|
+
designationTitle: {
|
|
44
|
+
type: sequelize_1.DataTypes.ARRAY(sequelize_1.DataTypes.STRING),
|
|
45
|
+
allowNull: true,
|
|
46
|
+
field: 'designation_title',
|
|
47
|
+
},
|
|
48
|
+
title: {
|
|
49
|
+
type: sequelize_1.DataTypes.STRING,
|
|
50
|
+
allowNull: true,
|
|
51
|
+
},
|
|
52
|
+
appType: {
|
|
53
|
+
type: sequelize_1.DataTypes.ARRAY(sequelize_1.DataTypes.STRING),
|
|
54
|
+
allowNull: true,
|
|
55
|
+
field: 'app_type',
|
|
56
|
+
},
|
|
57
|
+
userType: {
|
|
58
|
+
type: sequelize_1.DataTypes.ARRAY(sequelize_1.DataTypes.STRING),
|
|
59
|
+
allowNull: true,
|
|
60
|
+
field: 'user_type',
|
|
61
|
+
},
|
|
62
|
+
isInstituteDefault: {
|
|
63
|
+
type: sequelize_1.DataTypes.BOOLEAN,
|
|
64
|
+
allowNull: true,
|
|
65
|
+
field: 'is_institute_default',
|
|
66
|
+
},
|
|
67
|
+
instituteId: {
|
|
68
|
+
type: sequelize_1.DataTypes.UUID,
|
|
69
|
+
allowNull: true,
|
|
70
|
+
field: 'institute_id',
|
|
71
|
+
},
|
|
72
|
+
masterId: {
|
|
73
|
+
type: sequelize_1.DataTypes.UUID,
|
|
74
|
+
allowNull: true,
|
|
75
|
+
field: 'master_id',
|
|
76
|
+
},
|
|
77
|
+
}, {
|
|
78
|
+
modelName: 'MasterDesignationModel',
|
|
79
|
+
tableName: 'master_designations',
|
|
80
|
+
timestamps: true,
|
|
81
|
+
sequelize: index_1.sequelize,
|
|
82
|
+
});
|
|
83
|
+
exports.default = MasterDesignationModel;
|
package/dist/types/index.d.ts
CHANGED
package/dist/types/index.js
CHANGED
|
@@ -285,3 +285,4 @@ __exportStar(require("./sportBatchHasTimeType"), exports);
|
|
|
285
285
|
__exportStar(require("./commonType"), exports);
|
|
286
286
|
__exportStar(require("./userHasSportBatchType"), exports);
|
|
287
287
|
__exportStar(require("./sportAttendanceType"), exports);
|
|
288
|
+
__exportStar(require("./masterDesignationType"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Optional } from 'sequelize';
|
|
2
|
+
import { IInstituteAttributes, IMasterDesignationAttributes, IUserAttributes } from '../interfaces';
|
|
3
|
+
export type TMasterDesignationCreationAttributes = Optional<IMasterDesignationAttributes, 'id'>;
|
|
4
|
+
export type TMasterDesignationAttributesWithAssociation = IMasterDesignationAttributes & {
|
|
5
|
+
createdByUser?: IUserAttributes;
|
|
6
|
+
updatedByUser?: IUserAttributes;
|
|
7
|
+
deletedByUser?: IUserAttributes;
|
|
8
|
+
designationInstitute?: IInstituteAttributes;
|
|
9
|
+
};
|
package/package.json
CHANGED
package/dist/db/psql/migrations/20260819160514-change_announcements_user_types_enum_to_string.js
DELETED
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
module.exports = {
|
|
3
|
-
up: async (queryInterface, Sequelize) => {
|
|
4
|
-
const table = await queryInterface
|
|
5
|
-
.describeTable('announcementes')
|
|
6
|
-
.catch(() => null);
|
|
7
|
-
if (!table)
|
|
8
|
-
return;
|
|
9
|
-
// 1. Update schedule_type / scheduleType (scalar STRING)
|
|
10
|
-
const scheduleTypeCol = table.schedule_type ? 'schedule_type' : (table.scheduleType ? 'scheduleType' : null);
|
|
11
|
-
if (scheduleTypeCol) {
|
|
12
|
-
try {
|
|
13
|
-
await queryInterface.sequelize.query(`ALTER TABLE announcementes ALTER COLUMN "${scheduleTypeCol}" DROP DEFAULT;`);
|
|
14
|
-
}
|
|
15
|
-
catch {
|
|
16
|
-
// Ignore if default does not exist
|
|
17
|
-
}
|
|
18
|
-
try {
|
|
19
|
-
await queryInterface.sequelize.query(`ALTER TABLE announcementes ALTER COLUMN "${scheduleTypeCol}" TYPE VARCHAR(255) USING "${scheduleTypeCol}"::varchar;`);
|
|
20
|
-
}
|
|
21
|
-
catch {
|
|
22
|
-
// Ignore if alter type fails
|
|
23
|
-
}
|
|
24
|
-
try {
|
|
25
|
-
await queryInterface.changeColumn('announcementes', scheduleTypeCol, {
|
|
26
|
-
type: Sequelize.STRING,
|
|
27
|
-
allowNull: false,
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
catch {
|
|
31
|
-
// Ignore if change column fails
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
// 2. Update userTypes / user_types (ARRAY of STRING)
|
|
35
|
-
const userTypesCol = table.userTypes ? 'userTypes' : (table.user_types ? 'user_types' : null);
|
|
36
|
-
if (userTypesCol) {
|
|
37
|
-
try {
|
|
38
|
-
await queryInterface.sequelize.query(`ALTER TABLE announcementes ALTER COLUMN "${userTypesCol}" DROP DEFAULT;`);
|
|
39
|
-
}
|
|
40
|
-
catch {
|
|
41
|
-
// Ignore if default does not exist
|
|
42
|
-
}
|
|
43
|
-
try {
|
|
44
|
-
await queryInterface.sequelize.query(`ALTER TABLE announcementes ALTER COLUMN "${userTypesCol}" TYPE VARCHAR(255)[] USING "${userTypesCol}"::text[];`);
|
|
45
|
-
}
|
|
46
|
-
catch {
|
|
47
|
-
try {
|
|
48
|
-
await queryInterface.sequelize.query(`ALTER TABLE announcementes ALTER COLUMN "${userTypesCol}" TYPE VARCHAR(255)[] USING ARRAY["${userTypesCol}"]::text[];`);
|
|
49
|
-
}
|
|
50
|
-
catch {
|
|
51
|
-
// Ignore fallback failure
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
try {
|
|
55
|
-
await queryInterface.changeColumn('announcementes', userTypesCol, {
|
|
56
|
-
type: Sequelize.ARRAY(Sequelize.STRING),
|
|
57
|
-
allowNull: true,
|
|
58
|
-
defaultValue: [],
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
catch {
|
|
62
|
-
// Ignore change column failure
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
// 3. Update status (scalar STRING)
|
|
66
|
-
if (table.status) {
|
|
67
|
-
try {
|
|
68
|
-
await queryInterface.sequelize.query('ALTER TABLE announcementes ALTER COLUMN "status" DROP DEFAULT;');
|
|
69
|
-
}
|
|
70
|
-
catch {
|
|
71
|
-
// Ignore if default does not exist
|
|
72
|
-
}
|
|
73
|
-
try {
|
|
74
|
-
await queryInterface.sequelize.query('ALTER TABLE announcementes ALTER COLUMN "status" TYPE VARCHAR(255) USING "status"::varchar;');
|
|
75
|
-
}
|
|
76
|
-
catch {
|
|
77
|
-
// Ignore if alter type fails
|
|
78
|
-
}
|
|
79
|
-
try {
|
|
80
|
-
await queryInterface.sequelize.query("ALTER TABLE announcementes ALTER COLUMN \"status\" SET DEFAULT 'PENDING';");
|
|
81
|
-
}
|
|
82
|
-
catch {
|
|
83
|
-
// Ignore if setting default fails
|
|
84
|
-
}
|
|
85
|
-
try {
|
|
86
|
-
await queryInterface.changeColumn('announcementes', 'status', {
|
|
87
|
-
type: Sequelize.STRING,
|
|
88
|
-
allowNull: false,
|
|
89
|
-
defaultValue: 'PENDING',
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
catch {
|
|
93
|
-
// Ignore if change column fails
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
// Drop enum types if they exist in PostgreSQL
|
|
97
|
-
await queryInterface.sequelize.query('DROP TYPE IF EXISTS "enum_announcementes_schedule_type" CASCADE;').catch(() => { });
|
|
98
|
-
await queryInterface.sequelize.query('DROP TYPE IF EXISTS "enum_announcementes_scheduleType" CASCADE;').catch(() => { });
|
|
99
|
-
await queryInterface.sequelize.query('DROP TYPE IF EXISTS "enum_announcementes_userTypes" CASCADE;').catch(() => { });
|
|
100
|
-
await queryInterface.sequelize.query('DROP TYPE IF EXISTS "enum_announcementes_user_types" CASCADE;').catch(() => { });
|
|
101
|
-
await queryInterface.sequelize.query('DROP TYPE IF EXISTS "enum_announcementes_status" CASCADE;').catch(() => { });
|
|
102
|
-
},
|
|
103
|
-
down: async (queryInterface, Sequelize) => {
|
|
104
|
-
const table = await queryInterface
|
|
105
|
-
.describeTable('announcementes')
|
|
106
|
-
.catch(() => null);
|
|
107
|
-
if (!table)
|
|
108
|
-
return;
|
|
109
|
-
const scheduleTypeCol = table.schedule_type ? 'schedule_type' : (table.scheduleType ? 'scheduleType' : null);
|
|
110
|
-
if (scheduleTypeCol) {
|
|
111
|
-
try {
|
|
112
|
-
await queryInterface.sequelize.query(`ALTER TABLE announcementes ALTER COLUMN "${scheduleTypeCol}" TYPE "enum_announcementes_schedule_type" USING "${scheduleTypeCol}"::text::"enum_announcementes_schedule_type";`);
|
|
113
|
-
}
|
|
114
|
-
catch {
|
|
115
|
-
// Ignore if alter fails
|
|
116
|
-
}
|
|
117
|
-
try {
|
|
118
|
-
await queryInterface.changeColumn('announcementes', scheduleTypeCol, {
|
|
119
|
-
type: Sequelize.ENUM('INSTANT', 'SCHEDULE'),
|
|
120
|
-
allowNull: false,
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
catch {
|
|
124
|
-
// Ignore if change column fails
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
const userTypesCol = table.userTypes ? 'userTypes' : (table.user_types ? 'user_types' : null);
|
|
128
|
-
if (userTypesCol) {
|
|
129
|
-
try {
|
|
130
|
-
await queryInterface.sequelize.query(`ALTER TABLE announcementes ALTER COLUMN "${userTypesCol}" TYPE "enum_announcementes_user_types"[] USING "${userTypesCol}"::text[]::"enum_announcementes_user_types"[];`);
|
|
131
|
-
}
|
|
132
|
-
catch {
|
|
133
|
-
// Ignore if alter fails
|
|
134
|
-
}
|
|
135
|
-
try {
|
|
136
|
-
await queryInterface.changeColumn('announcementes', userTypesCol, {
|
|
137
|
-
type: Sequelize.ARRAY(Sequelize.ENUM('MASTER_ADMIN', 'ADMIN', 'INSTITUTE_MASTER_ADMIN', 'INSTITUTE_ADMIN', 'TEACHER', 'STUDENT', 'PARENTS', 'DRIVER')),
|
|
138
|
-
allowNull: true,
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
catch {
|
|
142
|
-
// Ignore if change column fails
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
if (table.status) {
|
|
146
|
-
try {
|
|
147
|
-
await queryInterface.sequelize.query('ALTER TABLE announcementes ALTER COLUMN "status" TYPE "enum_announcementes_status" USING "status"::text::"enum_announcementes_status";');
|
|
148
|
-
}
|
|
149
|
-
catch {
|
|
150
|
-
// Ignore if alter fails
|
|
151
|
-
}
|
|
152
|
-
try {
|
|
153
|
-
await queryInterface.changeColumn('announcementes', 'status', {
|
|
154
|
-
type: Sequelize.ENUM('PENDING', 'PROCESSING', 'CREATED'),
|
|
155
|
-
allowNull: false,
|
|
156
|
-
defaultValue: 'PENDING',
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
catch {
|
|
160
|
-
// Ignore if change column fails
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
};
|