@kipicore/dbcore 1.1.156 → 1.1.158
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 +1 -1
- package/dist/constants/app.js +1 -1
- package/dist/constants/successMessages.d.ts +2 -1
- package/dist/constants/successMessages.js +1 -0
- package/dist/db/psql/migrations/20251216101816-add_campus_id_driver.d.ts +2 -0
- package/dist/db/psql/migrations/20251216101816-add_campus_id_driver.js +81 -0
- package/dist/db/psql/migrations/20251218055418-remove_index_vehicle.d.ts +1 -0
- package/dist/db/psql/migrations/20251218055418-remove_index_vehicle.js +12 -0
- package/dist/interfaces/driverInterface.d.ts +3 -0
- package/dist/interfaces/tripInterface.d.ts +1 -0
- package/dist/interfaces/userInstituteMetaInterface.d.ts +6 -0
- package/dist/interfaces/vehicleInterface.d.ts +2 -0
- package/dist/models/mongodb/userInstituteMetaModel.js +11 -2
- package/dist/models/psql/driverModel.d.ts +3 -0
- package/dist/models/psql/driverModel.js +27 -1
- package/dist/models/psql/tripModel.d.ts +1 -0
- package/dist/models/psql/tripModel.js +5 -0
- package/dist/models/psql/vehicleModel.d.ts +2 -0
- package/dist/models/psql/vehicleModel.js +27 -9
- package/package.json +1 -1
package/dist/constants/app.d.ts
CHANGED
|
@@ -941,7 +941,7 @@ export declare enum COMPETITION_TYPE_CATEGORY {
|
|
|
941
941
|
CREATIVE_INTERESTS = "CREATIVE_INTERESTS",
|
|
942
942
|
SPORT = "SPORT",
|
|
943
943
|
CULTURAL = "CULTURAL",
|
|
944
|
-
|
|
944
|
+
ACADEMIC = "ACADEMIC"
|
|
945
945
|
}
|
|
946
946
|
export declare enum CAMPUS_CARNIVAL_STATUS {
|
|
947
947
|
PENDING = "PENDING",
|
package/dist/constants/app.js
CHANGED
|
@@ -1184,7 +1184,7 @@ var COMPETITION_TYPE_CATEGORY;
|
|
|
1184
1184
|
COMPETITION_TYPE_CATEGORY["CREATIVE_INTERESTS"] = "CREATIVE_INTERESTS";
|
|
1185
1185
|
COMPETITION_TYPE_CATEGORY["SPORT"] = "SPORT";
|
|
1186
1186
|
COMPETITION_TYPE_CATEGORY["CULTURAL"] = "CULTURAL";
|
|
1187
|
-
COMPETITION_TYPE_CATEGORY["
|
|
1187
|
+
COMPETITION_TYPE_CATEGORY["ACADEMIC"] = "ACADEMIC";
|
|
1188
1188
|
})(COMPETITION_TYPE_CATEGORY || (exports.COMPETITION_TYPE_CATEGORY = COMPETITION_TYPE_CATEGORY = {}));
|
|
1189
1189
|
var CAMPUS_CARNIVAL_STATUS;
|
|
1190
1190
|
(function (CAMPUS_CARNIVAL_STATUS) {
|
|
@@ -812,7 +812,8 @@ export declare enum COMPETITION_USER_SUCCESS_MESSAGES {
|
|
|
812
812
|
CREATE_SUCCESS = "participants added successfully",
|
|
813
813
|
GET_SUCCESS = "participants retrieved successfully",
|
|
814
814
|
UPDATE_SUCCESS = "participants updated successfully",
|
|
815
|
-
DELETE_SUCCESS = "participants deleted successfully"
|
|
815
|
+
DELETE_SUCCESS = "participants deleted successfully",
|
|
816
|
+
GET_PARTICIPANT_ANALYTICS = "Participant analytics retrieved successfully"
|
|
816
817
|
}
|
|
817
818
|
export declare enum CLONE_LIST_SUCCESS_MESSAGES {
|
|
818
819
|
CREATE_SUCCESS = "Clone list added successfully",
|
|
@@ -946,6 +946,7 @@ var COMPETITION_USER_SUCCESS_MESSAGES;
|
|
|
946
946
|
COMPETITION_USER_SUCCESS_MESSAGES["GET_SUCCESS"] = "participants retrieved successfully";
|
|
947
947
|
COMPETITION_USER_SUCCESS_MESSAGES["UPDATE_SUCCESS"] = "participants updated successfully";
|
|
948
948
|
COMPETITION_USER_SUCCESS_MESSAGES["DELETE_SUCCESS"] = "participants deleted successfully";
|
|
949
|
+
COMPETITION_USER_SUCCESS_MESSAGES["GET_PARTICIPANT_ANALYTICS"] = "Participant analytics retrieved successfully";
|
|
949
950
|
})(COMPETITION_USER_SUCCESS_MESSAGES || (exports.COMPETITION_USER_SUCCESS_MESSAGES = COMPETITION_USER_SUCCESS_MESSAGES = {}));
|
|
950
951
|
var CLONE_LIST_SUCCESS_MESSAGES;
|
|
951
952
|
(function (CLONE_LIST_SUCCESS_MESSAGES) {
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const up = async (queryInterface, Sequelize) => {
|
|
3
|
+
const table = await queryInterface.describeTable('drivers');
|
|
4
|
+
if (!table.profile_image) {
|
|
5
|
+
await queryInterface.addColumn('drivers', 'profile_image', {
|
|
6
|
+
type: Sequelize.UUID,
|
|
7
|
+
defaultValue: null,
|
|
8
|
+
allowNull: true,
|
|
9
|
+
field: 'profile_image',
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
if (!table.campus_id) {
|
|
13
|
+
await queryInterface.addColumn('drivers', 'campus_id', {
|
|
14
|
+
type: Sequelize.UUID,
|
|
15
|
+
defaultValue: null,
|
|
16
|
+
allowNull: true,
|
|
17
|
+
field: 'campus_id',
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
if (!table.mobile) {
|
|
21
|
+
await queryInterface.addColumn('drivers', 'mobile', {
|
|
22
|
+
type: Sequelize.STRING,
|
|
23
|
+
defaultValue: null,
|
|
24
|
+
allowNull: true,
|
|
25
|
+
field: 'mobile',
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
const vehicle = await queryInterface.describeTable('vehicles');
|
|
29
|
+
if (!vehicle.academic_calendar_id) {
|
|
30
|
+
await queryInterface.addColumn('vehicles', 'academic_calendar_id', {
|
|
31
|
+
type: Sequelize.UUID,
|
|
32
|
+
defaultValue: null,
|
|
33
|
+
allowNull: true,
|
|
34
|
+
field: 'academic_calendar_id',
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
if (!vehicle.user_id) {
|
|
38
|
+
await queryInterface.addColumn('vehicles', 'user_id', {
|
|
39
|
+
type: Sequelize.UUID,
|
|
40
|
+
defaultValue: null,
|
|
41
|
+
allowNull: true,
|
|
42
|
+
field: 'user_id',
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
const trips = await queryInterface.describeTable('trips');
|
|
46
|
+
if (!trips.slot_id) {
|
|
47
|
+
await queryInterface.addColumn('trips', 'slot_id', {
|
|
48
|
+
type: Sequelize.ARRAY(Sequelize.STRING),
|
|
49
|
+
defaultValue: [],
|
|
50
|
+
allowNull: true,
|
|
51
|
+
field: 'slot_id',
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const down = async (queryInterface, Sequelize) => {
|
|
56
|
+
const drivers = await queryInterface.describeTable('drivers');
|
|
57
|
+
if (drivers.profile_image) {
|
|
58
|
+
await queryInterface.removeColumn('drivers', 'profile_image');
|
|
59
|
+
}
|
|
60
|
+
if (drivers.campus_id) {
|
|
61
|
+
await queryInterface.removeColumn('drivers', 'campus_id');
|
|
62
|
+
}
|
|
63
|
+
if (drivers.mobile) {
|
|
64
|
+
await queryInterface.removeColumn('drivers', 'mobile');
|
|
65
|
+
}
|
|
66
|
+
const vehicles = await queryInterface.describeTable('vehicles');
|
|
67
|
+
if (vehicles.academic_calendar_id) {
|
|
68
|
+
await queryInterface.removeColumn('vehicles', 'academic_calendar_id');
|
|
69
|
+
}
|
|
70
|
+
if (vehicles.user_id) {
|
|
71
|
+
await queryInterface.removeColumn('vehicles', 'user_id');
|
|
72
|
+
}
|
|
73
|
+
const trips = await queryInterface.describeTable('trips');
|
|
74
|
+
if (trips.slot_id) {
|
|
75
|
+
await queryInterface.removeColumn('trips', 'slot_id');
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
module.exports = {
|
|
79
|
+
up,
|
|
80
|
+
down,
|
|
81
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function up(queryInterface: any, Sequelize: any): Promise<void>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const up = async (queryInterface, Sequelize) => {
|
|
3
|
+
// Remove old index if exists
|
|
4
|
+
const oldIndexes = await queryInterface.showIndex('vehicles');
|
|
5
|
+
const hasOldIndex = oldIndexes.some(idx => idx.name === 'vehicle_unique_number');
|
|
6
|
+
if (hasOldIndex) {
|
|
7
|
+
await queryInterface.removeIndex('vehicles', 'vehicle_unique_number');
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
module.exports = {
|
|
11
|
+
up,
|
|
12
|
+
};
|
|
@@ -15,6 +15,9 @@ export interface IDriverModelAttributes extends IDefaultAttributes {
|
|
|
15
15
|
aadharCardNumber: string;
|
|
16
16
|
aadharCard: string;
|
|
17
17
|
drivingLicenseNumber: string;
|
|
18
|
+
profileImage?: string;
|
|
19
|
+
campusId?: string;
|
|
20
|
+
mobile?: string;
|
|
18
21
|
drivingLicense: string;
|
|
19
22
|
appType?: APP_TYPE;
|
|
20
23
|
status: COMMAN_STATUS;
|
|
@@ -7,9 +7,15 @@ export interface IUserInstituteMetaSlots {
|
|
|
7
7
|
presentStartTime: number;
|
|
8
8
|
presentEndTime: number;
|
|
9
9
|
}
|
|
10
|
+
export interface IUserTrip {
|
|
11
|
+
tripId: String;
|
|
12
|
+
pickUpNo: Number;
|
|
13
|
+
dropNo: Number;
|
|
14
|
+
}
|
|
10
15
|
export interface IUserInstituteMetaAttributes extends IDefaultAttributes, Document {
|
|
11
16
|
id: string;
|
|
12
17
|
entities?: string[];
|
|
18
|
+
tripDetails?: IUserTrip[];
|
|
13
19
|
additionalField?: object;
|
|
14
20
|
userId: string;
|
|
15
21
|
instituteId?: string;
|
|
@@ -55,10 +55,19 @@ const userInstituteMetaSlotsSchema = new mongoose_1.Schema({
|
|
|
55
55
|
required: false,
|
|
56
56
|
},
|
|
57
57
|
}, { _id: false });
|
|
58
|
+
const userTripSchema = new mongoose_1.Schema({
|
|
59
|
+
tripId: { type: String },
|
|
60
|
+
pickUpNo: { type: Number },
|
|
61
|
+
dropNo: { type: Number },
|
|
62
|
+
}, { _id: false });
|
|
58
63
|
const userInstituteMetaSchema = new mongoose_1.Schema({
|
|
59
64
|
entities: {
|
|
60
65
|
type: [{ type: String }],
|
|
61
66
|
},
|
|
67
|
+
tripDetails: {
|
|
68
|
+
type: [userTripSchema],
|
|
69
|
+
default: [],
|
|
70
|
+
},
|
|
62
71
|
secondarySubject: {
|
|
63
72
|
type: [{ type: String }],
|
|
64
73
|
},
|
|
@@ -196,8 +205,8 @@ const userInstituteMetaSchema = new mongoose_1.Schema({
|
|
|
196
205
|
},
|
|
197
206
|
previousEntities: {
|
|
198
207
|
type: [String],
|
|
199
|
-
required: false
|
|
200
|
-
}
|
|
208
|
+
required: false,
|
|
209
|
+
},
|
|
201
210
|
}, {
|
|
202
211
|
timestamps: true,
|
|
203
212
|
versionKey: false,
|
|
@@ -10,6 +10,9 @@ export declare class DriverModel extends Model<IDriverModelAttributes, TDriverMo
|
|
|
10
10
|
address1: string;
|
|
11
11
|
address2?: string;
|
|
12
12
|
pinCode: string;
|
|
13
|
+
profileImage?: string;
|
|
14
|
+
campusId?: string;
|
|
15
|
+
mobile?: string;
|
|
13
16
|
city: number;
|
|
14
17
|
state: number;
|
|
15
18
|
country: number;
|
|
@@ -11,7 +11,7 @@ const instituteModel_1 = __importDefault(require("./instituteModel"));
|
|
|
11
11
|
const errorMessages_1 = require("../../constants/errorMessages");
|
|
12
12
|
class DriverModel extends sequelize_1.Model {
|
|
13
13
|
static associate(models) {
|
|
14
|
-
const { UserModel, InstituteModel, CountryModel, StateModel, CityModel, FileStorageModel } = models;
|
|
14
|
+
const { UserModel, InstituteModel, CountryModel, StateModel, CityModel, FileStorageModel, CampusModel } = models;
|
|
15
15
|
DriverModel.belongsTo(UserModel, {
|
|
16
16
|
foreignKey: { name: 'createdBy', allowNull: true, field: 'created_by' },
|
|
17
17
|
as: 'createdByUser',
|
|
@@ -44,6 +44,10 @@ class DriverModel extends sequelize_1.Model {
|
|
|
44
44
|
foreignKey: 'aadharCard',
|
|
45
45
|
as: 'aadharCardDetails',
|
|
46
46
|
});
|
|
47
|
+
DriverModel.belongsTo(FileStorageModel, {
|
|
48
|
+
foreignKey: 'profileImage',
|
|
49
|
+
as: 'drivingProfileImage',
|
|
50
|
+
});
|
|
47
51
|
DriverModel.belongsTo(InstituteModel, {
|
|
48
52
|
foreignKey: 'instituteId',
|
|
49
53
|
as: 'driverInstitute',
|
|
@@ -52,6 +56,14 @@ class DriverModel extends sequelize_1.Model {
|
|
|
52
56
|
foreignKey: 'instituteId',
|
|
53
57
|
as: 'instituteHasDrivers',
|
|
54
58
|
});
|
|
59
|
+
DriverModel.belongsTo(CampusModel, {
|
|
60
|
+
foreignKey: 'campusId',
|
|
61
|
+
as: 'driverCampus',
|
|
62
|
+
});
|
|
63
|
+
CampusModel.hasMany(DriverModel, {
|
|
64
|
+
foreignKey: 'campusId',
|
|
65
|
+
as: 'campusHasDrivers',
|
|
66
|
+
});
|
|
55
67
|
}
|
|
56
68
|
static addHooks() {
|
|
57
69
|
const beforeCreateOrUpdateHook = async (driver) => {
|
|
@@ -122,6 +134,20 @@ DriverModel.init({
|
|
|
122
134
|
type: sequelize_1.DataTypes.UUID,
|
|
123
135
|
allowNull: true,
|
|
124
136
|
},
|
|
137
|
+
profileImage: {
|
|
138
|
+
type: sequelize_1.DataTypes.UUID,
|
|
139
|
+
field: 'profile_image',
|
|
140
|
+
allowNull: true,
|
|
141
|
+
},
|
|
142
|
+
campusId: {
|
|
143
|
+
type: sequelize_1.DataTypes.UUID,
|
|
144
|
+
field: 'campus_id',
|
|
145
|
+
allowNull: true,
|
|
146
|
+
},
|
|
147
|
+
mobile: {
|
|
148
|
+
type: sequelize_1.DataTypes.STRING,
|
|
149
|
+
allowNull: true,
|
|
150
|
+
},
|
|
125
151
|
drivingLicenseNumber: {
|
|
126
152
|
type: sequelize_1.DataTypes.STRING,
|
|
127
153
|
allowNull: true,
|
|
@@ -91,6 +91,11 @@ TripModel.init({
|
|
|
91
91
|
defaultValue: [],
|
|
92
92
|
allowNull: true,
|
|
93
93
|
},
|
|
94
|
+
slotId: {
|
|
95
|
+
type: sequelize_1.DataTypes.ARRAY(sequelize_1.DataTypes.UUID),
|
|
96
|
+
defaultValue: [],
|
|
97
|
+
allowNull: true,
|
|
98
|
+
},
|
|
94
99
|
area: {
|
|
95
100
|
type: sequelize_1.DataTypes.ARRAY(sequelize_1.DataTypes.STRING),
|
|
96
101
|
defaultValue: [],
|
|
@@ -10,6 +10,8 @@ declare class VehicleModel extends Model<IVehicleModelAttributes, TVehicleModelC
|
|
|
10
10
|
capacity: number;
|
|
11
11
|
rcBookFileId: string;
|
|
12
12
|
instituteId: string;
|
|
13
|
+
userId: string;
|
|
14
|
+
academicCalendarId: string;
|
|
13
15
|
createdBy: string;
|
|
14
16
|
updatedBy: string;
|
|
15
17
|
deletedBy: string;
|
|
@@ -5,7 +5,7 @@ const index_1 = require("./index");
|
|
|
5
5
|
const app_1 = require("../../constants/app");
|
|
6
6
|
class VehicleModel extends sequelize_1.Model {
|
|
7
7
|
static associate(models) {
|
|
8
|
-
const { InstituteModel, FileStorageModel, UserModel } = models;
|
|
8
|
+
const { InstituteModel, FileStorageModel, UserModel, AcademicCalendarModel } = models;
|
|
9
9
|
VehicleModel.belongsTo(InstituteModel, {
|
|
10
10
|
foreignKey: { name: 'instituteId', field: 'institute_id' },
|
|
11
11
|
as: 'vehicleInstitute',
|
|
@@ -14,6 +14,22 @@ class VehicleModel extends sequelize_1.Model {
|
|
|
14
14
|
foreignKey: { name: 'instituteId', field: 'institute_id' },
|
|
15
15
|
as: 'instituteVehicleList',
|
|
16
16
|
});
|
|
17
|
+
VehicleModel.belongsTo(AcademicCalendarModel, {
|
|
18
|
+
foreignKey: { name: 'academicCalendarId', field: 'academic_calendar_id' },
|
|
19
|
+
as: 'vehicleAcademic',
|
|
20
|
+
});
|
|
21
|
+
AcademicCalendarModel.hasMany(VehicleModel, {
|
|
22
|
+
foreignKey: { name: 'academicCalendarId', field: 'academic_calendar_id' },
|
|
23
|
+
as: 'academicVehicleList',
|
|
24
|
+
});
|
|
25
|
+
VehicleModel.belongsTo(UserModel, {
|
|
26
|
+
foreignKey: { name: 'userId', field: 'user_id' },
|
|
27
|
+
as: 'vehicleUser',
|
|
28
|
+
});
|
|
29
|
+
UserModel.hasMany(VehicleModel, {
|
|
30
|
+
foreignKey: { name: 'userId', field: 'user_id' },
|
|
31
|
+
as: 'userVehicleList',
|
|
32
|
+
});
|
|
17
33
|
VehicleModel.belongsTo(FileStorageModel, {
|
|
18
34
|
foreignKey: { name: 'rcBookFileId', field: 'rc_book_file_id' },
|
|
19
35
|
as: 'vehicleRcBookFile',
|
|
@@ -67,18 +83,20 @@ VehicleModel.init({
|
|
|
67
83
|
field: 'institute_id',
|
|
68
84
|
allowNull: false,
|
|
69
85
|
},
|
|
86
|
+
userId: {
|
|
87
|
+
type: sequelize_1.DataTypes.UUID,
|
|
88
|
+
field: 'user_id',
|
|
89
|
+
allowNull: true,
|
|
90
|
+
},
|
|
91
|
+
academicCalendarId: {
|
|
92
|
+
type: sequelize_1.DataTypes.UUID,
|
|
93
|
+
field: 'academic_calendar_id',
|
|
94
|
+
allowNull: true,
|
|
95
|
+
},
|
|
70
96
|
}, {
|
|
71
97
|
modelName: 'VehicleModel',
|
|
72
98
|
tableName: 'vehicles',
|
|
73
99
|
timestamps: true,
|
|
74
|
-
indexes: [
|
|
75
|
-
{
|
|
76
|
-
name: 'vehicle_unique_number',
|
|
77
|
-
unique: true,
|
|
78
|
-
fields: ['number', 'institute_id'],
|
|
79
|
-
where: { deleted_at: null },
|
|
80
|
-
},
|
|
81
|
-
],
|
|
82
100
|
sequelize: index_1.sequelize,
|
|
83
101
|
});
|
|
84
102
|
exports.default = VehicleModel;
|
package/package.json
CHANGED