@armi-wave/common 1.23.17 → 1.23.19

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.
@@ -65,6 +65,5 @@ const commentSchema = new mongoose_1.Schema({
65
65
  },
66
66
  },
67
67
  });
68
- commentSchema.index({ postId: 1 });
69
68
  const Comment = mongoose_1.default.model('Comment', commentSchema);
70
69
  exports.default = Comment;
@@ -60,8 +60,6 @@ const followSchema = new mongoose_1.Schema({
60
60
  });
61
61
  // Ensure a user cannot follow the same person multiple times
62
62
  followSchema.index({ followerId: 1, followingId: 1 }, { unique: true });
63
- followSchema.index({ followerId: 1 });
64
- followSchema.index({ followingId: 1 });
65
63
  // Create and export the model
66
64
  const Follow = mongoose_1.default.model('Follow', followSchema);
67
65
  exports.default = Follow;
@@ -60,7 +60,6 @@ const likeSchema = new mongoose_1.Schema({
60
60
  });
61
61
  // Ensure a user cannot like the same person multiple times
62
62
  likeSchema.index({ userId: 1, postId: 1 }, { unique: true });
63
- likeSchema.index({ userId: 1 });
64
63
  // Create and export the model
65
64
  const Like = mongoose_1.default.model('Like', likeSchema);
66
65
  exports.default = Like;
@@ -61,6 +61,5 @@ const postSchema = new mongoose_1.Schema({
61
61
  },
62
62
  },
63
63
  });
64
- postSchema.index({ userId: 1 });
65
64
  const Post = mongoose_1.default.model('Post', postSchema);
66
65
  exports.default = Post;
@@ -1,6 +1,7 @@
1
1
  import mongoose, { Document } from 'mongoose';
2
2
  interface Reply extends Document {
3
3
  commentId: mongoose.Types.ObjectId;
4
+ postId: mongoose.Types.ObjectId;
4
5
  userId: mongoose.Types.ObjectId;
5
6
  username: string;
6
7
  profilePicUrl: string;
@@ -41,7 +41,18 @@ const replySchema = new mongoose_1.default.Schema({
41
41
  index: true,
42
42
  required: true,
43
43
  },
44
- userId: { type: mongoose_1.Schema.Types.ObjectId, ref: 'User', required: true },
44
+ postId: {
45
+ type: mongoose_1.Schema.Types.ObjectId,
46
+ ref: 'Post',
47
+ index: true,
48
+ required: true,
49
+ },
50
+ userId: {
51
+ type: mongoose_1.Schema.Types.ObjectId,
52
+ ref: 'User',
53
+ index: true,
54
+ required: true,
55
+ },
45
56
  username: { type: String, required: true },
46
57
  profilePicUrl: { type: String, default: '' },
47
58
  text: { type: String, required: true },
@@ -60,6 +71,5 @@ const replySchema = new mongoose_1.default.Schema({
60
71
  },
61
72
  },
62
73
  });
63
- replySchema.index({ commentId: 1 });
64
74
  const Reply = mongoose_1.default.model('Reply', replySchema);
65
75
  exports.default = Reply;
@@ -101,6 +101,5 @@ userSchema.pre('save', function (done) {
101
101
  done();
102
102
  });
103
103
  });
104
- userSchema.index({ username: 1 }, { unique: true });
105
104
  const User = mongoose_1.default.model('User', userSchema);
106
105
  exports.default = User;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@armi-wave/common",
3
- "version": "1.23.17",
3
+ "version": "1.23.19",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",