Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions database/account.model.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -9,7 +9,7 @@ export interface IAccount {
providerAccountId: string;
}

export interface IAccountDoc extends IAccount, Document {}
export type IAccountDoc = HydratedDocument<IAccount>;
const AccountSchema = new Schema<IAccount>(
{
userId: { type: Schema.Types.ObjectId, ref: "User", required: true },
Expand Down
4 changes: 2 additions & 2 deletions database/answer.model.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -8,7 +8,7 @@ export interface IAnswer {
downvotes: number;
}

export interface IAnswerDoc extends IAnswer, Document {}
export type IAnswerDoc = HydratedDocument<IAnswer>;
const AnswerSchema = new Schema<IAnswer>(
{
author: { type: Schema.Types.ObjectId, ref: "User", required: true },
Expand Down
4 changes: 2 additions & 2 deletions database/collection.model.ts
Original file line number Diff line number Diff line change
@@ -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<ICollection>;
const CollectionSchema = new Schema<ICollection>(
{
author: { type: Schema.Types.ObjectId, ref: "User", required: true },
Expand Down
4 changes: 2 additions & 2 deletions database/interaction.model.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -18,7 +18,7 @@ export const InteractionActionEnums = [
"search",
] as const;

export interface IInteractionDoc extends IInteraction, Document {}
export type IInteractionDoc = HydratedDocument<IInteraction>;
const InteractionSchema = new Schema<IInteraction>(
{
user: { type: Schema.Types.ObjectId, ref: "User", required: true },
Expand Down
4 changes: 2 additions & 2 deletions database/question.model.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -11,7 +11,7 @@ export interface IQuestion {
author: Types.ObjectId;
}

export interface IQuestionDoc extends IQuestion, Document {}
export type IQuestionDoc = HydratedDocument<IQuestion>;
const QuestionSchema = new Schema<IQuestion>(
{
title: { type: String, required: true },
Expand Down
4 changes: 2 additions & 2 deletions database/tag-question.model.ts
Original file line number Diff line number Diff line change
@@ -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<ITagQuestion>;
const TagQuestionSchema = new Schema<ITagQuestion>(
{
tag: { type: Schema.Types.ObjectId, ref: "Tag", required: true },
Expand Down
4 changes: 2 additions & 2 deletions database/tag.model.ts
Original file line number Diff line number Diff line change
@@ -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<ITag>;
const TagSchema = new Schema<ITag>(
{
name: { type: String, required: true, unique: true },
Expand Down
4 changes: 2 additions & 2 deletions database/user.model.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { model, models, Schema, Document } from "mongoose";
import { model, models, Schema, Document,HydratedDocument } from "mongoose";

export interface IUser {
name: string;
Expand All @@ -11,7 +11,7 @@ export interface IUser {
reputation?: number;
}

export interface IUserDoc extends IUser, Document {}
export type IUserDoc = HydratedDocument<IUser>;
const UserSchema = new Schema<IUser>(
{
name: { type: String, required: true },
Expand Down
4 changes: 2 additions & 2 deletions database/vote.model.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -7,7 +7,7 @@ export interface IVote {
voteType: "upvote" | "downvote";
}

export interface IVoteDoc extends IVote, Document {}
export type IVoteDoc = HydratedDocument<IVote>;
const VoteSchema = new Schema<IVote>(
{
author: { type: Schema.Types.ObjectId, ref: "User", required: true },
Expand Down