This repository was archived by the owner on Aug 1, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +30
-1
lines changed Expand file tree Collapse file tree 3 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -23,11 +23,18 @@ export default async ({ expressApp }) => {
23
23
model : require ( '../models/user' ) . default ,
24
24
} ;
25
25
26
+ const candidateModel = {
27
+ name : 'userModel' ,
28
+ // Notice the require syntax and the '.default'
29
+ model : require ( '../models/candidate' ) . default ,
30
+ } ;
31
+
26
32
// It returns the agenda instance because it's needed in the subsequent loaders
27
33
await dependencyInjectorLoader ( {
28
34
mongoConnection,
29
35
models : [
30
36
userModel ,
37
+ candidateModel ,
31
38
// salaryModel,
32
39
// whateverModel
33
40
] ,
Original file line number Diff line number Diff line change
1
+ import { IUser } from '../interfaces/IUser' ;
2
+ import mongoose from 'mongoose' ;
3
+
4
+ const Candidate = new mongoose . Schema (
5
+ {
6
+ name : {
7
+ type : String ,
8
+ required : [ true , 'Please enter a full name' ] ,
9
+ index : true ,
10
+ } ,
11
+
12
+ voteCount : {
13
+ type : Number ,
14
+ default : 0 ,
15
+ } ,
16
+ } ,
17
+ { timestamps : true } ,
18
+ ) ;
19
+
20
+ export default mongoose . model < IUser & mongoose . Document > ( 'Candidate' , Candidate ) ;
Original file line number Diff line number Diff line change 1
1
import { Model , Document } from 'mongoose' ;
2
- import { IUser } from '../interfaces/IUser ' ;
2
+ import { IUser , ICandidate } from '../interfaces' ;
3
3
4
4
export type UserModel = Model < IUser & Document > ;
5
+
6
+ export type CandidateModel = Model < ICandidate & Document > ;
You can’t perform that action at this time.
0 commit comments