diff options
author | eug-vs <eug-vs@keemail.me> | 2020-06-10 19:47:48 +0300 |
---|---|---|
committer | eug-vs <eug-vs@keemail.me> | 2020-06-10 19:47:48 +0300 |
commit | d40f6e6cf8150f9e112d0b5d8d7075c2fc90264b (patch) | |
tree | 7cdb3cb7b86e3333c15bbaefe14fe228cc93d023 /models/polls | |
parent | 0915870f347eecbf5d1646fa732e2a73418960a6 (diff) | |
download | which-api-d40f6e6cf8150f9e112d0b5d8d7075c2fc90264b.tar.gz |
refactor: improve interfaces and expandAuthor
Diffstat (limited to 'models/polls')
-rw-r--r-- | models/polls/poll.schema.ts | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/models/polls/poll.schema.ts b/models/polls/poll.schema.ts index 79036c3..ea91051 100644 --- a/models/polls/poll.schema.ts +++ b/models/polls/poll.schema.ts @@ -1,18 +1,23 @@ import { Document, Schema, Types } from 'mongoose'; +import { User } from '../users/user.schema' interface ImageData { url: string; votes: number; } -export interface PollSchema 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, |