flykup_model_development 2.0.6 → 2.0.8

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,6 +29,7 @@ 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
+ import SellerDraft from './models/sellerDraft.model.js';
32
33
 
33
34
  let initialized = false;
34
35
 
@@ -90,7 +91,7 @@ export const RegisterShowModel = createModelProxy(RegisterShow);
90
91
  export const ReviewTypeModel = createModelProxy(ReviewType);
91
92
  export const ReviewModel = createModelProxy(Review);
92
93
  export const ShoppableVideoInteractionModel = createModelProxy(ShoppableVideoInteraction);
93
-
94
+ export const SellerDraftModel = createModelProxy(SellerDraft);
94
95
 
95
96
  export {
96
97
  AdminModel as Admin,
@@ -123,5 +124,6 @@ export {
123
124
  RegisterShowModel as RegisterShow,
124
125
  ReviewModel as Review,
125
126
  ReviewTypeModel as ReviewType,
126
- ShoppableVideoInteractionModel as ShoppableVideoInteraction
127
+ ShoppableVideoInteractionModel as ShoppableVideoInteraction,
128
+ SellerDraftModel as SellerDraft
127
129
  };
@@ -289,7 +289,8 @@ const SellerSchema = new mongoose.Schema(
289
289
  start: { type: String, default: '09:00' },
290
290
  end: { type: String, default: '18:00' }
291
291
  }
292
- }
292
+ },
293
+
293
294
  },
294
295
  { timestamps: true, strict: true }
295
296
  );
@@ -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;
@@ -93,7 +93,6 @@ const UserSchema = new mongoose.Schema(
93
93
  },
94
94
  ],
95
95
  filledNewSellerForm: { type: Boolean, default: false },
96
-
97
96
  // --- Verification Flow Fields ---
98
97
  verificationFlowStatus: {
99
98
  type: String,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flykup_model_development",
3
- "version": "2.0.6",
3
+ "version": "2.0.8",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "private": false,