diff --git a/database/account.model.ts b/database/account.model.ts index 1e0b8f2..ef01e6f 100644 --- a/database/account.model.ts +++ b/database/account.model.ts @@ -1,4 +1,4 @@ -import { model, models, Schema, Types, Document } from "mongoose"; +import { model, models, Schema, Types, Document , HydratedDocument} from "mongoose"; export interface IAccount { userId: Types.ObjectId; @@ -9,7 +9,7 @@ export interface IAccount { providerAccountId: string; } -export interface IAccountDoc extends IAccount, Document {} +export type IAccountDoc = HydratedDocument; const AccountSchema = new Schema( { userId: { type: Schema.Types.ObjectId, ref: "User", required: true }, diff --git a/database/answer.model.ts b/database/answer.model.ts index e809e1c..d60412d 100644 --- a/database/answer.model.ts +++ b/database/answer.model.ts @@ -1,4 +1,4 @@ -import { model, models, Schema, Types, Document } from "mongoose"; +import { model, models, Schema, Types, Document, HydratedDocument } from "mongoose"; export interface IAnswer { author: Types.ObjectId; @@ -8,7 +8,7 @@ export interface IAnswer { downvotes: number; } -export interface IAnswerDoc extends IAnswer, Document {} +export type IAnswerDoc = HydratedDocument; const AnswerSchema = new Schema( { author: { type: Schema.Types.ObjectId, ref: "User", required: true }, diff --git a/database/collection.model.ts b/database/collection.model.ts index 6abbbff..d951e0b 100644 --- a/database/collection.model.ts +++ b/database/collection.model.ts @@ -1,11 +1,11 @@ -import { model, models, Schema, Types, Document } from "mongoose"; +import { model, models, Schema, Types, Document , HydratedDocument} from "mongoose"; export interface ICollection { author: Types.ObjectId; question: Types.ObjectId; } -export interface ICollectionDoc extends ICollection, Document {} +export type ICollectionDoc = HydratedDocument; const CollectionSchema = new Schema( { author: { type: Schema.Types.ObjectId, ref: "User", required: true }, diff --git a/database/interaction.model.ts b/database/interaction.model.ts index a0d36f0..b3cd59b 100644 --- a/database/interaction.model.ts +++ b/database/interaction.model.ts @@ -1,4 +1,4 @@ -import { Schema, models, model, Types, Document } from "mongoose"; +import { Schema, models, model, Types, Document , HydratedDocument} from "mongoose"; export interface IInteraction { user: Types.ObjectId; @@ -18,7 +18,7 @@ export const InteractionActionEnums = [ "search", ] as const; -export interface IInteractionDoc extends IInteraction, Document {} +export type IInteractionDoc = HydratedDocument; const InteractionSchema = new Schema( { user: { type: Schema.Types.ObjectId, ref: "User", required: true }, diff --git a/database/question.model.ts b/database/question.model.ts index 2ab20ce..72b81d9 100644 --- a/database/question.model.ts +++ b/database/question.model.ts @@ -1,4 +1,4 @@ -import { model, models, Schema, Types, Document } from "mongoose"; +import { model, models, Schema, Types, Document , HydratedDocument} from "mongoose"; export interface IQuestion { title: string; @@ -11,7 +11,7 @@ export interface IQuestion { author: Types.ObjectId; } -export interface IQuestionDoc extends IQuestion, Document {} +export type IQuestionDoc = HydratedDocument; const QuestionSchema = new Schema( { title: { type: String, required: true }, diff --git a/database/tag-question.model.ts b/database/tag-question.model.ts index 20ad10c..4c81733 100644 --- a/database/tag-question.model.ts +++ b/database/tag-question.model.ts @@ -1,11 +1,11 @@ -import { model, models, Schema, Types, Document } from "mongoose"; +import { model, models, Schema, Types, Document, HydratedDocument } from "mongoose"; export interface ITagQuestion { tag: Types.ObjectId; question: Types.ObjectId; } -export interface ITagQuestionDoc extends ITagQuestion, Document {} +export type ITagQuestionDoc = HydratedDocument; const TagQuestionSchema = new Schema( { tag: { type: Schema.Types.ObjectId, ref: "Tag", required: true }, diff --git a/database/tag.model.ts b/database/tag.model.ts index ef7f169..0e697ae 100644 --- a/database/tag.model.ts +++ b/database/tag.model.ts @@ -1,11 +1,11 @@ -import { model, models, Schema, Document } from "mongoose"; +import { model, models, Schema, Document, HydratedDocument } from "mongoose"; export interface ITag { name: string; questions: number; } -export interface ITagDoc extends ITag, Document {} +export type ITagDoc = HydratedDocument; const TagSchema = new Schema( { name: { type: String, required: true, unique: true }, diff --git a/database/user.model.ts b/database/user.model.ts index 6ccd0e7..db7196b 100644 --- a/database/user.model.ts +++ b/database/user.model.ts @@ -1,4 +1,4 @@ -import { model, models, Schema, Document } from "mongoose"; +import { model, models, Schema, Document,HydratedDocument } from "mongoose"; export interface IUser { name: string; @@ -11,7 +11,7 @@ export interface IUser { reputation?: number; } -export interface IUserDoc extends IUser, Document {} +export type IUserDoc = HydratedDocument; const UserSchema = new Schema( { name: { type: String, required: true }, diff --git a/database/vote.model.ts b/database/vote.model.ts index 1e17c1a..6b6d602 100644 --- a/database/vote.model.ts +++ b/database/vote.model.ts @@ -1,4 +1,4 @@ -import { model, models, Schema, Types } from "mongoose"; +import { model, models, Schema, Types , HydratedDocument} from "mongoose"; export interface IVote { author: Types.ObjectId; @@ -7,7 +7,7 @@ export interface IVote { voteType: "upvote" | "downvote"; } -export interface IVoteDoc extends IVote, Document {} +export type IVoteDoc = HydratedDocument; const VoteSchema = new Schema( { author: { type: Schema.Types.ObjectId, ref: "User", required: true },