diff options
author | eug-vs <eug-vs@keemail.me> | 2020-06-10 18:42:33 +0300 |
---|---|---|
committer | eug-vs <eug-vs@keemail.me> | 2020-06-10 18:42:33 +0300 |
commit | fd03f269c0e9498e58fe7a381794ab84991b054e (patch) | |
tree | 0c60220a6b9d5e46cb99b421b976ff8923e435a0 | |
parent | 57275beb2ee3224994386ce616f86dbee292e2ee (diff) | |
download | which-api-fd03f269c0e9498e58fe7a381794ab84991b054e.tar.gz |
refactor: rename interfaces
-rw-r--r-- | models/polls/poll.model.ts | 4 | ||||
-rw-r--r-- | models/polls/poll.schema.ts | 5 | ||||
-rw-r--r-- | models/users/user.model.ts | 4 | ||||
-rw-r--r-- | models/users/user.schema.ts | 4 |
4 files changed, 8 insertions, 9 deletions
diff --git a/models/polls/poll.model.ts b/models/polls/poll.model.ts index 211d1e6..be1f604 100644 --- a/models/polls/poll.model.ts +++ b/models/polls/poll.model.ts @@ -1,5 +1,5 @@ import { Model, model } from "mongoose" -import { Poll, PollSchema } from './poll.schema'; +import { PollSchema, pollSchema } from './poll.schema'; -export default model<Poll, Model<Poll>>("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 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 diff --git a/models/users/user.model.ts b/models/users/user.model.ts index cec9298..d4c67df 100644 --- a/models/users/user.model.ts +++ b/models/users/user.model.ts @@ -1,5 +1,5 @@ import { Model, model } from "mongoose" -import { User, UserSchema } from './user.schema'; +import { UserSchema, userSchema } from './user.schema'; -export default model<User, Model<User>>("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 c846f81..5292add 100644 --- a/models/users/user.schema.ts +++ b/models/users/user.schema.ts @@ -1,12 +1,12 @@ import { Document, Schema } from "mongoose" -export interface User extends Document { +export interface UserSchema extends Document { name: string; avatarUrl?: string; age?: number; } -export const UserSchema = new Schema({ +export const userSchema = new Schema({ name: String, avatarUrl: { type: String, |