flykup_model_production 1.0.4 → 1.0.6

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
@@ -29,7 +29,10 @@ import ProfileInteraction from './models/profileInteractions.model.js';
29
29
  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
+ import AadhaarVerification from './models/AadhaarVerification.js';
34
+ import BankVerification from './models/BankVerification.js';
35
+ import GSTVerification from './models/GSTVerification.js';
33
36
  let initialized = false;
34
37
 
35
38
  export async function initializeSharedModels({ token, dbUri }) {
@@ -90,6 +93,10 @@ export const RegisterShowModel = createModelProxy(RegisterShow);
90
93
  export const ReviewTypeModel = createModelProxy(ReviewType);
91
94
  export const ReviewModel = createModelProxy(Review);
92
95
  export const ShoppableVideoInteractionModel = createModelProxy(ShoppableVideoInteraction);
96
+ export const SellerDraftModel = createModelProxy(SellerDraft);
97
+ export const AadhaarVerificationModel = createModelProxy(AadhaarVerification);
98
+ export const BankVerificationModel = createModelProxy(BankVerification);
99
+ export const GSTVerificationModel = createModelProxy(GSTVerification);
93
100
 
94
101
 
95
102
  export {
@@ -123,5 +130,9 @@ export {
123
130
  RegisterShowModel as RegisterShow,
124
131
  ReviewModel as Review,
125
132
  ReviewTypeModel as ReviewType,
126
- ShoppableVideoInteractionModel as ShoppableVideoInteraction
133
+ ShoppableVideoInteractionModel as ShoppableVideoInteraction,
134
+ SellerDraftModel as SellerDraft,
135
+ AadhaarVerificationModel as AadhaarVerification,
136
+ BankVerificationModel as BankVerification,
137
+ GSTVerificationModel as GSTVerification
127
138
  };
@@ -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;
@@ -27,6 +27,7 @@ const AdminSchema = new Schema(
27
27
  Coupons:{readOnly:Boolean,edit:Boolean},
28
28
  Plans:{readOnly:Boolean,edit:Boolean},
29
29
  orderPayments:{readOnly:Boolean,edit:Boolean},
30
+ helpandsupport:{readOnly:Boolean,edit:Boolean},
30
31
  // settings: { readOnly: Boolean, edit: Boolean },
31
32
  // admins: { readOnly: Boolean, edit: Boolean },
32
33
  },
@@ -0,0 +1,28 @@
1
+ import mongoose from "mongoose";
2
+ const { Schema } = mongoose;
3
+
4
+ const SellerDraftSchema = new Schema(
5
+ {
6
+ userInfo: {
7
+ type: mongoose.Schema.Types.ObjectId,
8
+ ref: "users",
9
+ required: true,
10
+ unique: true, // A user can only have one draft
11
+ index: true,
12
+ },
13
+ formData: {
14
+ type: mongoose.Schema.Types.Mixed, // Allows storing a flexible, partially-filled form object
15
+ required: true,
16
+ },
17
+ // The 'createdAt' and 'updatedAt' fields are automatically managed by timestamps: true
18
+ },
19
+ { timestamps: true }
20
+ );
21
+
22
+ // TTL Index: Automatically delete documents 30 days after they were last updated.
23
+ // This keeps your collection clean from abandoned drafts.
24
+ SellerDraftSchema.index({ updatedAt: 1 }, { expireAfterSeconds: 2592000 }); // 30 days in seconds
25
+
26
+ const SellerDraft = mongoose.models.sellerDrafts || mongoose.model("sellerDrafts", SellerDraftSchema);
27
+
28
+ export default SellerDraft;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flykup_model_production",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "private": false,