flykup_model_development 2.0.8 → 3.0.0

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/index.js CHANGED
@@ -30,7 +30,9 @@ import RegisterShow from './models/registerShow.model.js';
30
30
  import { Review, ReviewType } from './models/Review.model.js';
31
31
  import ShoppableVideoInteraction from './models/ShoppableInteraction.model.js';
32
32
  import SellerDraft from './models/sellerDraft.model.js';
33
-
33
+ import AadhaarVerification from './models/AadhaarVerification.js';
34
+ import BankVerification from './models/BankVerification.js';
35
+ import GSTVerification from './models/GSTVerification.js';
34
36
  let initialized = false;
35
37
 
36
38
  export async function initializeSharedModels({ token, dbUri }) {
@@ -92,6 +94,9 @@ export const ReviewTypeModel = createModelProxy(ReviewType);
92
94
  export const ReviewModel = createModelProxy(Review);
93
95
  export const ShoppableVideoInteractionModel = createModelProxy(ShoppableVideoInteraction);
94
96
  export const SellerDraftModel = createModelProxy(SellerDraft);
97
+ export const AadhaarVerificationModel = createModelProxy(AadhaarVerification);
98
+ export const BankVerificationModel = createModelProxy(BankVerification);
99
+ export const GSTVerificationModel = createModelProxy(GSTVerification);
95
100
 
96
101
  export {
97
102
  AdminModel as Admin,
@@ -125,5 +130,8 @@ export {
125
130
  ReviewModel as Review,
126
131
  ReviewTypeModel as ReviewType,
127
132
  ShoppableVideoInteractionModel as ShoppableVideoInteraction,
128
- SellerDraftModel as SellerDraft
133
+ SellerDraftModel as SellerDraft,
134
+ AadhaarVerificationModel as AadhaarVerification,
135
+ BankVerificationModel as BankVerification,
136
+ GSTVerificationModel as GSTVerification
129
137
  };
@@ -0,0 +1,131 @@
1
+ // models/AadhaarVerification.js
2
+ import mongoose from 'mongoose';
3
+
4
+ const aadhaarVerificationSchema = new mongoose.Schema({
5
+ // User reference - Required field
6
+ userId: {
7
+ type: mongoose.Schema.Types.ObjectId,
8
+ ref: 'users',
9
+ required: true,
10
+ index: true
11
+ },
12
+
13
+ // Aadhaar number - Store when sending OTP
14
+ aadhaarNumber: {
15
+ type: String,
16
+ required: true,
17
+ index: true
18
+ },
19
+
20
+ // Core verification info
21
+ verificationStatus: {
22
+ type: String,
23
+ required: true,
24
+ enum: ['pending', 'verified', 'failed'],
25
+ default: 'pending'
26
+ },
27
+
28
+ referenceId: {
29
+ type: String,
30
+ required: true,
31
+ index: true
32
+ },
33
+
34
+ // Personal details - Store after OTP verification
35
+ name: {
36
+ type: String,
37
+ default: null
38
+ },
39
+
40
+ gender: {
41
+ type: String,
42
+ default: null
43
+ },
44
+
45
+ dateOfBirth: {
46
+ type: String,
47
+ default: null
48
+ },
49
+
50
+ // Address information - Store after OTP verification
51
+ address: {
52
+ care_of: {
53
+ type: String,
54
+ default: null
55
+ },
56
+ building: {
57
+ type: String,
58
+ default: null
59
+ },
60
+ street: {
61
+ type: String,
62
+ default: null
63
+ },
64
+ locality: {
65
+ type: String,
66
+ default: null
67
+ },
68
+ vtc: {
69
+ type: String,
70
+ default: null
71
+ },
72
+ district: {
73
+ type: String,
74
+ default: null
75
+ },
76
+ state: {
77
+ type: String,
78
+ default: null
79
+ },
80
+ country: {
81
+ type: String,
82
+ default: null
83
+ },
84
+ pincode: {
85
+ type: String,
86
+ default: null
87
+ }
88
+ },
89
+
90
+ // Photo link - Store after OTP verification
91
+ photo: {
92
+ type: String,
93
+ default: null
94
+ },
95
+
96
+ // Request metadata - Store when sending OTP
97
+ otpSentAt: {
98
+ type: Date,
99
+ default: null
100
+ },
101
+
102
+ // Verification metadata - Store after OTP verification
103
+ verifiedAt: {
104
+ type: Date,
105
+ default: null
106
+ },
107
+
108
+ // Raw API response for debugging
109
+ rawResponse: {
110
+ type: mongoose.Schema.Types.Mixed,
111
+ default: null
112
+ }
113
+ }, {
114
+ timestamps: true, // Adds createdAt and updatedAt
115
+ collection: 'aadhaar_verifications'
116
+ });
117
+
118
+ // Indexes for better performance
119
+ aadhaarVerificationSchema.index({ userId: 1 });
120
+ aadhaarVerificationSchema.index({ referenceId: 1 });
121
+ aadhaarVerificationSchema.index({ aadhaarNumber: 1 });
122
+ aadhaarVerificationSchema.index({ verificationStatus: 1 });
123
+ aadhaarVerificationSchema.index({ createdAt: -1 });
124
+
125
+ // Compound indexes for user-specific queries
126
+ aadhaarVerificationSchema.index({ userId: 1, verificationStatus: 1 });
127
+ aadhaarVerificationSchema.index({ userId: 1, aadhaarNumber: 1 });
128
+
129
+ const AadhaarVerification = mongoose.models.AadhaarVerification || mongoose.model("AadhaarVerification", aadhaarVerificationSchema);
130
+
131
+ export default AadhaarVerification;
@@ -0,0 +1,82 @@
1
+ // config/devModel/BankVerification.js
2
+ import mongoose from 'mongoose';
3
+
4
+ const bankVerificationSchema = new mongoose.Schema({
5
+ userId: {
6
+ type: mongoose.Schema.Types.ObjectId,
7
+ ref: 'users',
8
+ required: true,
9
+ unique: true, // Ensures only one bank verification per user
10
+ index: true
11
+ },
12
+ accountNumber: {
13
+ type: String,
14
+ required: true
15
+ },
16
+ ifscCode: {
17
+ type: String,
18
+ required: true
19
+ },
20
+ verificationStatus: {
21
+ type: String,
22
+ enum: ['pending', 'verified', 'failed'],
23
+ default: 'pending'
24
+ },
25
+ accountHolderName: {
26
+ type: String,
27
+ default: null
28
+ },
29
+ nameMatch: {
30
+ type: Boolean,
31
+ default: false
32
+ },
33
+ accountStatus: {
34
+ type: String,
35
+ default: null
36
+ },
37
+ accountType: {
38
+ type: String,
39
+ default: null
40
+ },
41
+ bankName: {
42
+ type: String,
43
+ default: null
44
+ },
45
+ branchName: {
46
+ type: String,
47
+ default: null
48
+ },
49
+ branchAddress: {
50
+ type: String,
51
+ default: null
52
+ },
53
+ accountExists: {
54
+ type: Boolean,
55
+ default: false
56
+ },
57
+ referenceId: {
58
+ type: String,
59
+ default: null
60
+ },
61
+ verificationDate: {
62
+ type: Date,
63
+ default: Date.now
64
+ },
65
+ verifiedAt: {
66
+ type: Date,
67
+ default: null
68
+ },
69
+ rawResponse: {
70
+ type: mongoose.Schema.Types.Mixed,
71
+ default: null
72
+ }
73
+ }, {
74
+ timestamps: true
75
+ });
76
+
77
+ // Indexes for better query performance
78
+ bankVerificationSchema.index({ userId: 1, verificationStatus: 1 });
79
+ bankVerificationSchema.index({ accountNumber: 1, ifscCode: 1 });
80
+ const BankVerification = mongoose.models.BankVerification || mongoose.model("BankVerification", bankVerificationSchema);
81
+
82
+ export default BankVerification;
@@ -0,0 +1,89 @@
1
+ // models/GSTVerification.js
2
+ import mongoose from 'mongoose';
3
+
4
+ const gstVerificationSchema = new mongoose.Schema({
5
+ userId: {
6
+ type: mongoose.Schema.Types.ObjectId,
7
+ ref: 'users',
8
+ required: true,
9
+ index: true
10
+ },
11
+ gstNumber: {
12
+ type: String,
13
+ required: true,
14
+ uppercase: true,
15
+ trim: true
16
+ },
17
+ verificationStatus: {
18
+ type: String,
19
+ enum: ['verified', 'pending', 'failed'],
20
+ default: 'pending'
21
+ },
22
+ businessName: {
23
+ type: String,
24
+ trim: true
25
+ },
26
+ tradeName: {
27
+ type: String,
28
+ trim: true
29
+ },
30
+ gstStatus: {
31
+ type: String,
32
+ trim: true
33
+ },
34
+ registrationDate: {
35
+ type: Date
36
+ },
37
+ businessType: {
38
+ type: String,
39
+ trim: true
40
+ },
41
+ constitution: {
42
+ type: String,
43
+ trim: true
44
+ },
45
+ taxpayerType: {
46
+ type: String,
47
+ trim: true
48
+ },
49
+ address: {
50
+ building: String,
51
+ street: String,
52
+ location: String,
53
+ district: String,
54
+ state: String,
55
+ pincode: String,
56
+ city: String,
57
+ floor: String
58
+ },
59
+ filingStatus: {
60
+ type: String,
61
+ trim: true
62
+ },
63
+ lastUpdated: {
64
+ type: Date
65
+ },
66
+ cancellationDate: {
67
+ type: Date
68
+ },
69
+ rawResponse: {
70
+ type: mongoose.Schema.Types.Mixed
71
+ },
72
+ verificationDate: {
73
+ type: Date,
74
+ default: Date.now
75
+ },
76
+ isActive: {
77
+ type: Boolean,
78
+ default: true
79
+ }
80
+ }, {
81
+ timestamps: true
82
+ });
83
+
84
+ // Compound index to prevent duplicate verifications for same user and GST
85
+ gstVerificationSchema.index({ userId: 1, gstNumber: 1 }, { unique: true });
86
+
87
+ const GSTVerification = mongoose.models.GSTVerification || mongoose.model("GSTVerification", gstVerificationSchema);
88
+
89
+ export default GSTVerification;
@@ -1,5 +1,5 @@
1
1
  // order.modal.js
2
- import mongoose, { Schema, model } from 'mongoose';
2
+ import mongoose from 'mongoose';
3
3
  import { nanoid } from 'nanoid';
4
4
 
5
5
  const orderSchema = new mongoose.Schema(
@@ -48,17 +48,6 @@ const orderSchema = new mongoose.Schema(
48
48
  type: String,
49
49
  enum: ['CGST+SGST', 'IGST',"NON-GST"],
50
50
  required: true
51
- },
52
- isFlashSale: {
53
- type: Boolean,
54
- default: false
55
- },
56
- flashSaleId: {
57
- type: mongoose.Schema.Types.ObjectId,
58
- ref: 'FlashSale'
59
- },
60
- flashPrice: {
61
- type: Number
62
51
  }
63
52
  }],
64
53
  totalBaseAmount: {
@@ -147,7 +136,7 @@ const orderSchema = new mongoose.Schema(
147
136
  }],
148
137
  paymentMethod: {
149
138
  type: String,
150
- enum: ['CARD', 'UPI', 'NETBANKING', 'WALLET', 'COD', "PENDING_PAYMENT", "CASHFREE", "Online"],
139
+ enum: ['CARD', 'UPI', 'NETBANKING', 'WALLET', 'COD', "PENDING_PAYMENT", "CASHFREE","RAZORPAY", "Online"],
151
140
  required: true
152
141
  },
153
142
  paymentStatus: {
@@ -177,9 +166,9 @@ const orderSchema = new mongoose.Schema(
177
166
  // default: 'ORDERED', // Default should be the initial state
178
167
  required: true
179
168
  },
180
- sourceType: {
169
+ sourceType: {
181
170
  type: String,
182
- enum: ['static', 'shoppable_video', 'livestream', 'auction', 'flash_sale'], // Add flash_sale
171
+ enum: ['static', 'shoppable_video', 'livestream', 'auction'],
183
172
  required: true
184
173
  },
185
174
  sourceRefId: String,
@@ -288,6 +277,9 @@ payment: {
288
277
  );
289
278
 
290
279
 
291
-
292
- const Order = mongoose.models.Order || mongoose.model('Order', orderSchema);
280
+ const Order = mongoose.model('Order', orderSchema);
293
281
  export default Order;
282
+
283
+
284
+ // const Order = mongoose.models.Order || mongoose.model('Order', orderSchema);
285
+ // export default Order;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flykup_model_development",
3
- "version": "2.0.8",
3
+ "version": "3.0.0",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "private": false,
@@ -11,6 +11,7 @@
11
11
  "bcrypt": "^5.1.0",
12
12
  "crypto": "^1.0.1",
13
13
  "dotenv": "^16.4.5",
14
+ "flykup_model_development": "^2.0.9",
14
15
  "jsonwebtoken": "^9.0.0",
15
16
  "mongoose": "^8.0.0",
16
17
  "nanoid": "^5.1.5"