diff options
author | Eugene Sokolov <eug-vs@keemail.me> | 2020-06-28 19:01:52 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-28 19:01:52 +0300 |
commit | 88e97a42096c1e4de7b9f1d8fefa0829bbc0d321 (patch) | |
tree | ae402f77d0d0d7b8d06dcefc614bbb9aad12ed59 /models/votes | |
parent | 8baf96be5ea7880cebe3aeda733b9196950be434 (diff) | |
parent | 29197dd3bc7e941707979b6c226e5f3b1a4cbbed (diff) | |
download | which-api-88e97a42096c1e4de7b9f1d8fefa0829bbc0d321.tar.gz |
Merge pull request #16 from which-ecosystem/feedback
Feedback endpoint & schema updates
Diffstat (limited to 'models/votes')
-rw-r--r-- | models/votes/vote.model.ts | 2 | ||||
-rw-r--r-- | models/votes/vote.schema.ts | 6 |
2 files changed, 3 insertions, 5 deletions
diff --git a/models/votes/vote.model.ts b/models/votes/vote.model.ts index df2307e..bf2dcf6 100644 --- a/models/votes/vote.model.ts +++ b/models/votes/vote.model.ts @@ -1,7 +1,7 @@ import { Model, model } from 'mongoose'; import { VoteSchema, voteSchema } from './vote.schema'; -voteSchema.index({ pollId: 1, userId: 1 }, { unique: true }); // Unique together +voteSchema.index({ pollId: 1, authorId: 1 }, { unique: true }); // Unique together export default model<VoteSchema, Model<VoteSchema>>('Vote', voteSchema); diff --git a/models/votes/vote.schema.ts b/models/votes/vote.schema.ts index 63ba212..72b196d 100644 --- a/models/votes/vote.schema.ts +++ b/models/votes/vote.schema.ts @@ -1,12 +1,10 @@ import { Document, Schema, Types } from 'mongoose'; import { Vote } from 'which-types'; -export interface VoteSchema extends Document, Omit<Vote, '_id'> { - password: string; -} +export interface VoteSchema extends Document, Omit<Vote, '_id'> {} export const voteSchema = new Schema({ - userId: { + authorId: { type: Types.ObjectId, ref: 'user', required: true |