pristine-member-nest-api-database 1.0.7 → 1.0.8
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/Database.code-workspace +6 -6
- package/dist/index.js +1 -0
- package/dist/models/ProductsServices.model.js +41 -0
- package/index.ts +24 -23
- package/interface/Audit.interface.ts +4 -4
- package/models/AccessLog.model.ts +26 -26
- package/models/Appliance.ir.model.ts +24 -24
- package/models/BankTransfer.model.ts +42 -42
- package/models/BarcodeCategory.model.ts +24 -24
- package/models/Branch.model.ts +48 -48
- package/models/BranchType.model.ts +24 -24
- package/models/Counter.model.ts +15 -15
- package/models/Country.model.ts +24 -24
- package/models/FieldCategory.model.ts +27 -26
- package/models/Item.ir.model.ts +29 -29
- package/models/ItemGroup.ir.model.ts +24 -24
- package/models/ItemRequest.ir.model.ts +100 -100
- package/models/MeetingRoom.ir.model.ts +24 -24
- package/models/Member.model.ts +200 -200
- package/models/MembershipStatus.model.ts +24 -24
- package/models/MembershipType.model.ts +24 -24
- package/models/ProductsServices.model.ts +31 -0
- package/models/SeatingArrangement.ir.model.ts +24 -24
- package/models/ServiceRequest.ir.model.ts +167 -167
- package/models/User.model.ts +71 -71
- package/models/UserRole.model.ts +15 -15
- package/models/VehicleCategory.ir.model.ts +24 -24
- package/models/payment.model.ts +98 -98
- package/package.json +19 -19
- package/src/dbConnect.ts +6 -6
- package/tsconfig.json +109 -109
|
@@ -1,167 +1,167 @@
|
|
|
1
|
-
import mongoose, { Document, Schema, now } from 'mongoose';
|
|
2
|
-
import { Audit } from '../interface/Audit.interface';
|
|
3
|
-
|
|
4
|
-
interface ServiceRequestDocument extends Document {
|
|
5
|
-
requisitionId: number;
|
|
6
|
-
requestType: string;
|
|
7
|
-
requestedBranch: mongoose.Types.ObjectId;
|
|
8
|
-
requestedFromBranch: mongoose.Types.ObjectId;
|
|
9
|
-
service:{
|
|
10
|
-
meetingRoom: mongoose.Types.ObjectId;
|
|
11
|
-
startDate: Date;
|
|
12
|
-
startTime: string;
|
|
13
|
-
endDate: Date;
|
|
14
|
-
endTime: string;
|
|
15
|
-
isRecurring: boolean;
|
|
16
|
-
noOfParticipants: number;
|
|
17
|
-
equipments: [{
|
|
18
|
-
appliance: mongoose.Types.ObjectId;
|
|
19
|
-
quantity: number;
|
|
20
|
-
}];
|
|
21
|
-
remark: string;
|
|
22
|
-
seatingArrangement: mongoose.Types.ObjectId;
|
|
23
|
-
};
|
|
24
|
-
transport: {
|
|
25
|
-
vehicleCategory: mongoose.Types.ObjectId;
|
|
26
|
-
hireName: string;
|
|
27
|
-
reason: string;
|
|
28
|
-
note: string;
|
|
29
|
-
startDateTime: Date;
|
|
30
|
-
endDateTime: Date;
|
|
31
|
-
timeOfDeparture: string;
|
|
32
|
-
timeOfPickup: string;
|
|
33
|
-
noOfPassengers: number;
|
|
34
|
-
externalPassengerDetails: string;
|
|
35
|
-
destination: string;
|
|
36
|
-
travelInRespectOf: string;
|
|
37
|
-
startMeterReading: number;
|
|
38
|
-
endMeterReading: number;
|
|
39
|
-
mileage: number;
|
|
40
|
-
travelItinerary: string;
|
|
41
|
-
vehicleNo: string;
|
|
42
|
-
driverName: string;
|
|
43
|
-
vehicleType: string;
|
|
44
|
-
charge: string;
|
|
45
|
-
otherExpenses: string;
|
|
46
|
-
}
|
|
47
|
-
dateRequested: Date;
|
|
48
|
-
requestStatus: string; //Pending, Approved - Level 1, Approved, Confirmed, Rejected
|
|
49
|
-
requestedBy: mongoose.Types.ObjectId;
|
|
50
|
-
statusDate: Date;
|
|
51
|
-
requestedOn: Date;
|
|
52
|
-
level1ApprovalUserRole: string;
|
|
53
|
-
level1ApprovedBy: mongoose.Types.ObjectId;
|
|
54
|
-
level1ApprovedOn: Date;
|
|
55
|
-
level1ActionRemarks: string;
|
|
56
|
-
confirmedBy: mongoose.Types.ObjectId;
|
|
57
|
-
confirmedOn: Date;
|
|
58
|
-
confirmationRemarks: string,
|
|
59
|
-
rejectedBy: mongoose.Types.ObjectId;
|
|
60
|
-
rejectedOn: Date;
|
|
61
|
-
rejectedRemarks: string;
|
|
62
|
-
audit: Audit[];
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const serviceRequestSchema = new Schema<ServiceRequestDocument>({
|
|
66
|
-
requisitionId: { type: Number },
|
|
67
|
-
requestType: { type: String },
|
|
68
|
-
requestedBranch: {
|
|
69
|
-
type: Schema.Types.ObjectId,
|
|
70
|
-
ref: 'Branches', // Reference to the 'Branches' model
|
|
71
|
-
},
|
|
72
|
-
requestedFromBranch: {
|
|
73
|
-
type: Schema.Types.ObjectId,
|
|
74
|
-
ref: 'Branches', // Reference to the 'Branches' model
|
|
75
|
-
},
|
|
76
|
-
service:{
|
|
77
|
-
meetingRoom: {
|
|
78
|
-
type: Schema.Types.ObjectId,
|
|
79
|
-
ref: 'ir.Meeting.Rooms', // Reference to the 'MeetingRoom' model
|
|
80
|
-
default: null
|
|
81
|
-
},
|
|
82
|
-
startDate: { type: Date, default: null },
|
|
83
|
-
startTime: { type: String , default: ""},
|
|
84
|
-
endDate: { type: Date, default: null },
|
|
85
|
-
endTime: { type: String, default: "" },
|
|
86
|
-
isRecurring: { type: Boolean, default: false },
|
|
87
|
-
noOfParticipants: { type: Number, default: 0 },
|
|
88
|
-
equipments: [{
|
|
89
|
-
appliance: {
|
|
90
|
-
type: Schema.Types.ObjectId,
|
|
91
|
-
ref: 'ir.Appliances', // Reference to the 'Appliances' model
|
|
92
|
-
default: null
|
|
93
|
-
},
|
|
94
|
-
quantity: { type: Number, default: 0 },
|
|
95
|
-
}],
|
|
96
|
-
remark: { type: String, default: "" },
|
|
97
|
-
seatingArrangement: {
|
|
98
|
-
type: Schema.Types.ObjectId,
|
|
99
|
-
ref: 'ir.Seating.Arrangements', // Reference to the 'Seating arrangements' model
|
|
100
|
-
default: null
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
transport: {
|
|
104
|
-
vehicleCategory: {
|
|
105
|
-
type: Schema.Types.ObjectId,
|
|
106
|
-
ref: 'ir.Vehicle.Categories', // Reference to the 'Vehicle categories' model
|
|
107
|
-
default: null
|
|
108
|
-
},
|
|
109
|
-
hireName: { type: String, default: "" },
|
|
110
|
-
reason: { type: String, default: "" },
|
|
111
|
-
note: { type: String, default: "" },
|
|
112
|
-
startDateTime: { type: Date, default: null },
|
|
113
|
-
endDateTime: { type: Date, default: null },
|
|
114
|
-
timeOfDeparture: { type: String, default: "" },
|
|
115
|
-
timeOfPickup: { type: String, default: ""},
|
|
116
|
-
noOfPassengers: { type: Number, default: 0 },
|
|
117
|
-
externalPassengerDetails: { type: String, default: "" },
|
|
118
|
-
destination: { type: String, default: "" },
|
|
119
|
-
travelInRespectOf: { type: String, default: "" },
|
|
120
|
-
startMeterReading: { type: Number, default: 0 },
|
|
121
|
-
endMeterReading: { type: Number, default: 0 },
|
|
122
|
-
mileage: { type: Number, default: 0 },
|
|
123
|
-
travelItinerary: { type: String, default:"" },
|
|
124
|
-
vehicleNo: { type: String, default: "" },
|
|
125
|
-
driverName: { type: String, default: "" },
|
|
126
|
-
vehicleType: { type: String, default: "" },
|
|
127
|
-
charge: { type: String, default: "" },
|
|
128
|
-
otherExpenses: { type: String, default: "" },
|
|
129
|
-
},
|
|
130
|
-
requestedOn: { type: Date, default: now() },
|
|
131
|
-
requestStatus: {type: String, default: "Pending"}, //Pending, Approved - Level 1, Approved, Confirmed, Rejected
|
|
132
|
-
statusDate: {type: Date, default: now()},
|
|
133
|
-
requestedBy: {
|
|
134
|
-
type: Schema.Types.ObjectId,
|
|
135
|
-
ref: 'Users',
|
|
136
|
-
default: null
|
|
137
|
-
},
|
|
138
|
-
level1ApprovalUserRole: { type: String, default: ""},
|
|
139
|
-
level1ApprovedBy: {
|
|
140
|
-
type: Schema.Types.ObjectId,
|
|
141
|
-
ref: 'Users',
|
|
142
|
-
default: null
|
|
143
|
-
},
|
|
144
|
-
level1ApprovedOn: { type: Date, default: null},
|
|
145
|
-
level1ActionRemarks: { type: String, default: ""},
|
|
146
|
-
confirmedBy: {
|
|
147
|
-
type: Schema.Types.ObjectId,
|
|
148
|
-
ref: 'Users',
|
|
149
|
-
default: null
|
|
150
|
-
},
|
|
151
|
-
confirmedOn: { type: Date, default: null},
|
|
152
|
-
confirmationRemarks: { type: String, default: ""},
|
|
153
|
-
rejectedBy: {
|
|
154
|
-
type: Schema.Types.ObjectId,
|
|
155
|
-
ref: 'Users'
|
|
156
|
-
},
|
|
157
|
-
rejectedOn: { type: Date, default: null},
|
|
158
|
-
rejectedRemarks: { type: String, default: ""},
|
|
159
|
-
audit: [{
|
|
160
|
-
userId: { type: String },
|
|
161
|
-
auditedOn: { type: Date, default: null },
|
|
162
|
-
actionType: { type: String }
|
|
163
|
-
}]
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
const mongoServiceRequest = mongoose.model<ServiceRequestDocument>('ir.Service.Requests', serviceRequestSchema);
|
|
167
|
-
export { ServiceRequestDocument, mongoServiceRequest };
|
|
1
|
+
import mongoose, { Document, Schema, now } from 'mongoose';
|
|
2
|
+
import { Audit } from '../interface/Audit.interface';
|
|
3
|
+
|
|
4
|
+
interface ServiceRequestDocument extends Document {
|
|
5
|
+
requisitionId: number;
|
|
6
|
+
requestType: string;
|
|
7
|
+
requestedBranch: mongoose.Types.ObjectId;
|
|
8
|
+
requestedFromBranch: mongoose.Types.ObjectId;
|
|
9
|
+
service:{
|
|
10
|
+
meetingRoom: mongoose.Types.ObjectId;
|
|
11
|
+
startDate: Date;
|
|
12
|
+
startTime: string;
|
|
13
|
+
endDate: Date;
|
|
14
|
+
endTime: string;
|
|
15
|
+
isRecurring: boolean;
|
|
16
|
+
noOfParticipants: number;
|
|
17
|
+
equipments: [{
|
|
18
|
+
appliance: mongoose.Types.ObjectId;
|
|
19
|
+
quantity: number;
|
|
20
|
+
}];
|
|
21
|
+
remark: string;
|
|
22
|
+
seatingArrangement: mongoose.Types.ObjectId;
|
|
23
|
+
};
|
|
24
|
+
transport: {
|
|
25
|
+
vehicleCategory: mongoose.Types.ObjectId;
|
|
26
|
+
hireName: string;
|
|
27
|
+
reason: string;
|
|
28
|
+
note: string;
|
|
29
|
+
startDateTime: Date;
|
|
30
|
+
endDateTime: Date;
|
|
31
|
+
timeOfDeparture: string;
|
|
32
|
+
timeOfPickup: string;
|
|
33
|
+
noOfPassengers: number;
|
|
34
|
+
externalPassengerDetails: string;
|
|
35
|
+
destination: string;
|
|
36
|
+
travelInRespectOf: string;
|
|
37
|
+
startMeterReading: number;
|
|
38
|
+
endMeterReading: number;
|
|
39
|
+
mileage: number;
|
|
40
|
+
travelItinerary: string;
|
|
41
|
+
vehicleNo: string;
|
|
42
|
+
driverName: string;
|
|
43
|
+
vehicleType: string;
|
|
44
|
+
charge: string;
|
|
45
|
+
otherExpenses: string;
|
|
46
|
+
}
|
|
47
|
+
dateRequested: Date;
|
|
48
|
+
requestStatus: string; //Pending, Approved - Level 1, Approved, Confirmed, Rejected
|
|
49
|
+
requestedBy: mongoose.Types.ObjectId;
|
|
50
|
+
statusDate: Date;
|
|
51
|
+
requestedOn: Date;
|
|
52
|
+
level1ApprovalUserRole: string;
|
|
53
|
+
level1ApprovedBy: mongoose.Types.ObjectId;
|
|
54
|
+
level1ApprovedOn: Date;
|
|
55
|
+
level1ActionRemarks: string;
|
|
56
|
+
confirmedBy: mongoose.Types.ObjectId;
|
|
57
|
+
confirmedOn: Date;
|
|
58
|
+
confirmationRemarks: string,
|
|
59
|
+
rejectedBy: mongoose.Types.ObjectId;
|
|
60
|
+
rejectedOn: Date;
|
|
61
|
+
rejectedRemarks: string;
|
|
62
|
+
audit: Audit[];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const serviceRequestSchema = new Schema<ServiceRequestDocument>({
|
|
66
|
+
requisitionId: { type: Number },
|
|
67
|
+
requestType: { type: String },
|
|
68
|
+
requestedBranch: {
|
|
69
|
+
type: Schema.Types.ObjectId,
|
|
70
|
+
ref: 'Branches', // Reference to the 'Branches' model
|
|
71
|
+
},
|
|
72
|
+
requestedFromBranch: {
|
|
73
|
+
type: Schema.Types.ObjectId,
|
|
74
|
+
ref: 'Branches', // Reference to the 'Branches' model
|
|
75
|
+
},
|
|
76
|
+
service:{
|
|
77
|
+
meetingRoom: {
|
|
78
|
+
type: Schema.Types.ObjectId,
|
|
79
|
+
ref: 'ir.Meeting.Rooms', // Reference to the 'MeetingRoom' model
|
|
80
|
+
default: null
|
|
81
|
+
},
|
|
82
|
+
startDate: { type: Date, default: null },
|
|
83
|
+
startTime: { type: String , default: ""},
|
|
84
|
+
endDate: { type: Date, default: null },
|
|
85
|
+
endTime: { type: String, default: "" },
|
|
86
|
+
isRecurring: { type: Boolean, default: false },
|
|
87
|
+
noOfParticipants: { type: Number, default: 0 },
|
|
88
|
+
equipments: [{
|
|
89
|
+
appliance: {
|
|
90
|
+
type: Schema.Types.ObjectId,
|
|
91
|
+
ref: 'ir.Appliances', // Reference to the 'Appliances' model
|
|
92
|
+
default: null
|
|
93
|
+
},
|
|
94
|
+
quantity: { type: Number, default: 0 },
|
|
95
|
+
}],
|
|
96
|
+
remark: { type: String, default: "" },
|
|
97
|
+
seatingArrangement: {
|
|
98
|
+
type: Schema.Types.ObjectId,
|
|
99
|
+
ref: 'ir.Seating.Arrangements', // Reference to the 'Seating arrangements' model
|
|
100
|
+
default: null
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
transport: {
|
|
104
|
+
vehicleCategory: {
|
|
105
|
+
type: Schema.Types.ObjectId,
|
|
106
|
+
ref: 'ir.Vehicle.Categories', // Reference to the 'Vehicle categories' model
|
|
107
|
+
default: null
|
|
108
|
+
},
|
|
109
|
+
hireName: { type: String, default: "" },
|
|
110
|
+
reason: { type: String, default: "" },
|
|
111
|
+
note: { type: String, default: "" },
|
|
112
|
+
startDateTime: { type: Date, default: null },
|
|
113
|
+
endDateTime: { type: Date, default: null },
|
|
114
|
+
timeOfDeparture: { type: String, default: "" },
|
|
115
|
+
timeOfPickup: { type: String, default: ""},
|
|
116
|
+
noOfPassengers: { type: Number, default: 0 },
|
|
117
|
+
externalPassengerDetails: { type: String, default: "" },
|
|
118
|
+
destination: { type: String, default: "" },
|
|
119
|
+
travelInRespectOf: { type: String, default: "" },
|
|
120
|
+
startMeterReading: { type: Number, default: 0 },
|
|
121
|
+
endMeterReading: { type: Number, default: 0 },
|
|
122
|
+
mileage: { type: Number, default: 0 },
|
|
123
|
+
travelItinerary: { type: String, default:"" },
|
|
124
|
+
vehicleNo: { type: String, default: "" },
|
|
125
|
+
driverName: { type: String, default: "" },
|
|
126
|
+
vehicleType: { type: String, default: "" },
|
|
127
|
+
charge: { type: String, default: "" },
|
|
128
|
+
otherExpenses: { type: String, default: "" },
|
|
129
|
+
},
|
|
130
|
+
requestedOn: { type: Date, default: now() },
|
|
131
|
+
requestStatus: {type: String, default: "Pending"}, //Pending, Approved - Level 1, Approved, Confirmed, Rejected
|
|
132
|
+
statusDate: {type: Date, default: now()},
|
|
133
|
+
requestedBy: {
|
|
134
|
+
type: Schema.Types.ObjectId,
|
|
135
|
+
ref: 'Users',
|
|
136
|
+
default: null
|
|
137
|
+
},
|
|
138
|
+
level1ApprovalUserRole: { type: String, default: ""},
|
|
139
|
+
level1ApprovedBy: {
|
|
140
|
+
type: Schema.Types.ObjectId,
|
|
141
|
+
ref: 'Users',
|
|
142
|
+
default: null
|
|
143
|
+
},
|
|
144
|
+
level1ApprovedOn: { type: Date, default: null},
|
|
145
|
+
level1ActionRemarks: { type: String, default: ""},
|
|
146
|
+
confirmedBy: {
|
|
147
|
+
type: Schema.Types.ObjectId,
|
|
148
|
+
ref: 'Users',
|
|
149
|
+
default: null
|
|
150
|
+
},
|
|
151
|
+
confirmedOn: { type: Date, default: null},
|
|
152
|
+
confirmationRemarks: { type: String, default: ""},
|
|
153
|
+
rejectedBy: {
|
|
154
|
+
type: Schema.Types.ObjectId,
|
|
155
|
+
ref: 'Users'
|
|
156
|
+
},
|
|
157
|
+
rejectedOn: { type: Date, default: null},
|
|
158
|
+
rejectedRemarks: { type: String, default: ""},
|
|
159
|
+
audit: [{
|
|
160
|
+
userId: { type: String },
|
|
161
|
+
auditedOn: { type: Date, default: null },
|
|
162
|
+
actionType: { type: String }
|
|
163
|
+
}]
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
const mongoServiceRequest = mongoose.model<ServiceRequestDocument>('ir.Service.Requests', serviceRequestSchema);
|
|
167
|
+
export { ServiceRequestDocument, mongoServiceRequest };
|
package/models/User.model.ts
CHANGED
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
import mongoose, { Document, Schema } from 'mongoose';
|
|
2
|
-
import { Audit } from '../interface/Audit.interface';
|
|
3
|
-
|
|
4
|
-
interface UserDocument extends Document {
|
|
5
|
-
userId: string;
|
|
6
|
-
userName: string;
|
|
7
|
-
userEmail: string;
|
|
8
|
-
userType: string;
|
|
9
|
-
member: mongoose.Types.ObjectId;
|
|
10
|
-
userPassword: string;
|
|
11
|
-
unsuccessfulLoginAttempts: number;
|
|
12
|
-
lastSuccessfulLoginOn: Date;
|
|
13
|
-
oneTimePassword: string;
|
|
14
|
-
isFirstAccess: boolean;
|
|
15
|
-
isPasswordReset: boolean;
|
|
16
|
-
isProfileLocked: boolean;
|
|
17
|
-
profileLockedOn: Date;
|
|
18
|
-
passwordResetUniqueID: string;
|
|
19
|
-
//isMemberOfMasterBranch: boolean;
|
|
20
|
-
isActive: boolean;
|
|
21
|
-
isUserCreationNotified: Boolean;
|
|
22
|
-
isPasswordNotified: Boolean;
|
|
23
|
-
accessibleBranches: mongoose.Types.ObjectId[];
|
|
24
|
-
requisitionUserType: string;
|
|
25
|
-
requisitionBranches: mongoose.Types.ObjectId[];
|
|
26
|
-
audit: Audit[];
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
mongoose.set('strictPopulate', false);
|
|
30
|
-
|
|
31
|
-
const userSchema = new Schema<UserDocument>({
|
|
32
|
-
userId: String,
|
|
33
|
-
userName: String,
|
|
34
|
-
userEmail: String,
|
|
35
|
-
userType: String,
|
|
36
|
-
member: {
|
|
37
|
-
type: Schema.Types.ObjectId,
|
|
38
|
-
ref: 'Members', // Reference to the 'Members' model
|
|
39
|
-
},
|
|
40
|
-
userPassword: String,
|
|
41
|
-
unsuccessfulLoginAttempts: Number,
|
|
42
|
-
lastSuccessfulLoginOn: Date,
|
|
43
|
-
oneTimePassword: String,
|
|
44
|
-
isFirstAccess: { type: Boolean, default: true },
|
|
45
|
-
isPasswordReset: { type: Boolean, default: false },
|
|
46
|
-
isProfileLocked: { type: Boolean, default: false },
|
|
47
|
-
profileLockedOn: { type: Date, default: null },
|
|
48
|
-
passwordResetUniqueID: { type: String, default: "" },
|
|
49
|
-
//isMemberOfMasterBranch: { type: Boolean, default: false },
|
|
50
|
-
isActive: { type: Boolean, default: true },
|
|
51
|
-
isUserCreationNotified: { type: Boolean, default: false },
|
|
52
|
-
isPasswordNotified: { type: Boolean, default: false },
|
|
53
|
-
accessibleBranches: [{
|
|
54
|
-
type: Schema.Types.ObjectId,
|
|
55
|
-
ref: 'Branches', // Reference to the 'Branches' model
|
|
56
|
-
}],
|
|
57
|
-
requisitionUserType: { type: String, default: "" },
|
|
58
|
-
requisitionBranches: [{
|
|
59
|
-
type: Schema.Types.ObjectId,
|
|
60
|
-
ref: 'Branches', // Reference to the 'Branches' model
|
|
61
|
-
}],
|
|
62
|
-
audit: [{
|
|
63
|
-
userId: String,
|
|
64
|
-
auditedOn: { type: Date, default: Date.now() },
|
|
65
|
-
actionType: String
|
|
66
|
-
}]
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
const mongoUser = mongoose.model<UserDocument>('Users', userSchema);
|
|
70
|
-
|
|
71
|
-
export { UserDocument, mongoUser };
|
|
1
|
+
import mongoose, { Document, Schema } from 'mongoose';
|
|
2
|
+
import { Audit } from '../interface/Audit.interface';
|
|
3
|
+
|
|
4
|
+
interface UserDocument extends Document {
|
|
5
|
+
userId: string;
|
|
6
|
+
userName: string;
|
|
7
|
+
userEmail: string;
|
|
8
|
+
userType: string;
|
|
9
|
+
member: mongoose.Types.ObjectId;
|
|
10
|
+
userPassword: string;
|
|
11
|
+
unsuccessfulLoginAttempts: number;
|
|
12
|
+
lastSuccessfulLoginOn: Date;
|
|
13
|
+
oneTimePassword: string;
|
|
14
|
+
isFirstAccess: boolean;
|
|
15
|
+
isPasswordReset: boolean;
|
|
16
|
+
isProfileLocked: boolean;
|
|
17
|
+
profileLockedOn: Date;
|
|
18
|
+
passwordResetUniqueID: string;
|
|
19
|
+
//isMemberOfMasterBranch: boolean;
|
|
20
|
+
isActive: boolean;
|
|
21
|
+
isUserCreationNotified: Boolean;
|
|
22
|
+
isPasswordNotified: Boolean;
|
|
23
|
+
accessibleBranches: mongoose.Types.ObjectId[];
|
|
24
|
+
requisitionUserType: string;
|
|
25
|
+
requisitionBranches: mongoose.Types.ObjectId[];
|
|
26
|
+
audit: Audit[];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
mongoose.set('strictPopulate', false);
|
|
30
|
+
|
|
31
|
+
const userSchema = new Schema<UserDocument>({
|
|
32
|
+
userId: String,
|
|
33
|
+
userName: String,
|
|
34
|
+
userEmail: String,
|
|
35
|
+
userType: String,
|
|
36
|
+
member: {
|
|
37
|
+
type: Schema.Types.ObjectId,
|
|
38
|
+
ref: 'Members', // Reference to the 'Members' model
|
|
39
|
+
},
|
|
40
|
+
userPassword: String,
|
|
41
|
+
unsuccessfulLoginAttempts: Number,
|
|
42
|
+
lastSuccessfulLoginOn: Date,
|
|
43
|
+
oneTimePassword: String,
|
|
44
|
+
isFirstAccess: { type: Boolean, default: true },
|
|
45
|
+
isPasswordReset: { type: Boolean, default: false },
|
|
46
|
+
isProfileLocked: { type: Boolean, default: false },
|
|
47
|
+
profileLockedOn: { type: Date, default: null },
|
|
48
|
+
passwordResetUniqueID: { type: String, default: "" },
|
|
49
|
+
//isMemberOfMasterBranch: { type: Boolean, default: false },
|
|
50
|
+
isActive: { type: Boolean, default: true },
|
|
51
|
+
isUserCreationNotified: { type: Boolean, default: false },
|
|
52
|
+
isPasswordNotified: { type: Boolean, default: false },
|
|
53
|
+
accessibleBranches: [{
|
|
54
|
+
type: Schema.Types.ObjectId,
|
|
55
|
+
ref: 'Branches', // Reference to the 'Branches' model
|
|
56
|
+
}],
|
|
57
|
+
requisitionUserType: { type: String, default: "" },
|
|
58
|
+
requisitionBranches: [{
|
|
59
|
+
type: Schema.Types.ObjectId,
|
|
60
|
+
ref: 'Branches', // Reference to the 'Branches' model
|
|
61
|
+
}],
|
|
62
|
+
audit: [{
|
|
63
|
+
userId: String,
|
|
64
|
+
auditedOn: { type: Date, default: Date.now() },
|
|
65
|
+
actionType: String
|
|
66
|
+
}]
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
const mongoUser = mongoose.model<UserDocument>('Users', userSchema);
|
|
70
|
+
|
|
71
|
+
export { UserDocument, mongoUser };
|
package/models/UserRole.model.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import mongoose, { Document, Schema } from 'mongoose';
|
|
2
|
-
|
|
3
|
-
interface UserRoleDocument extends Document {
|
|
4
|
-
userRoleId: string;
|
|
5
|
-
applicationModule: string;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
const userRoleSchema = new Schema<UserRoleDocument>({
|
|
9
|
-
userRoleId: { type: String },
|
|
10
|
-
applicationModule: { type: String }
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
const mongoUserRole = mongoose.model<UserRoleDocument>('UserRoles', userRoleSchema);
|
|
14
|
-
|
|
15
|
-
export { UserRoleDocument, mongoUserRole };
|
|
1
|
+
import mongoose, { Document, Schema } from 'mongoose';
|
|
2
|
+
|
|
3
|
+
interface UserRoleDocument extends Document {
|
|
4
|
+
userRoleId: string;
|
|
5
|
+
applicationModule: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const userRoleSchema = new Schema<UserRoleDocument>({
|
|
9
|
+
userRoleId: { type: String },
|
|
10
|
+
applicationModule: { type: String }
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
const mongoUserRole = mongoose.model<UserRoleDocument>('UserRoles', userRoleSchema);
|
|
14
|
+
|
|
15
|
+
export { UserRoleDocument, mongoUserRole };
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import mongoose, { Document, Schema } from 'mongoose';
|
|
2
|
-
import { Audit } from '../interface/Audit.interface';
|
|
3
|
-
|
|
4
|
-
interface VehicleCategoryDocument extends Document {
|
|
5
|
-
vehicleCategoryCode: string;
|
|
6
|
-
vehicleCategoryName: string;
|
|
7
|
-
isActive: boolean;
|
|
8
|
-
audit: Audit[];
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const vehicleCategorySchema = new Schema<VehicleCategoryDocument>({
|
|
12
|
-
vehicleCategoryCode: { type: String },
|
|
13
|
-
vehicleCategoryName: { type: String },
|
|
14
|
-
isActive: { type: Boolean, default: true },
|
|
15
|
-
audit: [{
|
|
16
|
-
userId: { type: String },
|
|
17
|
-
auditedOn: { type: Date, default: null },
|
|
18
|
-
actionType: { type: String }
|
|
19
|
-
}]
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
const mongoVehicleCategory = mongoose.model<VehicleCategoryDocument>('ir.Vehicle.Categories', vehicleCategorySchema);
|
|
23
|
-
|
|
24
|
-
export { VehicleCategoryDocument, mongoVehicleCategory };
|
|
1
|
+
import mongoose, { Document, Schema } from 'mongoose';
|
|
2
|
+
import { Audit } from '../interface/Audit.interface';
|
|
3
|
+
|
|
4
|
+
interface VehicleCategoryDocument extends Document {
|
|
5
|
+
vehicleCategoryCode: string;
|
|
6
|
+
vehicleCategoryName: string;
|
|
7
|
+
isActive: boolean;
|
|
8
|
+
audit: Audit[];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const vehicleCategorySchema = new Schema<VehicleCategoryDocument>({
|
|
12
|
+
vehicleCategoryCode: { type: String },
|
|
13
|
+
vehicleCategoryName: { type: String },
|
|
14
|
+
isActive: { type: Boolean, default: true },
|
|
15
|
+
audit: [{
|
|
16
|
+
userId: { type: String },
|
|
17
|
+
auditedOn: { type: Date, default: null },
|
|
18
|
+
actionType: { type: String }
|
|
19
|
+
}]
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const mongoVehicleCategory = mongoose.model<VehicleCategoryDocument>('ir.Vehicle.Categories', vehicleCategorySchema);
|
|
23
|
+
|
|
24
|
+
export { VehicleCategoryDocument, mongoVehicleCategory };
|