pristine-member-nest-api-database 1.0.99 → 1.2.3
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/index.js +1 -0
- package/dist/models/ApplicationState.model.js +13 -0
- package/dist/models/Member.model.js +14 -2
- package/dist/models/User.model.js +24 -13
- package/index.ts +1 -0
- package/models/ApplicationState.model.ts +24 -0
- package/models/Member.model.ts +14 -2
- package/models/User.model.ts +35 -21
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -57,6 +57,7 @@ __exportStar(require("./models/Editor.Container.Category.mapping"), exports);
|
|
|
57
57
|
__exportStar(require("./models/Editor.BPcompanyTypes.Branch.Field.Mapping"), exports);
|
|
58
58
|
__exportStar(require("./models/Editor.SLIITO.Branch.MembershipTypes.Field.Mapping"), exports);
|
|
59
59
|
__exportStar(require("./models/Editor.Application.model"), exports);
|
|
60
|
+
__exportStar(require("./models/ApplicationState.model"), exports);
|
|
60
61
|
__exportStar(require("./src/dbConnect"), exports);
|
|
61
62
|
//packege version 1.0.37 gs1 changes
|
|
62
63
|
//packege version 1.0.38 and 1.0.38 after application(application verification stable 1.0.40) verification without GS1 changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mongoApplicationState = void 0;
|
|
4
|
+
const mongoose_1 = require("mongoose");
|
|
5
|
+
const ApplicationStateSchema = new mongoose_1.Schema({
|
|
6
|
+
referenceId: { type: String, required: true, unique: true },
|
|
7
|
+
payload: { type: mongoose_1.Schema.Types.Mixed, required: true },
|
|
8
|
+
expiresAt: { type: Date, required: true },
|
|
9
|
+
intendedUserId: { type: String, required: true },
|
|
10
|
+
});
|
|
11
|
+
ApplicationStateSchema.index({ expiresAt: 1 }, { expireAfterSeconds: 0 });
|
|
12
|
+
const mongoApplicationState = (0, mongoose_1.model)("ApplicationState", ApplicationStateSchema);
|
|
13
|
+
exports.mongoApplicationState = mongoApplicationState;
|
|
@@ -588,11 +588,13 @@ const barcodeMembershipSchema = new mongoose_1.Schema({
|
|
|
588
588
|
type: mongoose_1.Schema.Types.ObjectId,
|
|
589
589
|
ref: "Membership.Types",
|
|
590
590
|
required: true,
|
|
591
|
+
set: (v) => (v === "" ? null : v),
|
|
591
592
|
},
|
|
592
593
|
membershipStatus: {
|
|
593
594
|
type: mongoose_1.Schema.Types.ObjectId,
|
|
594
595
|
ref: "Membership.Statuses",
|
|
595
596
|
required: true,
|
|
597
|
+
set: (v) => (v === "" ? null : v),
|
|
596
598
|
},
|
|
597
599
|
remarks: String,
|
|
598
600
|
requestedDate: { type: Date, default: null },
|
|
@@ -614,8 +616,18 @@ const barcodeMembershipSchema = new mongoose_1.Schema({
|
|
|
614
616
|
// ------------------ None GS1 Membership ------------------
|
|
615
617
|
const noneGs1MembershipSchema = new mongoose_1.Schema({
|
|
616
618
|
associationMemberCode: String,
|
|
617
|
-
membershipStatus: {
|
|
618
|
-
|
|
619
|
+
membershipStatus: {
|
|
620
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
621
|
+
ref: "Membership.Statuses",
|
|
622
|
+
required: true,
|
|
623
|
+
set: (v) => (v === "" ? null : v),
|
|
624
|
+
},
|
|
625
|
+
membershipType: {
|
|
626
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
627
|
+
ref: "Membership.Types",
|
|
628
|
+
required: true,
|
|
629
|
+
set: (v) => (v === "" ? null : v),
|
|
630
|
+
},
|
|
619
631
|
isTerminated: Boolean,
|
|
620
632
|
terminatedDate: Date,
|
|
621
633
|
reasonForTermination: String,
|
|
@@ -25,7 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.mongoUser = void 0;
|
|
27
27
|
const mongoose_1 = __importStar(require("mongoose"));
|
|
28
|
-
mongoose_1.default.set(
|
|
28
|
+
mongoose_1.default.set("strictPopulate", false);
|
|
29
29
|
const userSchema = new mongoose_1.Schema({
|
|
30
30
|
userId: String,
|
|
31
31
|
userName: String,
|
|
@@ -33,12 +33,17 @@ const userSchema = new mongoose_1.Schema({
|
|
|
33
33
|
userType: String,
|
|
34
34
|
member: {
|
|
35
35
|
type: mongoose_1.Schema.Types.ObjectId,
|
|
36
|
-
ref:
|
|
36
|
+
ref: "Members", // Reference to the 'Members' model
|
|
37
|
+
},
|
|
38
|
+
linkMemberUser: {
|
|
39
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
40
|
+
ref: "Users", // Reference to the 'Users' model (represents the linked member user)
|
|
37
41
|
},
|
|
38
42
|
userPassword: String,
|
|
39
43
|
unsuccessfulLoginAttempts: Number,
|
|
40
44
|
lastSuccessfulLoginOn: Date,
|
|
41
|
-
oneTimePassword: String,
|
|
45
|
+
oneTimePassword: { type: String, default: "" },
|
|
46
|
+
otpExpiresAt: { type: Date, default: null },
|
|
42
47
|
companyName: { type: String },
|
|
43
48
|
contactNumber: { type: String },
|
|
44
49
|
isFirstAccess: { type: Boolean, default: true },
|
|
@@ -50,20 +55,26 @@ const userSchema = new mongoose_1.Schema({
|
|
|
50
55
|
isActive: { type: Boolean, default: true },
|
|
51
56
|
isUserCreationNotified: { type: Boolean, default: false },
|
|
52
57
|
isPasswordNotified: { type: Boolean, default: false },
|
|
53
|
-
accessibleBranches: [
|
|
58
|
+
accessibleBranches: [
|
|
59
|
+
{
|
|
54
60
|
type: mongoose_1.Schema.Types.ObjectId,
|
|
55
|
-
ref:
|
|
56
|
-
}
|
|
61
|
+
ref: "Branches", // Reference to the 'Branches' model
|
|
62
|
+
},
|
|
63
|
+
],
|
|
57
64
|
requisitionUserType: { type: String, default: "" },
|
|
58
|
-
requisitionBranches: [
|
|
65
|
+
requisitionBranches: [
|
|
66
|
+
{
|
|
59
67
|
type: mongoose_1.Schema.Types.ObjectId,
|
|
60
|
-
ref:
|
|
61
|
-
}
|
|
62
|
-
|
|
68
|
+
ref: "Branches", // Reference to the 'Branches' model
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
audit: [
|
|
72
|
+
{
|
|
63
73
|
userId: String,
|
|
64
74
|
auditedOn: { type: Date, default: Date.now() },
|
|
65
|
-
actionType: String
|
|
66
|
-
}
|
|
75
|
+
actionType: String,
|
|
76
|
+
},
|
|
77
|
+
],
|
|
67
78
|
});
|
|
68
|
-
const mongoUser = mongoose_1.default.model(
|
|
79
|
+
const mongoUser = mongoose_1.default.model("Users", userSchema);
|
|
69
80
|
exports.mongoUser = mongoUser;
|
package/index.ts
CHANGED
|
@@ -45,6 +45,7 @@ export * from "./models/Editor.BPcompanyTypes.Branch.Field.Mapping";
|
|
|
45
45
|
export * from "./models/Editor.SLIITO.Branch.MembershipTypes.Field.Mapping";
|
|
46
46
|
|
|
47
47
|
export * from "./models/Editor.Application.model";
|
|
48
|
+
export * from "./models/ApplicationState.model"
|
|
48
49
|
|
|
49
50
|
export * from "./src/dbConnect";
|
|
50
51
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Schema, Document, model } from "mongoose";
|
|
2
|
+
|
|
3
|
+
interface IApplicationStateDocument extends Document {
|
|
4
|
+
referenceId: string;
|
|
5
|
+
payload: any;
|
|
6
|
+
expiresAt: Date;
|
|
7
|
+
intendedUserId: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const ApplicationStateSchema = new Schema<IApplicationStateDocument>({
|
|
11
|
+
referenceId: { type: String, required: true, unique: true },
|
|
12
|
+
payload: { type: Schema.Types.Mixed, required: true },
|
|
13
|
+
expiresAt: { type: Date, required: true },
|
|
14
|
+
intendedUserId: { type: String, required: true },
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
ApplicationStateSchema.index({ expiresAt: 1 }, { expireAfterSeconds: 0 });
|
|
18
|
+
|
|
19
|
+
const mongoApplicationState = model<IApplicationStateDocument>(
|
|
20
|
+
"ApplicationState",
|
|
21
|
+
ApplicationStateSchema,
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
export { IApplicationStateDocument, mongoApplicationState };
|
package/models/Member.model.ts
CHANGED
|
@@ -740,11 +740,13 @@ const barcodeMembershipSchema = new Schema({
|
|
|
740
740
|
type: Schema.Types.ObjectId,
|
|
741
741
|
ref: "Membership.Types",
|
|
742
742
|
required: true,
|
|
743
|
+
set: (v: string) => (v === "" ? null : v),
|
|
743
744
|
},
|
|
744
745
|
membershipStatus: {
|
|
745
746
|
type: Schema.Types.ObjectId,
|
|
746
747
|
ref: "Membership.Statuses",
|
|
747
748
|
required: true,
|
|
749
|
+
set: (v: string) => (v === "" ? null : v),
|
|
748
750
|
},
|
|
749
751
|
remarks: String,
|
|
750
752
|
requestedDate: { type: Date, default: null },
|
|
@@ -767,8 +769,18 @@ const barcodeMembershipSchema = new Schema({
|
|
|
767
769
|
// ------------------ None GS1 Membership ------------------
|
|
768
770
|
const noneGs1MembershipSchema = new Schema({
|
|
769
771
|
associationMemberCode: String,
|
|
770
|
-
membershipStatus: {
|
|
771
|
-
|
|
772
|
+
membershipStatus: {
|
|
773
|
+
type: Schema.Types.ObjectId,
|
|
774
|
+
ref: "Membership.Statuses",
|
|
775
|
+
required: true,
|
|
776
|
+
set: (v: string) => (v === "" ? null : v),
|
|
777
|
+
},
|
|
778
|
+
membershipType: {
|
|
779
|
+
type: Schema.Types.ObjectId,
|
|
780
|
+
ref: "Membership.Types",
|
|
781
|
+
required: true,
|
|
782
|
+
set: (v: string) => (v === "" ? null : v),
|
|
783
|
+
},
|
|
772
784
|
isTerminated: Boolean,
|
|
773
785
|
terminatedDate: Date,
|
|
774
786
|
reasonForTermination: String,
|
package/models/User.model.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import mongoose, { Document, Schema } from
|
|
2
|
-
import { Audit } from
|
|
1
|
+
import mongoose, { Document, Schema } from "mongoose";
|
|
2
|
+
import { Audit } from "../interface/Audit.interface";
|
|
3
3
|
|
|
4
4
|
interface UserDocument extends Document {
|
|
5
5
|
userId: string;
|
|
@@ -11,6 +11,7 @@ interface UserDocument extends Document {
|
|
|
11
11
|
unsuccessfulLoginAttempts: number;
|
|
12
12
|
lastSuccessfulLoginOn: Date;
|
|
13
13
|
oneTimePassword: string;
|
|
14
|
+
otpExpiresAt: Date | null;
|
|
14
15
|
isFirstAccess: boolean;
|
|
15
16
|
isPasswordReset: boolean;
|
|
16
17
|
isProfileLocked: boolean;
|
|
@@ -23,12 +24,13 @@ interface UserDocument extends Document {
|
|
|
23
24
|
accessibleBranches: mongoose.Types.ObjectId[];
|
|
24
25
|
requisitionUserType: string;
|
|
25
26
|
requisitionBranches: mongoose.Types.ObjectId[];
|
|
26
|
-
companyName:string;
|
|
27
|
-
contactNumber:string;
|
|
27
|
+
companyName: string;
|
|
28
|
+
contactNumber: string;
|
|
28
29
|
audit: Audit[];
|
|
30
|
+
linkMemberUser: mongoose.Types.ObjectId;
|
|
29
31
|
}
|
|
30
32
|
|
|
31
|
-
mongoose.set(
|
|
33
|
+
mongoose.set("strictPopulate", false);
|
|
32
34
|
|
|
33
35
|
const userSchema = new Schema<UserDocument>({
|
|
34
36
|
userId: String,
|
|
@@ -37,12 +39,17 @@ const userSchema = new Schema<UserDocument>({
|
|
|
37
39
|
userType: String,
|
|
38
40
|
member: {
|
|
39
41
|
type: Schema.Types.ObjectId,
|
|
40
|
-
ref:
|
|
42
|
+
ref: "Members", // Reference to the 'Members' model
|
|
43
|
+
},
|
|
44
|
+
linkMemberUser: {
|
|
45
|
+
type: Schema.Types.ObjectId,
|
|
46
|
+
ref: "Users", // Reference to the 'Users' model (represents the linked member user)
|
|
41
47
|
},
|
|
42
48
|
userPassword: String,
|
|
43
49
|
unsuccessfulLoginAttempts: Number,
|
|
44
50
|
lastSuccessfulLoginOn: Date,
|
|
45
|
-
oneTimePassword: String,
|
|
51
|
+
oneTimePassword: { type: String, default: "" },
|
|
52
|
+
otpExpiresAt: { type: Date, default: null },
|
|
46
53
|
companyName: { type: String },
|
|
47
54
|
contactNumber: { type: String },
|
|
48
55
|
isFirstAccess: { type: Boolean, default: true },
|
|
@@ -54,22 +61,29 @@ const userSchema = new Schema<UserDocument>({
|
|
|
54
61
|
isActive: { type: Boolean, default: true },
|
|
55
62
|
isUserCreationNotified: { type: Boolean, default: false },
|
|
56
63
|
isPasswordNotified: { type: Boolean, default: false },
|
|
57
|
-
accessibleBranches: [
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
64
|
+
accessibleBranches: [
|
|
65
|
+
{
|
|
66
|
+
type: Schema.Types.ObjectId,
|
|
67
|
+
ref: "Branches", // Reference to the 'Branches' model
|
|
68
|
+
},
|
|
69
|
+
],
|
|
61
70
|
requisitionUserType: { type: String, default: "" },
|
|
62
|
-
requisitionBranches: [
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
+
requisitionBranches: [
|
|
72
|
+
{
|
|
73
|
+
type: Schema.Types.ObjectId,
|
|
74
|
+
ref: "Branches", // Reference to the 'Branches' model
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
audit: [
|
|
78
|
+
{
|
|
79
|
+
userId: String,
|
|
80
|
+
auditedOn: { type: Date, default: Date.now() },
|
|
81
|
+
actionType: String,
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
|
|
71
85
|
});
|
|
72
86
|
|
|
73
|
-
const mongoUser = mongoose.model<UserDocument>(
|
|
87
|
+
const mongoUser = mongoose.model<UserDocument>("Users", userSchema);
|
|
74
88
|
|
|
75
89
|
export { UserDocument, mongoUser };
|