pristine-member-nest-api-database 1.0.63 → 1.0.65
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 +2 -2
- package/dist/models/Editor.Category.Field.Mapping.js +57 -0
- package/dist/models/Editor.Container.Category.mapping.js +107 -0
- package/dist/models/Member.model.V1.js +33 -0
- package/dist/models/Member.model.js +141 -199
- package/index.ts +2 -2
- package/models/Editor.Application.model.ts +0 -41
- package/models/Editor.Category.Field.Mapping.ts +51 -0
- package/models/Editor.Container.Category.mapping.ts +107 -0
- package/models/Member.model.V1.ts +352 -0
- package/models/Member.model.ts +304 -0
- package/package.json +1 -1
- package/models/Editor.PureStatic.Category.Field.Mapping.ts +0 -35
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
import mongoose, { Document, Schema } from "mongoose";
|
|
2
|
+
import { Audit } from "../interface/Audit.interface";
|
|
3
|
+
import IFile from "../interface/IFile.interface";
|
|
4
|
+
|
|
5
|
+
type barcodeBranchMemberhipdetails = {
|
|
6
|
+
isRegisteredMembership: boolean; //field is used to check whether membership is created on first time registering
|
|
7
|
+
isMembershipRequested: boolean; //means membership request is waiting for approval
|
|
8
|
+
membershipType: mongoose.Types.ObjectId;
|
|
9
|
+
membershipStatus: mongoose.Types.ObjectId;
|
|
10
|
+
remarks: String;
|
|
11
|
+
requestedDate: Date;
|
|
12
|
+
isMembershipSynced: boolean; //used to check whether SAP sync done or not
|
|
13
|
+
noOfSubscriptionMonths: number;
|
|
14
|
+
isIssued: boolean; //means subscription is issued or not
|
|
15
|
+
electedDate: Date;
|
|
16
|
+
barcodeBranchMemberCode: string;
|
|
17
|
+
barCode: number;
|
|
18
|
+
validFrom: Date;
|
|
19
|
+
validTo: Date;
|
|
20
|
+
countryCode: number;
|
|
21
|
+
changeDate: Date;
|
|
22
|
+
isTerminationRequested: boolean;
|
|
23
|
+
isTerminationSynced: boolean; //used to check whether SAP sync done or not
|
|
24
|
+
terminationDate: Date;
|
|
25
|
+
terminationReason: string;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
type noneGs1MembershipDetails = {
|
|
29
|
+
associationMemberCode: string;
|
|
30
|
+
membershipStatus: mongoose.Types.ObjectId;
|
|
31
|
+
membershipType: mongoose.Types.ObjectId;
|
|
32
|
+
isTerminated: boolean;
|
|
33
|
+
terminatedDate: Date;
|
|
34
|
+
reasonForTermination: string;
|
|
35
|
+
isTerminationRequested: boolean;
|
|
36
|
+
terminationRequestedDate: Date;
|
|
37
|
+
terminationRequestedBy: string;
|
|
38
|
+
terminationRequestRemarks: string;
|
|
39
|
+
onOfSubscriptionMonths: number;
|
|
40
|
+
isMembershipSynced: boolean;
|
|
41
|
+
SyncOn: Date;
|
|
42
|
+
electedDate: Date;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
interface MemberDocument extends Document {
|
|
46
|
+
memberId: number;
|
|
47
|
+
memberCode: string;
|
|
48
|
+
memberName: string;
|
|
49
|
+
isMemberOfMasterBranch: boolean;
|
|
50
|
+
|
|
51
|
+
pureStaticMemberLevelFieldValues: [
|
|
52
|
+
{
|
|
53
|
+
fieldId: mongoose.Types.ObjectId;
|
|
54
|
+
value: string;
|
|
55
|
+
},
|
|
56
|
+
];
|
|
57
|
+
//Member Level Sync
|
|
58
|
+
isCreatedInSAP: boolean;
|
|
59
|
+
isMemberSyncedWithSAP: boolean;
|
|
60
|
+
memberSyncedOn: Date;
|
|
61
|
+
isActive: boolean;
|
|
62
|
+
|
|
63
|
+
//new
|
|
64
|
+
memberAssociation: [
|
|
65
|
+
{
|
|
66
|
+
applicationId: mongoose.Types.ObjectId;
|
|
67
|
+
branchId: mongoose.Types.ObjectId;
|
|
68
|
+
|
|
69
|
+
categoryData: [
|
|
70
|
+
{
|
|
71
|
+
categoryId: mongoose.Types.ObjectId;
|
|
72
|
+
fieldValues: [
|
|
73
|
+
{
|
|
74
|
+
fieldId: mongoose.Types.ObjectId;
|
|
75
|
+
value: string | number | any;
|
|
76
|
+
},
|
|
77
|
+
];
|
|
78
|
+
},
|
|
79
|
+
];
|
|
80
|
+
membershipData: {
|
|
81
|
+
fieldId: mongoose.Types.ObjectId;
|
|
82
|
+
value: barcodeBranchMemberhipdetails[] | noneGs1MembershipDetails;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
isCreatedInSAP: boolean;
|
|
86
|
+
isMemberSyncedWithSAP: boolean;
|
|
87
|
+
memberSyncedOn: Date;
|
|
88
|
+
dynamicDetails: JSON;
|
|
89
|
+
|
|
90
|
+
applicationStatus: string;
|
|
91
|
+
isEnrolmentCreatedInSAP: boolean;
|
|
92
|
+
isEnrolmentSyncedWithSAP: boolean;
|
|
93
|
+
enrolmentSyncedOn: Date;
|
|
94
|
+
salesOrderDocEntry: string; // SAP sales order doc entry when creating BP in SAP
|
|
95
|
+
salesOrderStatus: string; // SAP sales order status when creating BP in SAP
|
|
96
|
+
isActive: boolean;
|
|
97
|
+
createdDate: Date;
|
|
98
|
+
approverOneData: {
|
|
99
|
+
fieldId: mongoose.Types.ObjectId;
|
|
100
|
+
remarks: string;
|
|
101
|
+
userId: string;
|
|
102
|
+
attachment: IFile[];
|
|
103
|
+
};
|
|
104
|
+
approverTwoData: {
|
|
105
|
+
fieldId: mongoose.Types.ObjectId;
|
|
106
|
+
remarks: string;
|
|
107
|
+
userId: string;
|
|
108
|
+
attachment: IFile[];
|
|
109
|
+
};
|
|
110
|
+
},
|
|
111
|
+
];
|
|
112
|
+
audit: Audit[];
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
mongoose.set("strictPopulate", false);
|
|
116
|
+
|
|
117
|
+
/* ------------------------------------------------ */
|
|
118
|
+
/* File Schema */
|
|
119
|
+
/* ------------------------------------------------ */
|
|
120
|
+
|
|
121
|
+
const fileSchema = new Schema<IFile>({
|
|
122
|
+
baseURL: { type: String },
|
|
123
|
+
fileName: { type: String },
|
|
124
|
+
fileExtension: { type: String },
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
/* ------------------------------------------------ */
|
|
128
|
+
/* Barcode Membership Schema */
|
|
129
|
+
/* ------------------------------------------------ */
|
|
130
|
+
|
|
131
|
+
const barcodeMembershipSchema = new Schema({
|
|
132
|
+
isRegisteredMembership: { type: Boolean, required: true },
|
|
133
|
+
isMembershipRequested: { type: Boolean, default: true },
|
|
134
|
+
membershipType: {
|
|
135
|
+
type: Schema.Types.ObjectId,
|
|
136
|
+
ref: "Membership.Types",
|
|
137
|
+
required: true,
|
|
138
|
+
},
|
|
139
|
+
membershipStatus: {
|
|
140
|
+
type: Schema.Types.ObjectId,
|
|
141
|
+
ref: "Membership.Statuses",
|
|
142
|
+
required: true,
|
|
143
|
+
},
|
|
144
|
+
remarks: { type: String },
|
|
145
|
+
requestedDate: { type: Date, default: Date.now },
|
|
146
|
+
isMembershipSynced: { type: Boolean, default: false },
|
|
147
|
+
noOfSubscriptionMonths: { type: Number },
|
|
148
|
+
isIssued: { type: Boolean },
|
|
149
|
+
electedDate: { type: Date },
|
|
150
|
+
barcodeBranchMemberCode: { type: String },
|
|
151
|
+
barCode: { type: Number },
|
|
152
|
+
validFrom: { type: Date },
|
|
153
|
+
validTo: { type: Date },
|
|
154
|
+
countryCode: { type: Number },
|
|
155
|
+
changeDate: { type: Date },
|
|
156
|
+
isTerminationRequested: { type: Boolean, default: false },
|
|
157
|
+
isTerminationSynced: { type: Boolean, default: false },
|
|
158
|
+
terminationDate: { type: Date },
|
|
159
|
+
terminationReason: { type: String },
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
/* ------------------------------------------------ */
|
|
163
|
+
/* None GS1 Membership Schema */
|
|
164
|
+
/* ------------------------------------------------ */
|
|
165
|
+
|
|
166
|
+
const noneGs1MembershipSchema = new Schema({
|
|
167
|
+
associationMemberCode: { type: String },
|
|
168
|
+
membershipStatus: {
|
|
169
|
+
type: Schema.Types.ObjectId,
|
|
170
|
+
ref: "Membership.Statuses",
|
|
171
|
+
},
|
|
172
|
+
membershipType: {
|
|
173
|
+
type: Schema.Types.ObjectId,
|
|
174
|
+
ref: "Membership.Types",
|
|
175
|
+
},
|
|
176
|
+
isTerminated: { type: Boolean },
|
|
177
|
+
terminatedDate: { type: Date },
|
|
178
|
+
reasonForTermination: { type: String },
|
|
179
|
+
isTerminationRequested: { type: Boolean },
|
|
180
|
+
terminationRequestedDate: { type: Date },
|
|
181
|
+
terminationRequestedBy: { type: String },
|
|
182
|
+
terminationRequestRemarks: { type: String },
|
|
183
|
+
onOfSubscriptionMonths: { type: Number },
|
|
184
|
+
isMembershipSynced: { type: Boolean },
|
|
185
|
+
SyncOn: { type: Date },
|
|
186
|
+
electedDate: { type: Date },
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
/* ------------------------------------------------ */
|
|
190
|
+
/* Category Field Value */
|
|
191
|
+
/* ------------------------------------------------ */
|
|
192
|
+
|
|
193
|
+
const fieldValueSchema = new Schema({
|
|
194
|
+
fieldId: {
|
|
195
|
+
type: Schema.Types.ObjectId,
|
|
196
|
+
ref: "Editor.Fields.Master",
|
|
197
|
+
},
|
|
198
|
+
value: { type: Schema.Types.Mixed },
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
/* ------------------------------------------------ */
|
|
202
|
+
/* Category Schema */
|
|
203
|
+
/* ------------------------------------------------ */
|
|
204
|
+
|
|
205
|
+
const categorySchema = new Schema({
|
|
206
|
+
categoryId: {
|
|
207
|
+
type: Schema.Types.ObjectId,
|
|
208
|
+
ref: "Field.Categories",
|
|
209
|
+
},
|
|
210
|
+
fieldValues: [fieldValueSchema],
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
/* ------------------------------------------------ */
|
|
214
|
+
/* Membership Data */
|
|
215
|
+
/* ------------------------------------------------ */
|
|
216
|
+
|
|
217
|
+
const membershipDataSchema = new Schema({
|
|
218
|
+
fieldId: {
|
|
219
|
+
type: Schema.Types.ObjectId,
|
|
220
|
+
},
|
|
221
|
+
barcodeBranchMembership: [barcodeMembershipSchema],
|
|
222
|
+
noneGs1Membership: noneGs1MembershipSchema,
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
/* ------------------------------------------------ */
|
|
226
|
+
/* Approver Schema */
|
|
227
|
+
/* ------------------------------------------------ */
|
|
228
|
+
|
|
229
|
+
const approverSchema = new Schema({
|
|
230
|
+
fieldId: { type: Schema.Types.ObjectId },
|
|
231
|
+
remarks: { type: String },
|
|
232
|
+
userId: { type: String },
|
|
233
|
+
attachment: [fileSchema],
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
/* ------------------------------------------------ */
|
|
237
|
+
/* Member Association */
|
|
238
|
+
/* ------------------------------------------------ */
|
|
239
|
+
|
|
240
|
+
const memberAssociationSchema = new Schema({
|
|
241
|
+
applicationId: {
|
|
242
|
+
type: Schema.Types.ObjectId,
|
|
243
|
+
},
|
|
244
|
+
branchId: {
|
|
245
|
+
type: Schema.Types.ObjectId,
|
|
246
|
+
ref: "Branches",
|
|
247
|
+
},
|
|
248
|
+
categoryData: [categorySchema],
|
|
249
|
+
membershipData: membershipDataSchema,
|
|
250
|
+
isCreatedInSAP: { type: Boolean, default: false },
|
|
251
|
+
isMemberSyncedWithSAP: { type: Boolean, default: false },
|
|
252
|
+
memberSyncedOn: { type: Date },
|
|
253
|
+
dynamicDetails: { type: JSON, default: null },
|
|
254
|
+
applicationStatus: { type: String },
|
|
255
|
+
isEnrolmentCreatedInSAP: { type: Boolean, default: false },
|
|
256
|
+
isEnrolmentSyncedWithSAP: { type: Boolean, default: false },
|
|
257
|
+
enrolmentSyncedOn: { type: Date },
|
|
258
|
+
salesOrderDocEntry: { type: String },
|
|
259
|
+
salesOrderStatus: { type: String },
|
|
260
|
+
isActive: { type: Boolean, default: true },
|
|
261
|
+
createdDate: {
|
|
262
|
+
type: Date,
|
|
263
|
+
default: Date.now,
|
|
264
|
+
},
|
|
265
|
+
approverOneData: approverSchema,
|
|
266
|
+
approverTwoData: approverSchema,
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
/* ------------------------------------------------ */
|
|
270
|
+
/* Member Schema */
|
|
271
|
+
/* ------------------------------------------------ */
|
|
272
|
+
|
|
273
|
+
const memberSchema = new Schema<MemberDocument>({
|
|
274
|
+
memberId: { type: Number },
|
|
275
|
+
memberCode: { type: String, default: "" },
|
|
276
|
+
memberName: { type: String },
|
|
277
|
+
isMemberOfMasterBranch: { type: Boolean, default: false },
|
|
278
|
+
pureStaticMemberLevelFieldValues: [
|
|
279
|
+
{
|
|
280
|
+
fieldId: {
|
|
281
|
+
type: Schema.Types.ObjectId,
|
|
282
|
+
ref: "Editor.Fields.Master",
|
|
283
|
+
},
|
|
284
|
+
value: { type: String },
|
|
285
|
+
},
|
|
286
|
+
],
|
|
287
|
+
|
|
288
|
+
isCreatedInSAP: { type: Boolean, default: false },
|
|
289
|
+
isMemberSyncedWithSAP: { type: Boolean, default: false },
|
|
290
|
+
memberSyncedOn: { type: Date },
|
|
291
|
+
isActive: { type: Boolean },
|
|
292
|
+
memberAssociation: [memberAssociationSchema],
|
|
293
|
+
audit: [
|
|
294
|
+
{
|
|
295
|
+
userId: { type: String },
|
|
296
|
+
auditedOn: { type: Date },
|
|
297
|
+
actionType: { type: String },
|
|
298
|
+
},
|
|
299
|
+
],
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
const mongoMember = mongoose.model<MemberDocument>("Members", memberSchema);
|
|
303
|
+
|
|
304
|
+
export { mongoMember };
|
package/package.json
CHANGED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
//Editor.PureStaticFieldsMapping.ts
|
|
2
|
-
|
|
3
|
-
import mongoose, { Document, ObjectId, Schema, Types } from "mongoose";
|
|
4
|
-
import { Audit } from "../interface/Audit.interface";
|
|
5
|
-
|
|
6
|
-
interface PureStaticFieldsCategoryMapping extends Document {
|
|
7
|
-
categoryId: mongoose.Types.ObjectId;
|
|
8
|
-
fieldId: mongoose.Types.ObjectId;
|
|
9
|
-
isSystemDefined: boolean;
|
|
10
|
-
isActive: boolean;
|
|
11
|
-
audit: Audit[];
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const pureStaticFieldMappingSchema =
|
|
15
|
-
new Schema<PureStaticFieldsCategoryMapping>({
|
|
16
|
-
categoryId: { type: Schema.Types.ObjectId, ref: "Field.Categories" },
|
|
17
|
-
fieldId: { type: Schema.Types.ObjectId, ref: "Editor.Fields.Master" },
|
|
18
|
-
isSystemDefined: { type: Boolean, default: false },
|
|
19
|
-
isActive: { type: Boolean, default: true },
|
|
20
|
-
audit: [
|
|
21
|
-
{
|
|
22
|
-
userId: { type: String },
|
|
23
|
-
auditedOn: { type: Date, default: null },
|
|
24
|
-
actionType: { type: String },
|
|
25
|
-
},
|
|
26
|
-
],
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
const mongopureStaticFieldMappingSchema =
|
|
30
|
-
mongoose.model<PureStaticFieldsCategoryMapping>(
|
|
31
|
-
"Editor.PureStatic.Category.Field.Mapping",
|
|
32
|
-
pureStaticFieldMappingSchema,
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
export { PureStaticFieldsCategoryMapping, mongopureStaticFieldMappingSchema };
|