Skip to content

Commit ed50ee0

Browse files
committed
uso apollo client
1 parent 11dace4 commit ed50ee0

15 files changed

Lines changed: 435 additions & 257 deletions

File tree

models/Curriculum.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import mongoose from 'mongoose';
22
import { CurriculumSchema } from './CurriculumExam';
33

4-
const Curriculum = mongoose.model('Curriculum', CurriculumSchema);
4+
const Curriculum = mongoose.models.Curriculum || mongoose.model('Curriculum', CurriculumSchema);
55

66
export default Curriculum;

models/Degree.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,6 @@ const DegreeSchema = new mongoose.Schema<IDegree>({
9696
},
9797
});
9898

99-
const Degree = mongoose.model<IDegree>('Degree', DegreeSchema);
99+
const Degree = mongoose.models.Degree || mongoose.model<IDegree>('Degree', DegreeSchema);
100100

101101
export default Degree;

models/Exam.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@ const ExamSchema = new mongoose.Schema<IExam>({
4747
},
4848
});
4949

50-
const Exam = mongoose.model<IExam>('Exam', ExamSchema);
50+
const Exam = mongoose.models.Exam || mongoose.model<IExam>('Exam', ExamSchema);
5151

5252
export default Exam;

models/Proposal.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import mongoose from 'mongoose';
22
import { ProposalSchema } from './ProposalSchema';
33

4-
const Proposal = mongoose.model('Proposal', ProposalSchema);
4+
const Proposal = mongoose.models.Proposal || mongoose.model('Proposal', ProposalSchema);
55

66
export default Proposal;

models/User.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,6 @@ const userSchema = new mongoose.Schema<IUser>({
4545

4646
userSchema.plugin(passportLocalMongoose);
4747

48-
const User = mongoose.model<IUser>('User', userSchema);
48+
const User = mongoose.models.User || mongoose.model<IUser>('User', userSchema);
4949

5050
export default User;

package-lock.json

Lines changed: 189 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"lint": "eslint"
1010
},
1111
"dependencies": {
12+
"@apollo/client": "^4.0.9",
1213
"@fortawesome/fontawesome-free": "^7.1.0",
1314
"@types/bcrypt": "^6.0.0",
1415
"@types/passport-local-mongoose": "^6.1.5",

src/app/api/graphql/route.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,4 +187,10 @@ const { handleRequest } = createYoga({
187187
fetchAPI: globalThis,
188188
});
189189

190-
export { handleRequest as GET, handleRequest as POST };
190+
export async function GET(request: Request) {
191+
return handleRequest(request, {});
192+
}
193+
194+
export async function POST(request: Request) {
195+
return handleRequest(request, {});
196+
}

0 commit comments

Comments
 (0)