diff options
Diffstat (limited to 'models/polls/poll.schema.ts')
-rw-r--r-- | models/polls/poll.schema.ts | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/models/polls/poll.schema.ts b/models/polls/poll.schema.ts index 2e7dccd..ea91051 100644 --- a/models/polls/poll.schema.ts +++ b/models/polls/poll.schema.ts @@ -1,26 +1,30 @@ import { Document, Schema, Types } from 'mongoose'; -import { User } from '../users/user.schema'; +import { User } from '../users/user.schema' interface ImageData { url: string; votes: number; } -export interface Poll extends Document { - authorId: string; +export interface Poll { + author: User; contents: { left: ImageData; right: ImageData; }; } +export interface PollSchema extends Document, Omit<Poll, 'author'> { + authorId: string; +} + const imageDataSchema = { url: String, votes: Number } -export const PollSchema = new Schema({ +export const pollSchema = new Schema({ contents: { left: imageDataSchema, right: imageDataSchema |