AndrewL14 / Student-tracker-UI

Frontend portion of the Grader Web Application Ran in react (Currently only available in the dev mode)
0 stars 1 forks source link

Future Request, response, and endpoint fomats #20

Open AndrewL14 opened 1 month ago

AndrewL14 commented 1 month ago

Problem


In a future update in [Grader API]() The following changes will be made.

  1. Update Of Assignment data storage.
  2. Update of Student data storage.
  3. Implementation of Student Login and logout services.

You can view the full description in the Grader API issues tab.

For now, the UI should update its response and request logic to incorporate the new changes.

new request endpoints


Note: student login uses the same teacher login request body format.

{
  "AssignmentList": [
    {
      "subject": "string",
      "averageGrade": "number",
      "assignments": []
    }
  ]
}

Teacher login request and response bodies are the same.


Student Login Response information

endpoint:
  method: POST
  path: /student/login
  requestBody:
    type: EmailLoginRequest
    properties:
      email: string
      password: string
  responseBody:
    type: StudentLoginResponse
    properties:
      name: string
      jwt: string
      refreshToken: string
    status: OK

Assignments

All Assignment Request bodies should now contain an Integer period value in them.

AddStudentRequest Should now contain the teacher's subject


Students

EditStudentRequest body should now contain an Integer period value in them.

endpoint:
  method: POST
  path: /student/delete
  requestBody:
    type: DeleteStudentRequest
    properties:
      period: integer
      studentId: integer
  headers:
    Authentication: JWT token
  response: ""
  status: OK

Getting all students endpoint /teacher/all will return students in this format:

{
  "TeacherStudentList": {
    "publicStudentList": [
      [
        {
          "id": "integer",
          "name": "string",
          "assignments": {
            "subject": "string",
            "averageGrade": "number",
            "assignments": []
          }
        }
      ]
    ]
  },
  "PublicStudentDTO": {
    "id": "integer",
    "name": "string",
    "assignments": {
      "subject": "string",
      "averageGrade": "number",
      "assignments": []
    }
  }
}

Changes made to endpoint bodies (requests/responses)

New response bodies.

Sample PrivateStudentDTO

{
  "PrivateStudentDTO": {
    "name": "string",
    "assignments": {
      "integer_key": {
        "id": 0,
        "subject": "string",
        "period": 0,
        "averageGrade": 0.0,
        "assignments": [
          {
            "id": 0,
            "name": "string",
            "grade": 0.0,
            "completed": false,
            "overdue": false,
            "dueDate": "yyyy-MM-dd",
            "assignmentType": "string"
          }
        ],
        "student": {
          "id": 0,
          "name": "string"
        }
      }
    }
  }
}

PublicStudentDTO

{
  "PublicStudentDTO": {
    "id": 0,
    "name": "string",
    "period": 0,
    "assignments": {
      "id": 0,
      "subject": "string",
      "period": 0,
      "averageGrade": 0.0,
      "assignments": [
        {
          "id": 0,
          "name": "string",
          "grade": 0.0,
          "completed": false,
          "overdue": false,
          "dueDate": "yyyy-MM-dd",
          "assignmentType": "string",
          "assignmentList": {
            "id": 0,
            "subject": "string",
            "period": 0,
            "averageGrade": 0.0,
            "assignments": [],
            "student": {
              "id": 0,
              "name": "string"
            }
          }
        }
      ],
      "student": {
        "id": 0,
        "name": "string"
      }
    }
  }
}

TeacherStudentList

Note the integer_key being the period number.

{
  "TeacherStudentList": {
    "students": {
      "integer_key": [
        {
          "id": 0,
          "name": "string",
          "period": 0,
          "assignments": {
            "id": 0,
            "subject": "string",
            "period": 0,
            "averageGrade": 0.0,
            "assignments": [
              {
                "id": 0,
                "name": "string",
                "grade": 0.0,
                "completed": false,
                "overdue": false,
                "dueDate": "yyyy-MM-dd",
                "assignmentType": "string",
                "assignmentList": {
                  "id": 0,
                  "subject": "string",
                  "period": 0,
                  "averageGrade": 0.0,
                  "assignments": [],
                  "student": {
                    "id": 0,
                    "name": "string"
                  }
                }
              }
            ],
            "student": {
              "id": 0,
              "name": "string"
            }
          }
        }
      ]
    }
  }
}

Request body changes

Any Assignment request will now require an int period visit Assignment request for more information.

For AddStudent add a String subject value. EditStudent add an int period value. DeleteStudent now needs a request body containing the int period and Long studentId. visit Student Request for more information.

AndrewL14 commented 1 month ago

The AddStudentRequest should now also have a subject field.