forked from hiteshchoudhary/lco-graphql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathresolvers.js
More file actions
33 lines (27 loc) · 699 Bytes
/
resolvers.js
File metadata and controls
33 lines (27 loc) · 699 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { nanoid } from "nanoid";
class Course {
constructor(id, {
courseName,category,price,language,email,stack,teachingAssists
}) {
this.id = id;
this.courseName = courseName;
this.category = category;
this.price = price;
this.language = language;
this.email = email;
this.stack = stack;
this.teachingAssists = teachingAssists;
}
}
const courseholder={}
const resolvers={
getCourse:({id})=>{
return new Course(id, courseholder[id]);
},
createCourse:({input})=>{
let id= nanoid();
courseholder[id]=input;
return new Course(id, input);
}
}
export default resolvers;