pristine-member-nest-api-database 1.0.1

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.
Files changed (54) hide show
  1. package/Database.code-workspace +7 -0
  2. package/README.md +20 -0
  3. package/dist/index.js +39 -0
  4. package/dist/interface/Audit.interface.js +2 -0
  5. package/dist/models/AccessLog.model.js +40 -0
  6. package/dist/models/Appliance.ir.model.js +39 -0
  7. package/dist/models/BankTransfer.model.js +52 -0
  8. package/dist/models/BarcodeCategory.model.js +39 -0
  9. package/dist/models/Branch.model.js +54 -0
  10. package/dist/models/BranchType.model.js +39 -0
  11. package/dist/models/Counter.model.js +33 -0
  12. package/dist/models/Country.model.js +39 -0
  13. package/dist/models/FieldCategory.model.js +40 -0
  14. package/dist/models/Item.ir.model.js +43 -0
  15. package/dist/models/ItemGroup.ir.model.js +39 -0
  16. package/dist/models/ItemRequest.ir.model.js +88 -0
  17. package/dist/models/MeetingRoom.ir.model.js +39 -0
  18. package/dist/models/Member.model.js +136 -0
  19. package/dist/models/MembershipStatus.model.js +39 -0
  20. package/dist/models/MembershipType.model.js +39 -0
  21. package/dist/models/SeatingArrangement.ir.model.js +39 -0
  22. package/dist/models/ServiceRequest.ir.model.js +129 -0
  23. package/dist/models/User.model.js +67 -0
  24. package/dist/models/UserRole.model.js +33 -0
  25. package/dist/models/VehicleCategory.ir.model.js +39 -0
  26. package/dist/models/payment.model.js +69 -0
  27. package/dist/src/dbConnect.js +11 -0
  28. package/index.ts +23 -0
  29. package/interface/Audit.interface.ts +5 -0
  30. package/models/AccessLog.model.ts +26 -0
  31. package/models/Appliance.ir.model.ts +24 -0
  32. package/models/BankTransfer.model.ts +42 -0
  33. package/models/BarcodeCategory.model.ts +24 -0
  34. package/models/Branch.model.ts +48 -0
  35. package/models/BranchType.model.ts +24 -0
  36. package/models/Counter.model.ts +15 -0
  37. package/models/Country.model.ts +24 -0
  38. package/models/FieldCategory.model.ts +26 -0
  39. package/models/Item.ir.model.ts +29 -0
  40. package/models/ItemGroup.ir.model.ts +24 -0
  41. package/models/ItemRequest.ir.model.ts +100 -0
  42. package/models/MeetingRoom.ir.model.ts +24 -0
  43. package/models/Member.model.ts +201 -0
  44. package/models/MembershipStatus.model.ts +24 -0
  45. package/models/MembershipType.model.ts +24 -0
  46. package/models/SeatingArrangement.ir.model.ts +24 -0
  47. package/models/ServiceRequest.ir.model.ts +167 -0
  48. package/models/User.model.ts +71 -0
  49. package/models/UserRole.model.ts +15 -0
  50. package/models/VehicleCategory.ir.model.ts +24 -0
  51. package/models/payment.model.ts +84 -0
  52. package/package.json +19 -0
  53. package/src/dbConnect.ts +6 -0
  54. package/tsconfig.json +109 -0
@@ -0,0 +1,5 @@
1
+ export interface Audit {
2
+ userId: string;
3
+ auditedOn: Date;
4
+ actionType: string;
5
+ }
@@ -0,0 +1,26 @@
1
+ import mongoose, { Document, Schema } from 'mongoose';
2
+
3
+ interface AccessLogDocument extends Document {
4
+ user: mongoose.Types.ObjectId;
5
+ log:[{
6
+ logDate: Date,
7
+ mobileNo: string,
8
+ accessedUserName: string
9
+ }];
10
+ }
11
+
12
+ const accessLogSchema = new Schema<AccessLogDocument>({
13
+ user: {
14
+ type: Schema.Types.ObjectId,
15
+ ref: 'Users', // Reference to the 'Users' model
16
+ },
17
+ log:[{
18
+ logDate: {type: Date, default:Date.now()},
19
+ mobileNo: {type: String},
20
+ accessedUserName: {type: String}
21
+ }]
22
+ });
23
+
24
+ const mongoAccessLog = mongoose.model<AccessLogDocument>('Access.Logs', accessLogSchema);
25
+
26
+ export { AccessLogDocument, mongoAccessLog };
@@ -0,0 +1,24 @@
1
+ import mongoose, { Document, Schema } from 'mongoose';
2
+ import { Audit } from '../interface/Audit.interface';
3
+
4
+ interface ApplianceDocument extends Document {
5
+ applianceCode: string;
6
+ applianceName: string;
7
+ isActive: boolean;
8
+ audit: Audit[];
9
+ }
10
+
11
+ const applianceSchema = new Schema<ApplianceDocument>({
12
+ applianceCode: { type: String },
13
+ applianceName: { 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 mongoAppliance = mongoose.model<ApplianceDocument>('ir.Appliances', applianceSchema);
23
+
24
+ export { ApplianceDocument, mongoAppliance };
@@ -0,0 +1,42 @@
1
+ import mongoose, { Document, Schema } from 'mongoose';
2
+ import { Audit } from '../interface/Audit.interface';
3
+
4
+ interface BankTransferDocument extends Document {
5
+ transferId: number;
6
+ member: mongoose.Types.ObjectId;
7
+ branch: mongoose.Types.ObjectId;
8
+ datePaid: Date;
9
+ slipImageLocation: string;
10
+ remarks: string;
11
+ dateEntered: Date;
12
+ audit: Audit[];
13
+ }
14
+
15
+ mongoose.set('strictPopulate', false);
16
+
17
+ const bankTransferSchema = new Schema<BankTransferDocument>({
18
+ transferId: { type: Number },
19
+ member: {
20
+ type: Schema.Types.ObjectId,
21
+ ref: 'Members' //Reference to the 'Members' model
22
+ },
23
+ branch: {
24
+ type: Schema.Types.ObjectId,
25
+ ref: 'Branches' // Reference to the 'Branches' model
26
+ },
27
+ datePaid: { type: Date, default:Date.now() },
28
+ slipImageLocation: { type: String },
29
+ remarks: { type: String },
30
+ dateEntered: { type: Date, default:Date.now() },
31
+ audit: [
32
+ {
33
+ userId: { type: String },
34
+ auditedOn: { type: Date, default: null },
35
+ actionType: { type: String }
36
+ }
37
+ ]
38
+ });
39
+
40
+ const mongoBankTransfer = mongoose.model<BankTransferDocument>('Bank.Transfers', bankTransferSchema);
41
+
42
+ export { BankTransferDocument, mongoBankTransfer };
@@ -0,0 +1,24 @@
1
+ import mongoose, { Document, Schema } from 'mongoose';
2
+ import { Audit } from '../interface/Audit.interface';
3
+
4
+ interface BarcodeCategoryDocument extends Document {
5
+ barcodeCategoryCode: string;
6
+ barcodeCategoryName: string;
7
+ isActive: boolean;
8
+ audit: Audit[];
9
+ }
10
+
11
+ const barcodeCategorySchema = new Schema<BarcodeCategoryDocument>({
12
+ barcodeCategoryCode: { type: String },
13
+ barcodeCategoryName: { type: String },
14
+ isActive: { type: Boolean, default: true },
15
+ audit: [{
16
+ userId: { type: String },
17
+ auditedOn: { type: Date, default: Date.now() },
18
+ actionType: { type: String }
19
+ }]
20
+ });
21
+
22
+ const mongoBarcodeCategory = mongoose.model<BarcodeCategoryDocument>('Barcode.Categories', barcodeCategorySchema);
23
+
24
+ export { BarcodeCategoryDocument, mongoBarcodeCategory };
@@ -0,0 +1,48 @@
1
+ import mongoose, { Document, Schema } from 'mongoose';
2
+ import { Audit } from '../interface/Audit.interface';
3
+
4
+ interface BranchDocument extends Document {
5
+ branchCode: string;
6
+ branchName: string;
7
+ branchShortCode: string;
8
+ branchType: mongoose.Types.ObjectId;
9
+ membershipTypes: [{
10
+ membershipType: mongoose.Types.ObjectId;
11
+ }],
12
+ logoFileLocation: string;
13
+ isPaymentGatewayEnabled:boolean;
14
+ isBarcodeEnabled: boolean;
15
+ isActive: boolean;
16
+ audit: Audit[];
17
+ }
18
+
19
+ mongoose.set('strictPopulate', false);
20
+
21
+ const branchSchema = new Schema<BranchDocument>({
22
+ branchCode: { type: String },
23
+ branchName: { type: String },
24
+ branchShortCode: { type: String },
25
+ branchType: {
26
+ type: Schema.Types.ObjectId,
27
+ ref: 'Branch.Types', // Reference to the 'BranchTypes' model
28
+ },
29
+ membershipTypes: [{
30
+ membershipType: {
31
+ type: Schema.Types.ObjectId,
32
+ ref: 'Membership.Types', // Reference to the 'BranchTypes' model
33
+ }
34
+ }],
35
+ isPaymentGatewayEnabled: { type:Boolean, default:true },
36
+ logoFileLocation: { type: String, default: ""},
37
+ isBarcodeEnabled: { type: Boolean, default: false },
38
+ isActive: { type: Boolean, default: true },
39
+ audit: [{
40
+ userId: { type: String },
41
+ auditedOn: { type: Date, default: null },
42
+ actionType: { type: String }
43
+ }]
44
+ });
45
+
46
+ const mongoBranch = mongoose.model<BranchDocument>('Branches', branchSchema);
47
+
48
+ export { BranchDocument, mongoBranch };
@@ -0,0 +1,24 @@
1
+ import mongoose, { Document, Schema } from 'mongoose';
2
+ import { Audit } from '../interface/Audit.interface';
3
+
4
+ interface BranchTypeDocument extends Document {
5
+ branchTypeCode: string;
6
+ branchTypeName: string;
7
+ isActive: boolean;
8
+ audit: [Audit];
9
+ }
10
+
11
+ const branchTypeSchema = new Schema<BranchTypeDocument>({
12
+ branchTypeCode: { type: String },
13
+ branchTypeName: { type: String },
14
+ isActive: { type: Boolean, default: true },
15
+ audit: [{
16
+ userId: { type: String },
17
+ auditedOn: { type: Date, default: Date.now() },
18
+ actionType: { type: String }
19
+ }]
20
+ });
21
+
22
+ const mongoBranchType = mongoose.model<BranchTypeDocument>('Branch.Types', branchTypeSchema);
23
+
24
+ export { BranchTypeDocument, mongoBranchType };
@@ -0,0 +1,15 @@
1
+ import mongoose, { Document, Schema } from 'mongoose';
2
+
3
+ interface CounterDocument extends Document {
4
+ counterId: string;
5
+ seq: number;
6
+ }
7
+
8
+ const counterSchema = new Schema<CounterDocument>({
9
+ counterId: { type: String },
10
+ seq: { type: Number }
11
+ });
12
+
13
+ const mongoCounter = mongoose.model<CounterDocument>('Counters', counterSchema);
14
+
15
+ export { CounterDocument, mongoCounter };
@@ -0,0 +1,24 @@
1
+ import mongoose, { Document, Schema } from 'mongoose';
2
+ import { Audit } from '../interface/Audit.interface';
3
+
4
+ interface CountryDocument extends Document {
5
+ countryCode: string;
6
+ countryName: string;
7
+ isActive: boolean;
8
+ audit: [Audit];
9
+ }
10
+
11
+ const countrySchema = new Schema<CountryDocument>({
12
+ countryCode: { type: String },
13
+ countryName: { type: String },
14
+ isActive: { type: Boolean, default: true },
15
+ audit: [{
16
+ userId: { type: String },
17
+ auditedOn: { type: Date, default: Date.now() },
18
+ actionType: { type: String }
19
+ }]
20
+ });
21
+
22
+ const mongoCountry = mongoose.model<CountryDocument>('Countries', countrySchema);
23
+
24
+ export { CountryDocument, mongoCountry };
@@ -0,0 +1,26 @@
1
+ import mongoose, { Document, Schema } from 'mongoose';
2
+ import { Audit } from '../interface/Audit.interface';
3
+
4
+ interface FieldCategoryDocument extends Document {
5
+ fieldCategoryCode: string;
6
+ fieldCategoryName: string;
7
+ fieldCategorySequence: number;
8
+ isActive: boolean;
9
+ audit: Audit[];
10
+ }
11
+
12
+ const fieldCategorySchema = new Schema<FieldCategoryDocument>({
13
+ fieldCategoryCode: { type: String },
14
+ fieldCategoryName: { type: String },
15
+ fieldCategorySequence: { type: Number },
16
+ isActive: { type: Boolean, default: true },
17
+ audit: [{
18
+ userId: { type: String },
19
+ auditedOn: { type: Date, default: null },
20
+ actionType: { type: String }
21
+ }]
22
+ });
23
+
24
+ const mongoFieldCategory = mongoose.model<FieldCategoryDocument>('Field.Categories', fieldCategorySchema);
25
+
26
+ export { FieldCategoryDocument, mongoFieldCategory };
@@ -0,0 +1,29 @@
1
+ import mongoose, { Document, Schema } from 'mongoose';
2
+ import { Audit } from '../interface/Audit.interface';
3
+
4
+ interface ItemDocument extends Document {
5
+ itemCode: string;
6
+ itemName: string;
7
+ itemGroup: mongoose.Types.ObjectId;
8
+ isActive: boolean;
9
+ audit: Audit[];
10
+ }
11
+
12
+ const itemSchema = new Schema<ItemDocument>({
13
+ itemCode: { type: String },
14
+ itemName: { type: String },
15
+ itemGroup: {
16
+ type: Schema.Types.ObjectId,
17
+ ref: 'ir.Item.Groups', // Reference to the 'ir.Item.Group' model
18
+ },
19
+ isActive: { type: Boolean, default: true },
20
+ audit: [{
21
+ userId: { type: String },
22
+ auditedOn: { type: Date, default: null },
23
+ actionType: { type: String }
24
+ }]
25
+ });
26
+
27
+ const mongoItem = mongoose.model<ItemDocument>('ir.Items', itemSchema);
28
+
29
+ export { ItemDocument, mongoItem };
@@ -0,0 +1,24 @@
1
+ import mongoose, { Document, Schema } from 'mongoose';
2
+ import { Audit } from '../interface/Audit.interface';
3
+
4
+ interface ItemGroupDocument extends Document {
5
+ itemGroupCode: string;
6
+ itemGroupName: string;
7
+ isActive: boolean;
8
+ audit: Audit[];
9
+ }
10
+
11
+ const itemGroupSchema = new Schema<ItemGroupDocument>({
12
+ itemGroupCode: { type: String },
13
+ itemGroupName: { 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 mongoItemGroup = mongoose.model<ItemGroupDocument>('ir.Item.Groups', itemGroupSchema);
23
+
24
+ export { ItemGroupDocument, mongoItemGroup };
@@ -0,0 +1,100 @@
1
+ import mongoose, { Document, Schema, now } from 'mongoose';
2
+ import { Audit } from '../interface/Audit.interface';
3
+
4
+ type itemInfo = {
5
+ item: mongoose.Types.ObjectId;
6
+ quantity: number;
7
+ remarks: string;
8
+ }
9
+
10
+
11
+ interface ItemRequestDocument extends Document {
12
+ requisitionId: number;
13
+ requestedBranch: mongoose.Types.ObjectId;
14
+ requestedFromBranch: mongoose.Types.ObjectId;
15
+ documentDate: Date;
16
+ dateRequired: Date;
17
+ projectCode: string;
18
+ referenceDocument: string;
19
+ requestStatus: string; //Pending, Approved - Level 1, Approved, Confirmed, Rejected
20
+ statusDate: Date;
21
+ requestedBy: mongoose.Types.ObjectId;
22
+ requestedOn: Date;
23
+ level1ApprovalUserRole: string;
24
+ level1ApprovedBy: mongoose.Types.ObjectId;
25
+ level1ApprovedOn: Date;
26
+ level1ActionRemarks: string;
27
+ confirmedBy: mongoose.Types.ObjectId;
28
+ confirmedOn: Date;
29
+ confirmationRemarks: string,
30
+ rejectedBy: mongoose.Types.ObjectId;
31
+ rejectedOn: Date;
32
+ rejectedRemarks: string;
33
+ items: itemInfo[];
34
+ isSAPSynced: boolean;
35
+ dateSAPSynced: Date;
36
+ audit: Audit[];
37
+ }
38
+
39
+ const itemRequestSchema = new Schema<ItemRequestDocument>({
40
+ requisitionId: { type: Number },
41
+ requestedBranch: {
42
+ type: Schema.Types.ObjectId,
43
+ ref: 'Branches', // Reference to the 'Branches' model
44
+ },
45
+ requestedFromBranch: {
46
+ type: Schema.Types.ObjectId,
47
+ ref: 'Branches', // Reference to the 'Branches' model
48
+ },
49
+ documentDate: {type: Date, default: now()},
50
+ dateRequired: {type: Date},
51
+ projectCode: {type: String},
52
+ referenceDocument: { type: String},
53
+ requestStatus: {type: String, default: "Pending"},
54
+ statusDate: {type: Date, default: now()},
55
+ requestedBy: {
56
+ type: Schema.Types.ObjectId,
57
+ ref: 'Users',
58
+ default: null
59
+ },
60
+ requestedOn: { type: Date, default: now()} ,
61
+ level1ApprovalUserRole: { type: String, default: ""},
62
+ level1ApprovedBy: {
63
+ type: Schema.Types.ObjectId,
64
+ ref: 'Users',
65
+ default: null
66
+ },
67
+ level1ApprovedOn: { type: Date, default: null},
68
+ level1ActionRemarks: { type: String, default: ""},
69
+ confirmedBy: {
70
+ type: Schema.Types.ObjectId,
71
+ ref: 'Users',
72
+ default: null
73
+ },
74
+ confirmedOn: { type: Date, default: null},
75
+ confirmationRemarks: { type: String, default: ""},
76
+ rejectedBy: {
77
+ type: Schema.Types.ObjectId,
78
+ ref: 'Users'
79
+ },
80
+ rejectedOn: { type: Date, default: null},
81
+ rejectedRemarks: { type: String, default: ""},
82
+ items: [{
83
+ item: {
84
+ type: Schema.Types.ObjectId,
85
+ ref: 'ir.Items', // Reference to the 'Branches' model
86
+ },
87
+ quantity: {type: Number},
88
+ remarks: {type: String}
89
+ }],
90
+ isSAPSynced: { type: Boolean, default: false },
91
+ dateSAPSynced: { type: Date, default: null },
92
+ audit: [{
93
+ userId: { type: String },
94
+ auditedOn: { type: Date, default: null },
95
+ actionType: { type: String }
96
+ }]
97
+ });
98
+
99
+ const mongoItemRequest = mongoose.model<ItemRequestDocument>('ir.Item.Requests', itemRequestSchema);
100
+ export { ItemRequestDocument, mongoItemRequest };
@@ -0,0 +1,24 @@
1
+ import mongoose, { Document, Schema } from 'mongoose';
2
+ import { Audit } from '../interface/Audit.interface';
3
+
4
+ interface MeetingRoomDocument extends Document {
5
+ meetingRoomCode: string;
6
+ meetingRoomName: string;
7
+ isActive: boolean;
8
+ audit: Audit[];
9
+ }
10
+
11
+ const meetingRoomSchema = new Schema<MeetingRoomDocument>({
12
+ meetingRoomCode: { type: String },
13
+ meetingRoomName: { 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 mongoMeetingRoom = mongoose.model<MeetingRoomDocument>('ir.Meeting.Rooms', meetingRoomSchema);
23
+
24
+ export { MeetingRoomDocument, mongoMeetingRoom };
@@ -0,0 +1,201 @@
1
+ import mongoose, { Document, Schema } from 'mongoose';
2
+ import { Audit } from '../interface/Audit.interface';
3
+
4
+ type ConglomerateAddress = {
5
+ addressLine1: string;
6
+ addressLine2: string;
7
+ addressLine3: string;
8
+ block: string;
9
+ city: string;
10
+ country: string;
11
+ }
12
+
13
+ type MemberContactInfo = {
14
+ bpShortCode: string;
15
+ firstName: string;
16
+ lastName: string;
17
+ contactTelNo1: string;
18
+ contactEmail1: string;
19
+ contactDesignation: string;
20
+ contactAddress: string;
21
+ isSAPSynced: boolean;
22
+ lastSyncedOn: Date;
23
+ }
24
+
25
+ type barcodeBranch = {
26
+ barcodeBranchMemberCode: string;
27
+ barcodeCategoryCode: string;
28
+ issueDate: Date;
29
+ isIssued: boolean;
30
+ countryCodeCode: string;
31
+ barCode: string;
32
+ changeDate: Date;
33
+ validFrom: Date;
34
+ validTo: Date;
35
+ registeredDate: Date;
36
+ remarks: string
37
+ }
38
+
39
+ type MemberAssociation = {
40
+ branch: mongoose.Types.ObjectId;
41
+ associationMemberCode: string;
42
+ membershipStatus: mongoose.Types.ObjectId;
43
+ membershipType: mongoose.Types.ObjectId;
44
+ electedDate: Date;
45
+ contactInfo: MemberContactInfo;
46
+ isTerminated: boolean;
47
+ terminatedDate: Date;
48
+ reasonForTermination: string;
49
+ barcodeAssociation: barcodeBranch[];
50
+ dynamicDetails: JSON;
51
+ isTerminationRequested: boolean;
52
+ terminationRequestedDate: Date;
53
+ terminationRequestedBy: string;
54
+ terminationRequestRemarks: string;
55
+ onOfSubscriptionMonths:number;
56
+ applicationStatus: string;
57
+ reviewedBy: mongoose.Types.ObjectId;
58
+ reviewedOn: Date;
59
+ isEnrolmentCreatedInSAP: boolean;
60
+ isEnrolmentSyncedWithSAP: boolean;
61
+ enrolmentSyncedOn: Date;
62
+ isActive: boolean;
63
+ }
64
+
65
+ interface MemberDocument extends Document {
66
+ memberId: number;
67
+ memberCode: string;
68
+ memberName: string;
69
+ isMemberOfMasterBranch: boolean;
70
+ taxIdentificationNo: string;
71
+ vatNo: string;
72
+ svatNo: string;
73
+ brNo: string;
74
+ nicNo: string;
75
+ webSite: string;
76
+ generalTelNo: string;
77
+ generalEmail: string;
78
+ isTaxRegistered: boolean;
79
+ conglomerateAddress: ConglomerateAddress,
80
+ isMemberContactSynced: boolean,
81
+ memberContactSyncedOn: Date,
82
+ isCreatedInSAP: boolean,
83
+ isMemberSyncedWithSAP: boolean,
84
+ memberSyncedOn: Date,
85
+ isActive: boolean,
86
+ memberAssociation: MemberAssociation[],
87
+ audit: Audit[];
88
+ }
89
+
90
+ mongoose.set('strictPopulate', false);
91
+
92
+ const memberSchema = new Schema<MemberDocument>({
93
+ memberId: { type: Number },
94
+ memberCode: { type: String, default: "" },
95
+ memberName: { type: String },
96
+ isMemberOfMasterBranch: { type: Boolean, default: false },
97
+ taxIdentificationNo: { type: String },
98
+ vatNo: { type: String },
99
+ svatNo: { type: String },
100
+ brNo: { type: String, default: "" },
101
+ nicNo: { type: String, default: "" },
102
+ webSite: { type: String, default: "" },
103
+ generalTelNo: { type: String },
104
+ generalEmail: { type: String },
105
+ isTaxRegistered: { type: Boolean, default: false },
106
+ conglomerateAddress: {
107
+ addressLine1: { type: String },
108
+ addressLine2: { type: String, default: "" },
109
+ addressLine3: { type: String, default: "" },
110
+ block: { type: String, default: "" },
111
+ city: { type: String },
112
+ country: { type: String }
113
+ },
114
+ isMemberContactSynced: {type: Boolean, default: false},
115
+ memberContactSyncedOn: {type: Date, default: null},
116
+ isCreatedInSAP: { type: Boolean, default: false },
117
+ isMemberSyncedWithSAP: {type: Boolean, default: false},
118
+ memberSyncedOn: { type: Date, default: null },
119
+ isActive: { type: Boolean },
120
+ memberAssociation: [
121
+ {
122
+ branch: {
123
+ type: Schema.Types.ObjectId,
124
+ ref: 'Branches', // Reference to the 'Branches' model
125
+ },
126
+ associationMemberCode: { type: String, default: "" },
127
+ membershipStatus: {
128
+ type: Schema.Types.ObjectId,
129
+ ref: 'Membership.Statuses', // Reference to the 'Membership.Statuses' model
130
+ },
131
+ membershipType: {
132
+ type: Schema.Types.ObjectId,
133
+ ref: 'Membership.Types', // Reference to the 'Membership.Types' model
134
+ },
135
+ electedDate: { type: Date, default: null},
136
+ contactInfo:{
137
+ bpShortCode: { type: String, default: "" },
138
+ firstName: { type: String },
139
+ lastName: { type: String },
140
+ contactTelNo1: { type: String },
141
+ contactEmail1: { type: String },
142
+ contactDesignation: { type: String },
143
+ contactAddress: { type: String },
144
+ isSAPSynced: { type: Boolean, default: false },
145
+ lastSyncedOn: { type: Date, default: null }
146
+ },
147
+ isTerminated: { type: Boolean, default: false },
148
+ terminatedDate: { type: Date, default: null },
149
+ reasonForTermination: { type: String, default: "" },
150
+ barcodeAssociation: [
151
+ {
152
+ barcodeBranchMemberCode: {type: String, default: "" },
153
+ barcodeCategory: {
154
+ type: Schema.Types.ObjectId,
155
+ ref: 'Barcode.Categories',
156
+ },
157
+ issueDate: { type: Date, default: null },
158
+ isIssued: { type: Boolean, default: true },
159
+ country: {
160
+ type: Schema.Types.ObjectId,
161
+ ref: 'Countries',
162
+ },
163
+ barCode: { type: String, default: "" },
164
+ changeDate: { type: Date, default: null },
165
+ validFrom: { type: Date, default: null },
166
+ validTo: { type: Date, default: null },
167
+ registeredDate: { type: Date, default: null },
168
+ remarks: { type: String, default: "" }
169
+ }
170
+ ],
171
+ dynamicDetails: {type: JSON, default: null},
172
+ isTerminationRequested: {type: Boolean, default: false},
173
+ terminationRequestedDate: {type: Date, default: null},
174
+ terminationRequestedBy: {type: String, default: ""},
175
+ terminationRequestRemarks: {type: String, default: ""},
176
+ onOfSubscriptionMonths:{type: Number, default: 0},
177
+ applicationStatus: {type: String, default: "PENDING"},
178
+ reviewedBy: {
179
+ type: Schema.Types.ObjectId,
180
+ ref: 'Users', // Reference to the 'Users' model
181
+ default: null
182
+ },
183
+ reviewedOn: {type: Date, default: null},
184
+ isEnrolmentCreatedInSAP: { type: Boolean, default: false},
185
+ isEnrolmentSyncedWithSAP: { type: Boolean, default: false },
186
+ enrolmentSyncedOn: { type: Date, default: null },
187
+ isActive: { type: Boolean, default: true}
188
+ }
189
+ ],
190
+ audit: [
191
+ {
192
+ userId: { type: String },
193
+ auditedOn: { type: Date, default: null },
194
+ actionType: { type: String }
195
+ }
196
+ ]
197
+ });
198
+
199
+ const mongoMember = mongoose.model<MemberDocument>('Members', memberSchema);
200
+
201
+ export { MemberDocument, ConglomerateAddress, MemberContactInfo, MemberAssociation, mongoMember };
@@ -0,0 +1,24 @@
1
+ import mongoose, { Document, Schema } from 'mongoose';
2
+ import { Audit } from '../interface/Audit.interface';
3
+
4
+ interface MembershipStatusDocument extends Document {
5
+ membershipStatusCode: string;
6
+ membershipStatusName: string;
7
+ isActive: boolean;
8
+ audit: Audit[];
9
+ }
10
+
11
+ const membershipStatusSchema = new Schema<MembershipStatusDocument>({
12
+ membershipStatusCode: { type: String },
13
+ membershipStatusName: { type: String },
14
+ isActive: { type: Boolean, default: true },
15
+ audit: [{
16
+ userId: { type: String },
17
+ auditedOn: { type: Date, default: Date.now() },
18
+ actionType: { type: String }
19
+ }]
20
+ });
21
+
22
+ const mongoMembershipStatus = mongoose.model<MembershipStatusDocument>('Membership.Statuses', membershipStatusSchema);
23
+
24
+ export { MembershipStatusDocument, mongoMembershipStatus };