Skip to content

Commit

Permalink
refactor: update models (schemas)
Browse files Browse the repository at this point in the history
  • Loading branch information
HereEast committed Jan 28, 2025
1 parent 9001615 commit 7061d93
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
7 changes: 4 additions & 3 deletions src/models/Answer.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import mongoose, { Schema, model } from "mongoose";
import mongoose, { Schema, Document, model } from "mongoose";

import { IQuestion } from "./Question";
import { IPerson } from "./Person";

export interface IAnswer extends Document {
personId: mongoose.Types.ObjectId;
questionId: IQuestion;
personId: mongoose.Types.ObjectId | IPerson;
questionId: mongoose.Types.ObjectId | IQuestion;
name: string;
question: string;
answer: string;
Expand Down
4 changes: 2 additions & 2 deletions src/models/Person.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import mongoose, { Schema, model, Document } from "mongoose";
import mongoose, { Schema, Document, model } from "mongoose";

export interface IPerson extends Document {
name: string;
Expand Down Expand Up @@ -48,9 +48,9 @@ const PersonSchema = new Schema(
jobTitle: { type: String, required: true },
country: { type: String, required: true },
links: { type: LinksSchema },
slug: { type: String, required: true, unique: true },
keyWords: { type: [String] },
isActive: { type: Boolean, required: true },
slug: { type: String, required: true, unique: true },
},
{ timestamps: true },
);
Expand Down
2 changes: 1 addition & 1 deletion src/models/Question.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import mongoose, { Schema, model, Document } from "mongoose";
import mongoose, { Schema, Document, model } from "mongoose";

export interface IQuestion extends Document {
body: string;
Expand Down

0 comments on commit 7061d93

Please sign in to comment.