aboutsummaryrefslogtreecommitdiff
path: root/models/polls
diff options
context:
space:
mode:
authorilyayudovin <ilyayudovin123@gmail.com>2020-06-21 13:10:05 +0300
committereug-vs <eug-vs@keemail.me>2020-06-21 13:13:27 +0300
commitf4c4f2d4789880c0cfc956d08aab10b5a93ebcb1 (patch)
treede24c4c3ede7d0df755aebbba8cadbf6169d1b0d /models/polls
parent29dce80de9267a4886c6a598ec90756995821828 (diff)
downloadwhich-api-f4c4f2d4789880c0cfc956d08aab10b5a93ebcb1.tar.gz
feat: change votes type
Diffstat (limited to 'models/polls')
-rw-r--r--models/polls/poll.schema.ts17
1 files changed, 13 insertions, 4 deletions
diff --git a/models/polls/poll.schema.ts b/models/polls/poll.schema.ts
index bc6d497..236011f 100644
--- a/models/polls/poll.schema.ts
+++ b/models/polls/poll.schema.ts
@@ -7,6 +7,7 @@ export interface ImageData {
}
export interface Poll {
+ _id: string;
author: User;
contents: {
left: ImageData;
@@ -14,14 +15,22 @@ export interface Poll {
};
}
-export interface PollSchema extends Document, Omit<Poll, 'author'> {
- authorId: string;
+export interface ImageDataSchema {
+ url: string;
+ votes: string[];
}
+export interface PollSchema extends Document {
+ contents: {
+ left: ImageDataSchema;
+ right: ImageDataSchema;
+ };
+ authorId: string;
+}
-const imageDataSchema = {
+export const imageDataSchema = {
url: String,
- votes: Number
+ votes: [Types.ObjectId]
};
export const pollSchema = new Schema({