Skip to content

A School Management API designed for NestJS studies. Developed using GraphQL, MongoDB and TypeORM.

License

Notifications You must be signed in to change notification settings

mauricioromagnollo/nestjs-graphql-school-management

Repository files navigation


A School Management API designed for NestJS studies. Developed using GraphQL, MongoDB and TypeORM.


Techs


Run

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


Available Queries

Create Lesson

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",
        }
      ]
    }
  }
}

Assign Students To Lesson

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"
        },
      ]
    }
  }
}

Get Lessons

query {
  lessons {
    name
  }
}
// Response

{
  "data": {
    "lessons": [
      {
        "name": "Math Class"
      },
      {
        "name": "NestJS Class"
      },
    ]
  }
}

Get Lesson

query {
  lesson(id: "e8af5d90-fa0e-4705-8ddd-4560bea8a3b4") {
    name
    startDate
  }
}
// Response

{
  "data": {
    "lesson": {
      "name": "Math Class",
      "startDate": "2022-04-02T04:00:00.079Z"
    }
  }
}

Create Student

mutation {
  createStudent(
    createStudentInput: {
      firstName: "John",
      lastName: "Doe"
    }
  ) {
    id
    firstName
    lastName
  }
}
// Response

{
  "data": {
    "createStudent": {
      "id": "0878ef35-5cde-49bc-9f7a-b6d75a3509f8",
      "firstName": "John",
      "lastName": "Doe"
    }
  }
}

Get Students

query {
  students {
    firstName
  }
}
// Response

{
  "data": {
    "students": [
      {
        "firstName": "John"
      },
      {
        "firstName": "Mary"
      }
    ]
  }
}

Get Student

query {
  student(id: "0878ef35-5cde-49bc-9f7a-b6d75a3509f8") {
    firstName
    lastName
  }
}
// Response

{
  "data": {
    "student": {
      "firstName": "John",
      "lastName": "Doe"
    }
  }
}

References

About

A School Management API designed for NestJS studies. Developed using GraphQL, MongoDB and TypeORM.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published