pristine-member-nest-api-database 1.0.62 → 1.0.64

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.
@@ -2,54 +2,7 @@ import mongoose, { Document, Schema } from "mongoose";
2
2
  import { Audit } from "../interface/Audit.interface";
3
3
  import IFile from "../interface/IFile.interface";
4
4
 
5
- type keyExecutivesDetails = {
6
- chairmanName: string;
7
- chairmanEmail: string;
8
- chairmanphone: string;
9
- managingDirectorName: string;
10
- managingDirectorEmail: string;
11
- managingDirectorPhone: string;
12
- ceoName: string;
13
- ceoEmail: string;
14
- ceoPhone: string;
15
- headOfHrName: string;
16
- headofHrEmail: string;
17
- headofHrPhone: string;
18
- headOfMarketingName: string;
19
- headOfMarketingEmail: string;
20
- headOfMarketingPhone: string;
21
- cfoName: string;
22
- cfoEmail: string;
23
- cfoPhone: string;
24
- countryManagerName: string;
25
- countryManagerEmail: string;
26
- countryManagerPhone: string;
27
- };
28
-
29
- type ConglomerateAddress = {
30
- addressLine1: string;
31
- addressLine2: string;
32
- addressLine3: string;
33
- block: string;
34
- city: string;
35
- country: string;
36
- };
37
-
38
- type MemberContactInfo = {
39
- bpShortCode: string;
40
- firstName: string;
41
- lastName: string;
42
- contactTelNo1: string;
43
- contactEmail1: string;
44
- contactDesignation: string;
45
- contactAddress: string;
46
- contactAddress2: String;
47
- city: String;
48
- isSAPSynced: boolean;
49
- lastSyncedOn: Date;
50
- };
51
-
52
- type barcodeBranch = {
5
+ type barcodeBranchMemberhipdetails = {
53
6
  isRegisteredMembership: boolean; //field is used to check whether membership is created on first time registering
54
7
  isMembershipRequested: boolean; //means membership request is waiting for approval
55
8
  membershipType: mongoose.Types.ObjectId;
@@ -72,35 +25,21 @@ type barcodeBranch = {
72
25
  terminationReason: string;
73
26
  };
74
27
 
75
- type MemberAssociation = {
76
- branch: mongoose.Types.ObjectId;
28
+ type noneGs1MembershipDetails = {
77
29
  associationMemberCode: string;
78
30
  membershipStatus: mongoose.Types.ObjectId;
79
31
  membershipType: mongoose.Types.ObjectId;
80
- electedDate: Date;
81
- contactInfo: MemberContactInfo;
82
32
  isTerminated: boolean;
83
33
  terminatedDate: Date;
84
34
  reasonForTermination: string;
85
- barcodeAssociation: barcodeBranch[];
86
- dynamicDetails: JSON;
87
35
  isTerminationRequested: boolean;
88
36
  terminationRequestedDate: Date;
89
37
  terminationRequestedBy: string;
90
38
  terminationRequestRemarks: string;
91
39
  onOfSubscriptionMonths: number;
92
- applicationStatus: string;
93
- reviewedBy: mongoose.Types.ObjectId;
94
- reviewedOn: Date;
95
- isEnrolmentCreatedInSAP: boolean;
96
- isEnrolmentSyncedWithSAP: boolean;
97
- enrolmentSyncedOn: Date;
98
- isActive: boolean;
99
- createdDate: Date;
100
- salesOrderDocEntry: string; // SAP sales order doc entry when creating BP in SAP
101
- salesOrderStatus: string; // SAP sales order status when creating BP in SAP
102
- approveRemarks: string; //application verification approve remarks
103
- rejectRemarks: string; //application verification reject remarks
40
+ isMembershipSynced: boolean;
41
+ SyncOn: Date;
42
+ electedDate: Date;
104
43
  };
105
44
 
106
45
  interface MemberDocument extends Document {
@@ -108,266 +47,253 @@ interface MemberDocument extends Document {
108
47
  memberCode: string;
109
48
  memberName: string;
110
49
  isMemberOfMasterBranch: boolean;
111
- taxIdentificationNo: string;
112
- vatNo: string;
113
- vatAttachment: IFile;
114
- svatNo: string;
115
- svatAttachment: IFile;
116
- brNo: string;
117
- brAttachment: IFile;
118
- nicNo: string;
119
- nicAttachment: IFile;
120
- webSite: string;
121
- generalTelNo: string;
122
- generalEmail: string;
123
- isTaxRegistered: boolean;
124
- conglomerateAddress: ConglomerateAddress;
125
- otherAttachment: IFile;
126
-
127
- typeOfOrganization: mongoose.Types.ObjectId;
128
- natureOfBusiness: mongoose.Types.ObjectId[];
129
- mainProductsOrServices: mongoose.Types.ObjectId[];
130
- countryOfExportsOrImports: string[];
131
- noOfExecutiveEmployees: number;
132
- noOfNoneOfExecutiveEmployees: number;
133
- keyExecutivesDetails: keyExecutivesDetails;
134
50
 
135
- isMemberContactSynced: boolean;
136
- memberContactSyncedOn: Date;
51
+ pureStaticMemberLevelFieldValues: [
52
+ {
53
+ fieldId: mongoose.Types.ObjectId;
54
+ value: string;
55
+ },
56
+ ];
57
+ //Member Level Sync
137
58
  isCreatedInSAP: boolean;
138
59
  isMemberSyncedWithSAP: boolean;
139
60
  memberSyncedOn: Date;
140
61
  isActive: boolean;
141
- memberAssociation: MemberAssociation[];
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
+ ];
142
112
  audit: Audit[];
143
113
  }
144
114
 
145
115
  mongoose.set("strictPopulate", false);
146
116
 
147
- // File schema
117
+ /* ------------------------------------------------ */
118
+ /* File Schema */
119
+ /* ------------------------------------------------ */
120
+
148
121
  const fileSchema = new Schema<IFile>({
149
122
  baseURL: { type: String },
150
123
  fileName: { type: String },
151
124
  fileExtension: { type: String },
152
125
  });
153
126
 
154
- const memberSchema = new Schema<MemberDocument>({
155
- memberId: { type: Number },
156
- memberCode: { type: String, default: "" },
157
- memberName: { type: String },
158
- isMemberOfMasterBranch: { type: Boolean, default: false },
159
- taxIdentificationNo: { type: String },
160
- vatNo: { type: String },
161
- vatAttachment: fileSchema,
162
- svatNo: { type: String },
163
- svatAttachment: fileSchema,
164
- brNo: { type: String, default: "" },
165
- brAttachment: fileSchema,
166
- nicNo: { type: String, default: "" },
167
- nicAttachment: fileSchema,
168
- webSite: { type: String, default: "" },
169
- generalTelNo: { type: String },
170
- generalEmail: { type: String },
171
- isTaxRegistered: { type: Boolean, default: false },
172
- conglomerateAddress: {
173
- addressLine1: { type: String },
174
- addressLine2: { type: String, default: "" },
175
- addressLine3: { type: String, default: "" },
176
- block: { type: String, default: "" },
177
- city: { type: String },
178
- country: { type: String },
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,
179
138
  },
180
- otherAttachment: [fileSchema],
181
- typeOfOrganization: {
139
+ membershipStatus: {
182
140
  type: Schema.Types.ObjectId,
183
- ref: "OrganizationType.Master",
141
+ ref: "Membership.Statuses",
142
+ required: true,
184
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
+ });
185
161
 
186
- natureOfBusiness: {
187
- type: [Schema.Types.ObjectId],
188
- ref: "NatureOfBusiness.Master",
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",
189
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
+ /* ------------------------------------------------ */
190
192
 
191
- mainProductsOrServices: {
192
- type: [Schema.Types.ObjectId],
193
- ref: "Products.ServicesMaster",
193
+ const fieldValueSchema = new Schema({
194
+ fieldId: {
195
+ type: Schema.Types.ObjectId,
196
+ ref: "Editor.Fields.Master",
194
197
  },
195
- countryOfExportsOrImports: { type: [String], default: [] },
196
- noOfExecutiveEmployees: { type: Number, default: 0 },
197
- noOfNoneOfExecutiveEmployees: { type: Number, default: 0 },
198
- keyExecutivesDetails: {
199
- chairmanName: { type: String, default: "" },
200
- chairmanEmail: { type: String, default: "" },
201
- chairmanphone: { type: String, default: "" },
202
- managingDirectorName: { type: String, default: "" },
203
- managingDirectorEmail: { type: String, default: "" },
204
- managingDirectorPhone: { type: String, default: "" },
205
- ceoName: { type: String, default: "" },
206
- ceoEmail: { type: String, default: "" },
207
- ceoPhone: { type: String, default: "" },
208
- headOfHrName: { type: String, default: "" },
209
- headofHrEmail: { type: String, default: "" },
210
- headofHrPhone: { type: String, default: "" },
211
- headOfMarketingName: { type: String, default: "" },
212
- headOfMarketingEmail: { type: String, default: "" },
213
- headOfMarketingPhone: { type: String, default: "" },
214
- cfoName: { type: String, default: "" },
215
- cfoEmail: { type: String, default: "" },
216
- cfoPhone: { type: String, default: "" },
217
- countryManagerName: { type: String, default: "" },
218
- countryManagerEmail: { type: String, default: "" },
219
- countryManagerPhone: { type: String, default: "" },
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
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
+ /* ------------------------------------------------ */
221
239
 
222
- isMemberContactSynced: { type: Boolean, default: false },
223
- memberContactSyncedOn: { type: Date, default: null },
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,
224
250
  isCreatedInSAP: { type: Boolean, default: false },
225
251
  isMemberSyncedWithSAP: { type: Boolean, default: false },
226
- memberSyncedOn: { type: Date, default: null },
227
- isActive: { type: Boolean },
228
- memberAssociation: [
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: [
229
279
  {
230
- branch: {
231
- type: Schema.Types.ObjectId,
232
- ref: "Branches", // Reference to the 'Branches' model
233
- },
234
- associationMemberCode: { type: String, default: "" },
235
- membershipStatus: {
236
- type: Schema.Types.ObjectId,
237
- ref: "Membership.Statuses", // Reference to the 'Membership.Statuses' model
238
- },
239
- membershipType: {
240
- type: Schema.Types.ObjectId,
241
- ref: "Membership.Types", // Reference to the 'Membership.Types' model
242
- },
243
- electedDate: { type: Date, default: null },
244
- contactInfo: {
245
- bpShortCode: { type: String, default: "" },
246
- firstName: { type: String },
247
- lastName: { type: String },
248
- contactTelNo1: { type: String },
249
- contactEmail1: { type: String },
250
- contactDesignation: { type: String },
251
- contactAddress: { type: String },
252
- contactAddress2: { type: String },
253
- city: { type: String },
254
- isSAPSynced: { type: Boolean, default: false },
255
- lastSyncedOn: { type: Date, default: null },
256
- },
257
- isTerminated: { type: Boolean, default: false },
258
- terminatedDate: { type: Date, default: null },
259
- reasonForTermination: { type: String, default: "" },
260
- barcodeAssociation: {
261
- type: [
262
- {
263
- isRegisteredMembership: {
264
- type: Boolean,
265
- required: true,
266
- },
267
- isMembershipRequested: {
268
- type: Boolean,
269
- default: true,
270
- },
271
- membershipType: {
272
- type: mongoose.Types.ObjectId,
273
- ref: "Membership.Types",
274
- required: true,
275
- },
276
- membershipStatus: {
277
- type: mongoose.Types.ObjectId,
278
- ref: "Membership.Statuses",
279
- required: true,
280
- },
281
- remarks: {
282
- type: String,
283
- },
284
- requestedDate: {
285
- type: Date,
286
- default: Date.now,
287
- },
288
- isMembershipSynced: {
289
- type: Boolean,
290
- default: false,
291
- },
292
- noOfSubscriptionMonths: {
293
- type: Number,
294
- },
295
- isIssued: {
296
- type: Boolean,
297
- },
298
- electedDate: {
299
- type: Date,
300
- },
301
- barcodeBranchMemberCode: {
302
- type: String,
303
- },
304
- barCode: {
305
- type: Number,
306
- },
307
- validFrom: {
308
- type: Date,
309
- },
310
- validTo: {
311
- type: Date,
312
- },
313
- countryCode: {
314
- type: Number,
315
- },
316
- changeDate: {
317
- type: Date,
318
- },
319
- isTerminationRequested: {
320
- type: Boolean,
321
- default: false,
322
- },
323
- isTerminationSynced: {
324
- type: Boolean,
325
- default: false,
326
- },
327
- terminationRequestedDate: {
328
- type: Date,
329
- },
330
- terminationDate: {
331
- type: Date,
332
- },
333
- terminationReason: {
334
- type: String,
335
- },
336
- },
337
- ],
338
- },
339
- dynamicDetails: { type: JSON, default: null },
340
- isTerminationRequested: { type: Boolean, default: false },
341
- terminationRequestedDate: { type: Date, default: null },
342
- terminationRequestedBy: { type: String, default: "" },
343
- terminationRequestRemarks: { type: String, default: "" },
344
- onOfSubscriptionMonths: { type: Number, default: 0 },
345
- applicationStatus: { type: String, default: "PENDING" },
346
- reviewedBy: {
280
+ fieldId: {
347
281
  type: Schema.Types.ObjectId,
348
- ref: "Users", // Reference to the 'Users' model
349
- default: null,
282
+ ref: "Editor.Fields.Master",
350
283
  },
351
- reviewedOn: { type: Date, default: null },
352
- isEnrolmentCreatedInSAP: { type: Boolean, default: false },
353
- isEnrolmentSyncedWithSAP: { type: Boolean, default: false },
354
- enrolmentSyncedOn: { type: Date, default: null },
355
- isActive: { type: Boolean, default: true },
356
- createdDate: {
357
- type: Schema.Types.Date,
358
- required: false,
359
- default: Date.now,
360
- },
361
- salesOrderDocEntry: { type: String, default: "" },
362
- salesOrderStatus: { type: String, default: "" },
363
- approveRemarks: { type: String, default: "" },
364
- rejectRemarks: { type: String, default: "" },
284
+ value: { type: String },
365
285
  },
366
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],
367
293
  audit: [
368
294
  {
369
295
  userId: { type: String },
370
- auditedOn: { type: Date, default: null },
296
+ auditedOn: { type: Date },
371
297
  actionType: { type: String },
372
298
  },
373
299
  ],
@@ -375,10 +301,4 @@ const memberSchema = new Schema<MemberDocument>({
375
301
 
376
302
  const mongoMember = mongoose.model<MemberDocument>("Members", memberSchema);
377
303
 
378
- export {
379
- ConglomerateAddress,
380
- MemberAssociation,
381
- MemberContactInfo,
382
- MemberDocument,
383
- mongoMember,
384
- };
304
+ export { mongoMember };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pristine-member-nest-api-database",
3
- "version": "1.0.62",
3
+ "version": "1.0.64",
4
4
  "description": "application verification database changes with gs1 branch. not tested. ",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -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 };