aboutsummaryrefslogtreecommitdiff
path: root/models/polls/poll.schema.ts
diff options
context:
space:
mode:
Diffstat (limited to 'models/polls/poll.schema.ts')
-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({