fix: add state enums to Connection matchingTags, index to TagSuggestion

This commit is contained in:
Jennie Robinson Faber 2026-04-05 16:09:20 +01:00
parent 8112e5ea47
commit 4b6ff19d5f
2 changed files with 4 additions and 2 deletions

View file

@ -7,8 +7,8 @@ const connectionSchema = new mongoose.Schema({
matchingTags: [ matchingTags: [
{ {
tagSlug: String, tagSlug: String,
initiatorState: String, initiatorState: { type: String, enum: ['help', 'interested', 'seeking'] },
recipientState: String, recipientState: { type: String, enum: ['help', 'interested', 'seeking'] },
}, },
], ],
hiddenBy: [{ type: mongoose.Schema.Types.ObjectId, ref: 'Member' }], hiddenBy: [{ type: mongoose.Schema.Types.ObjectId, ref: 'Member' }],

View file

@ -8,4 +8,6 @@ const tagSuggestionSchema = new mongoose.Schema({
createdAt: { type: Date, default: Date.now }, createdAt: { type: Date, default: Date.now },
}) })
tagSuggestionSchema.index({ pool: 1, status: 1 })
export default mongoose.models.TagSuggestion || mongoose.model('TagSuggestion', tagSuggestionSchema) export default mongoose.models.TagSuggestion || mongoose.model('TagSuggestion', tagSuggestionSchema)