aboutsummaryrefslogtreecommitdiff
path: root/models
diff options
context:
space:
mode:
authoreug-vs <eug-vs@keemail.me>2020-06-28 18:57:31 +0300
committereug-vs <eug-vs@keemail.me>2020-06-28 18:57:31 +0300
commit094384b580ab36feb7e23507aab36d174022ac0c (patch)
tree1ab7973309cac894561722701840c7df1621e42c /models
parent00387d9ad38049db555cad7b5cb375167a108a6e (diff)
downloadwhich-api-094384b580ab36feb7e23507aab36d174022ac0c.tar.gz
feat: only allow feedback once per version
Diffstat (limited to 'models')
-rw-r--r--models/feedback/feedback.model.ts2
1 files changed, 2 insertions, 0 deletions
diff --git a/models/feedback/feedback.model.ts b/models/feedback/feedback.model.ts
index 793f8da..b21747b 100644
--- a/models/feedback/feedback.model.ts
+++ b/models/feedback/feedback.model.ts
@@ -1,5 +1,7 @@
import { Model, model } from 'mongoose';
import { FeedbackSchema, feedbackSchema } from './feedback.schema';
+feedbackSchema.index({ version: 1, authorId: 1 }, { unique: true }); // Unique together
+
export default model<FeedbackSchema, Model<FeedbackSchema>>('Feedback', feedbackSchema);