From f4c4f2d4789880c0cfc956d08aab10b5a93ebcb1 Mon Sep 17 00:00:00 2001 From: ilyayudovin Date: Sun, 21 Jun 2020 13:10:05 +0300 Subject: feat: change votes type --- models/polls/poll.schema.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'models') 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 { - 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({ -- cgit v1.2.3