A School Management API designed for NestJS studies. Developed using GraphQL, MongoDB and TypeORM.
- Install Docker and Docker Compose;
- Run with Docker:
docker-compose --env-file ./.env.dev up --build -d
If you have nodejs installed with version +16.x, you can also run it using the command:
npm run dev
After running, you can access the Graphql Playground. http://localhost:3000/graphql
mutation {
createLesson(
createLessonInput: {
name: "Math Class",
startDate: "2022-04-02T04:00:00.079Z",
endDate: "2022-04-02T05:00:00.079Z",
students: [
"0878ef35-5cde-49bc-9f7a-b6d75a3509f8",
"0878ef35-5cde-49bc-9f7a-b6d75a3509f8"
]
}
) {
id
name
startDate
endDate
students {
firstName
lastName
}
}
}
// Response
{
"data": {
"createLesson": {
"id": "e8af5d90-fa0e-4705-8ddd-4560bea8a3b4",
"name": "Math Class",
"startDate": "2022-04-02T04:00:00.079Z",
"endDate": "2022-04-02T05:00:00.079Z",
"students": [
{
"firstName": "John",
"lastName": "Doe",
},
{
"firstName": "Mary",
"lastName": "Jane",
}
]
}
}
}
mutation {
assignStudentsToLesson(
assignStudentsToLessonInput: {
lessonId: "e8af5d90-fa0e-4705-8ddd-4560bea8a3b4",
studentsId: [
"0878ef35-5cde-49bc-9f7a-b6d75a3509f8",
"0878ef35-5cde-49bc-9f7a-b6d75a3509f8"
]
}
) {
name
students {
firstName
}
}
}
// Response
{
"data": {
"assignStudentsToLesson": {
"name": "Math Class",
"students": [
{
"firstName": "John"
},
{
"firstName": "Mary"
},
]
}
}
}
query {
lessons {
name
}
}
// Response
{
"data": {
"lessons": [
{
"name": "Math Class"
},
{
"name": "NestJS Class"
},
]
}
}
query {
lesson(id: "e8af5d90-fa0e-4705-8ddd-4560bea8a3b4") {
name
startDate
}
}
// Response
{
"data": {
"lesson": {
"name": "Math Class",
"startDate": "2022-04-02T04:00:00.079Z"
}
}
}
mutation {
createStudent(
createStudentInput: {
firstName: "John",
lastName: "Doe"
}
) {
id
firstName
lastName
}
}
// Response
{
"data": {
"createStudent": {
"id": "0878ef35-5cde-49bc-9f7a-b6d75a3509f8",
"firstName": "John",
"lastName": "Doe"
}
}
}
query {
students {
firstName
}
}
// Response
{
"data": {
"students": [
{
"firstName": "John"
},
{
"firstName": "Mary"
}
]
}
}
query {
student(id: "0878ef35-5cde-49bc-9f7a-b6d75a3509f8") {
firstName
lastName
}
}
// Response
{
"data": {
"student": {
"firstName": "John",
"lastName": "Doe"
}
}
}