diff options
Diffstat (limited to 'models')
-rw-r--r-- | models/polls/poll.model.ts | 4 | ||||
-rw-r--r-- | models/polls/poll.schema.ts | 6 | ||||
-rw-r--r-- | models/users/user.model.ts | 4 | ||||
-rw-r--r-- | models/users/user.schema.ts | 2 |
4 files changed, 8 insertions, 8 deletions
diff --git a/models/polls/poll.model.ts b/models/polls/poll.model.ts index be1f604..7f6be9a 100644 --- a/models/polls/poll.model.ts +++ b/models/polls/poll.model.ts @@ -1,5 +1,5 @@ -import { Model, model } from "mongoose" +import { Model, model } from 'mongoose'; import { PollSchema, pollSchema } from './poll.schema'; -export default model<PollSchema, Model<PollSchema>>("Poll", pollSchema); +export default model<PollSchema, Model<PollSchema>>('Poll', pollSchema); diff --git a/models/polls/poll.schema.ts b/models/polls/poll.schema.ts index 83de688..bc6d497 100644 --- a/models/polls/poll.schema.ts +++ b/models/polls/poll.schema.ts @@ -1,5 +1,5 @@ import { Document, Schema, Types } from 'mongoose'; -import { User } from '../users/user.schema' +import { User } from '../users/user.schema'; export interface ImageData { url: string; @@ -22,14 +22,14 @@ export interface PollSchema extends Document, Omit<Poll, 'author'> { const imageDataSchema = { url: String, votes: Number -} +}; export const pollSchema = new Schema({ contents: { left: imageDataSchema, right: imageDataSchema }, - authorId: { + authorId: { type: Types.ObjectId, ref: 'User' } diff --git a/models/users/user.model.ts b/models/users/user.model.ts index d4c67df..0b04ffc 100644 --- a/models/users/user.model.ts +++ b/models/users/user.model.ts @@ -1,5 +1,5 @@ -import { Model, model } from "mongoose" +import { Model, model } from 'mongoose'; import { UserSchema, userSchema } from './user.schema'; -export default model<UserSchema, Model<UserSchema>>("User", userSchema); +export default model<UserSchema, Model<UserSchema>>('User', userSchema); diff --git a/models/users/user.schema.ts b/models/users/user.schema.ts index e39f667..07979d1 100644 --- a/models/users/user.schema.ts +++ b/models/users/user.schema.ts @@ -1,4 +1,4 @@ -import { Document, Schema } from "mongoose" +import { Document, Schema } from 'mongoose'; export interface User { name: string; |