flykup_model_production 1.0.8 → 1.0.9

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.
@@ -1,4 +1,4 @@
1
- import mongoose, { Schema, model } from 'mongoose';
1
+ import mongoose, { Schema } from "mongoose";
2
2
 
3
3
  const coHostInviteSchema = new Schema(
4
4
  {
@@ -17,40 +17,43 @@ const coHostInviteSchema = new Schema(
17
17
  values: ["sellers", "dropshippers"],
18
18
  message: `{VALUE} is invalid host model`,
19
19
  },
20
- }
21
- },
22
- cohost: {
23
- userId: { type: Schema.Types.ObjectId, ref: "users", required: true },
24
- hostId: {
25
- type: mongoose.Schema.Types.ObjectId,
26
- required: true,
27
- refPath: "cohost.hostModel",
28
20
  },
29
- hostModel: {
30
- type: String,
31
- required: true,
32
- enum: {
33
- values: ["sellers", "dropshippers"],
34
- message: `{VALUE} is invalid cohost model`,
35
- },
36
- }
37
- },
38
- status: {
39
- type: String,
40
- enum: ["pending", "accepted", "rejected", "cancelled", "left"],
41
- default: "pending",
42
- index: true
43
21
  },
44
- joinedAt: Date,
45
- leftAt: Date,
46
- liveStreamId: String,
22
+
23
+
24
+ cohosts: [
25
+ {
26
+ userId: { type: Schema.Types.ObjectId, ref: "users", required: true },
27
+ hostId: {
28
+ type: mongoose.Schema.Types.ObjectId,
29
+ required: true,
30
+ refPath: "cohosts.hostModel",
31
+ },
32
+ hostModel: {
33
+ type: String,
34
+ required: true,
35
+ enum: {
36
+ values: ["sellers", "dropshippers"],
37
+ message: `{VALUE} is invalid cohost model`,
38
+ },
39
+ },
40
+ status: {
41
+ type: String,
42
+ enum: ["pending", "accepted", "rejected", "cancelled", "left"],
43
+ default: "pending",
44
+ },
45
+ joinedAt: Date,
46
+ leftAt: Date,
47
+ liveStreamId: String,
48
+ },
49
+ ],
47
50
  },
48
51
  { timestamps: true }
49
52
  );
50
53
 
51
- coHostInviteSchema.index({ show: 1, status: 1 });
52
- coHostInviteSchema.index({ "cohost.userId": 1, status: 1 });
53
-
54
+ // Indexing for faster queries
55
+ coHostInviteSchema.index({ show: 1, "cohosts.status": 1 });
56
+ coHostInviteSchema.index({ "cohosts.userId": 1, "cohosts.status": 1 });
54
57
  // Safe export to prevent OverwriteModelError
55
58
  const CoHostInvite = mongoose.models.cohostinvites || mongoose.model("cohostinvites", coHostInviteSchema);
56
59
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flykup_model_production",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "private": false,