From fd03f269c0e9498e58fe7a381794ab84991b054e Mon Sep 17 00:00:00 2001 From: eug-vs Date: Wed, 10 Jun 2020 18:42:33 +0300 Subject: refactor: rename interfaces --- models/polls/poll.schema.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'models/polls/poll.schema.ts') diff --git a/models/polls/poll.schema.ts b/models/polls/poll.schema.ts index 2e7dccd..79036c3 100644 --- a/models/polls/poll.schema.ts +++ b/models/polls/poll.schema.ts @@ -1,12 +1,11 @@ import { Document, Schema, Types } from 'mongoose'; -import { User } from '../users/user.schema'; interface ImageData { url: string; votes: number; } -export interface Poll extends Document { +export interface PollSchema extends Document { authorId: string; contents: { left: ImageData; @@ -20,7 +19,7 @@ const imageDataSchema = { votes: Number } -export const PollSchema = new Schema({ +export const pollSchema = new Schema({ contents: { left: imageDataSchema, right: imageDataSchema -- cgit v1.2.3 From d40f6e6cf8150f9e112d0b5d8d7075c2fc90264b Mon Sep 17 00:00:00 2001 From: eug-vs Date: Wed, 10 Jun 2020 19:47:48 +0300 Subject: refactor: improve interfaces and expandAuthor --- models/polls/poll.schema.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'models/polls/poll.schema.ts') 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 { + authorId: string; +} + const imageDataSchema = { url: String, -- cgit v1.2.3