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.
@@ -0,0 +1,352 @@
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;
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
+ // File schema
118
+ const fileSchema = new Schema<IFile>({
119
+ baseURL: { type: String },
120
+ fileName: { type: String },
121
+ fileExtension: { type: String },
122
+ });
123
+
124
+ // const memberSchema = new Schema<MemberDocument>({
125
+ // memberId: { type: Number },
126
+ // memberCode: { type: String, default: "" },
127
+ // memberName: { type: String },
128
+ // isMemberOfMasterBranch: { type: Boolean, default: false },
129
+ // taxIdentificationNo: { type: String },
130
+ // vatNo: { type: String },
131
+ // vatAttachment: fileSchema,
132
+ // svatNo: { type: String },
133
+ // svatAttachment: fileSchema,
134
+ // brNo: { type: String, default: "" },
135
+ // brAttachment: fileSchema,
136
+ // nicNo: { type: String, default: "" },
137
+ // nicAttachment: fileSchema,
138
+ // webSite: { type: String, default: "" },
139
+ // generalTelNo: { type: String },
140
+ // generalEmail: { type: String },
141
+ // isTaxRegistered: { type: Boolean, default: false },
142
+ // conglomerateAddress: {
143
+ // addressLine1: { type: String },
144
+ // addressLine2: { type: String, default: "" },
145
+ // addressLine3: { type: String, default: "" },
146
+ // block: { type: String, default: "" },
147
+ // city: { type: String },
148
+ // country: { type: String },
149
+ // },
150
+ // otherAttachment: [fileSchema],
151
+ // typeOfOrganization: {
152
+ // type: Schema.Types.ObjectId,
153
+ // ref: "OrganizationType.Master",
154
+ // },
155
+
156
+ // natureOfBusiness: {
157
+ // type: [Schema.Types.ObjectId],
158
+ // ref: "NatureOfBusiness.Master",
159
+ // },
160
+
161
+ // mainProductsOrServices: {
162
+ // type: [Schema.Types.ObjectId],
163
+ // ref: "Products.ServicesMaster",
164
+ // },
165
+ // countryOfExportsOrImports: { type: [String], default: [] },
166
+ // noOfExecutiveEmployees: { type: Number, default: 0 },
167
+ // noOfNoneOfExecutiveEmployees: { type: Number, default: 0 },
168
+ // keyExecutivesDetails: {
169
+ // chairmanName: { type: String, default: "" },
170
+ // chairmanEmail: { type: String, default: "" },
171
+ // chairmanphone: { type: String, default: "" },
172
+ // managingDirectorName: { type: String, default: "" },
173
+ // managingDirectorEmail: { type: String, default: "" },
174
+ // managingDirectorPhone: { type: String, default: "" },
175
+ // ceoName: { type: String, default: "" },
176
+ // ceoEmail: { type: String, default: "" },
177
+ // ceoPhone: { type: String, default: "" },
178
+ // headOfHrName: { type: String, default: "" },
179
+ // headofHrEmail: { type: String, default: "" },
180
+ // headofHrPhone: { type: String, default: "" },
181
+ // headOfMarketingName: { type: String, default: "" },
182
+ // headOfMarketingEmail: { type: String, default: "" },
183
+ // headOfMarketingPhone: { type: String, default: "" },
184
+ // cfoName: { type: String, default: "" },
185
+ // cfoEmail: { type: String, default: "" },
186
+ // cfoPhone: { type: String, default: "" },
187
+ // countryManagerName: { type: String, default: "" },
188
+ // countryManagerEmail: { type: String, default: "" },
189
+ // countryManagerPhone: { type: String, default: "" },
190
+ // },
191
+
192
+ // isMemberContactSynced: { type: Boolean, default: false },
193
+ // memberContactSyncedOn: { type: Date, default: null },
194
+ // isCreatedInSAP: { type: Boolean, default: false },
195
+ // isMemberSyncedWithSAP: { type: Boolean, default: false },
196
+ // memberSyncedOn: { type: Date, default: null },
197
+ // isActive: { type: Boolean },
198
+ // memberAssociation: [
199
+ // {
200
+ // branch: {
201
+ // type: Schema.Types.ObjectId,
202
+ // ref: "Branches", // Reference to the 'Branches' model
203
+ // },
204
+ // associationMemberCode: { type: String, default: "" },
205
+ // membershipStatus: {
206
+ // type: Schema.Types.ObjectId,
207
+ // ref: "Membership.Statuses", // Reference to the 'Membership.Statuses' model
208
+ // },
209
+ // membershipType: {
210
+ // type: Schema.Types.ObjectId,
211
+ // ref: "Membership.Types", // Reference to the 'Membership.Types' model
212
+ // },
213
+ // electedDate: { type: Date, default: null },
214
+ // contactInfo: {
215
+ // bpShortCode: { type: String, default: "" },
216
+ // firstName: { type: String },
217
+ // lastName: { type: String },
218
+ // contactTelNo1: { type: String },
219
+ // contactEmail1: { type: String },
220
+ // contactDesignation: { type: String },
221
+ // contactAddress: { type: String },
222
+ // contactAddress2: { type: String },
223
+ // city: { type: String },
224
+ // isSAPSynced: { type: Boolean, default: false },
225
+ // lastSyncedOn: { type: Date, default: null },
226
+ // },
227
+ // isTerminated: { type: Boolean, default: false },
228
+ // terminatedDate: { type: Date, default: null },
229
+ // reasonForTermination: { type: String, default: "" },
230
+ // barcodeAssociation: {
231
+ // type: [
232
+ // {
233
+ // isRegisteredMembership: {
234
+ // type: Boolean,
235
+ // required: true,
236
+ // },
237
+ // isMembershipRequested: {
238
+ // type: Boolean,
239
+ // default: true,
240
+ // },
241
+ // membershipType: {
242
+ // type: mongoose.Types.ObjectId,
243
+ // ref: "Membership.Types",
244
+ // required: true,
245
+ // },
246
+ // membershipStatus: {
247
+ // type: mongoose.Types.ObjectId,
248
+ // ref: "Membership.Statuses",
249
+ // required: true,
250
+ // },
251
+ // remarks: {
252
+ // type: String,
253
+ // },
254
+ // requestedDate: {
255
+ // type: Date,
256
+ // default: Date.now,
257
+ // },
258
+ // isMembershipSynced: {
259
+ // type: Boolean,
260
+ // default: false,
261
+ // },
262
+ // noOfSubscriptionMonths: {
263
+ // type: Number,
264
+ // },
265
+ // isIssued: {
266
+ // type: Boolean,
267
+ // },
268
+ // electedDate: {
269
+ // type: Date,
270
+ // },
271
+ // barcodeBranchMemberCode: {
272
+ // type: String,
273
+ // },
274
+ // barCode: {
275
+ // type: Number,
276
+ // },
277
+ // validFrom: {
278
+ // type: Date,
279
+ // },
280
+ // validTo: {
281
+ // type: Date,
282
+ // },
283
+ // countryCode: {
284
+ // type: Number,
285
+ // },
286
+ // changeDate: {
287
+ // type: Date,
288
+ // },
289
+ // isTerminationRequested: {
290
+ // type: Boolean,
291
+ // default: false,
292
+ // },
293
+ // isTerminationSynced: {
294
+ // type: Boolean,
295
+ // default: false,
296
+ // },
297
+ // terminationRequestedDate: {
298
+ // type: Date,
299
+ // },
300
+ // terminationDate: {
301
+ // type: Date,
302
+ // },
303
+ // terminationReason: {
304
+ // type: String,
305
+ // },
306
+ // },
307
+ // ],
308
+ // },
309
+ // dynamicDetails: { type: JSON, default: null },
310
+ // isTerminationRequested: { type: Boolean, default: false },
311
+ // terminationRequestedDate: { type: Date, default: null },
312
+ // terminationRequestedBy: { type: String, default: "" },
313
+ // terminationRequestRemarks: { type: String, default: "" },
314
+ // onOfSubscriptionMonths: { type: Number, default: 0 },
315
+ // applicationStatus: { type: String, default: "PENDING" },
316
+ // reviewedBy: {
317
+ // type: Schema.Types.ObjectId,
318
+ // ref: "Users", // Reference to the 'Users' model
319
+ // default: null,
320
+ // },
321
+ // reviewedOn: { type: Date, default: null },
322
+ // isEnrolmentCreatedInSAP: { type: Boolean, default: false },
323
+ // isEnrolmentSyncedWithSAP: { type: Boolean, default: false },
324
+ // enrolmentSyncedOn: { type: Date, default: null },
325
+ // isActive: { type: Boolean, default: true },
326
+ // createdDate: {
327
+ // type: Schema.Types.Date,
328
+ // required: false,
329
+ // default: Date.now,
330
+ // },
331
+ // salesOrderDocEntry: { type: String, default: "" },
332
+ // salesOrderStatus: { type: String, default: "" },
333
+ // approveRemarks: { type: String, default: "" },
334
+ // rejectRemarks: { type: String, default: "" },
335
+ // },
336
+ // ],
337
+ // audit: [
338
+ // {
339
+ // userId: { type: String },
340
+ // auditedOn: { type: Date, default: null },
341
+ // actionType: { type: String },
342
+ // },
343
+ // ],
344
+ // });
345
+
346
+ // const mongoMember = mongoose.model<MemberDocument>("Members", memberSchema);
347
+
348
+ export {
349
+
350
+ MemberDocument,
351
+ // mongoMember,
352
+ };