Skip to content

crossphoton/lab-management

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lab-management

This repo can be used to host a Lab Management System REST API. It can be used in schools/colleges/universities to ease the workflow.





User Management

The system uses authentication to do most of tasks.

Register a user

POST /users

Available to Public

JSON Payload

{
    username: your_username,
    password: your_password,
    name: your_name
}

Note: By default a new user is assigned the Student level permission. Admin can go to firebase dashboard to update permissions.

Return values

Success

Status 200

JWT token in body and as a cookie.

Example:

eyJ0eXAiOiJKV1QihbGciOiJIUzM4NCJ9.eyJyb2xlIjoiUk9MRV9URUFDSEVSIiwiaXNzIjoiY3Jvc3NwaG90b24iLCJ1c2VybmFtZSI6InRlZXIifQ.SxrsxYMv5kFBwOQ-xJTV0MYoSKYIq7l6Y2f-XNcfA4yrEkztF7gtuje4VTZ

Failiure

Error 404 : For already registered username

Error 500 : For server error


Login a user

GET /users

Available to Public

JSON Payload

{
    username: your_username,
    password: your_password
}

Return values

Success

Status 200

JWT token in body and as a cookie.

Example:

eyJ0eXAiOiJKV1QihbGciOiJIUzM4NCJ9.eyJyb2xlIjoiUk9MRV9URUFDSEVSIiwiaXNzIjoiY3Jvc3NwaG90b24iLCJ1c2VybmFtZSI6InRlZXIifQ.SxrsxYMv5kFBwOQ-xJTV0MYoSKYIq7l6Y2f-XNcfA4yrEkztF7gtuje4VTZ

Failiure

Error 404 : For not registered user

Error 405 : For wrong password

Error 500 : For server error


Logout a user

GET /users/logout

Available to Public

JSON Payload

none

Return values

Success

Status 200

Example: Logged out





Tasks Management

Tasks are created to evaluate students performance. Contains task details, total marks and students' individual marks.

Creating a task

POST /task

Available to Teachers, Admin

JSON Payload

{
    title: task_title,
    body: task_body,
    totalMarks: task_totalMarks
}

Return values

Success

Status 200

Failiure

Error 401 : For user not logged in

Error 403 : For action not allowed (User with student role trying to create a task)

Error 500 : For server error


Getting all tasks

GET /task

Available to Students, Teachers, Admin

JSON Payload

none

Return values

Success

Status 200

Example:

[
  {
    "g8tzCqmCV5sAv61VaZvp": {
      "owner": "admin",
      "title": "Complete DS work",
      "studentRecord": {
        "crossphoton": 0
      },
      "totalMarks": 100,
      "body": "Hello World"
    }
  },
  {
    "iGSmFtRwimU0FPNj04Bo": {
      "owner": "admin",
      "totalMarks": 100,
      "studentRecord": {
        "crossphoton": 10
      },
      "title": "Complete DS work"
    }
  },
  {
    "ynneZASQVeni3FxNTNzk": {
      "owner": "admin",
      "studentRecord": {
        "crossphoton": 0
      },
      "body": "Hello World",
      "totalMarks": 100,
      "title": "Complete DS work"
    }
  }
]

Failiure

Error 401 : For user not logged in

Error 500 : For server error


Getting a particular task

GET /task/{task_id}

Available to Students, Teachers, Admin

JSON Payload

none

Return values

Success

Status 200

Example:

{
    "ynneZASQVeni3FxNTNzk": {
      "owner": "admin",
      "studentRecord": {
        "crossphoton": 0
      },
      "body": "Hello World",
      "totalMarks": 100,
      "title": "Complete DS work"
    }
}

Failiure

Error 401 : For user not logged in

Error 500 : For server error


Deleting a task

DELETE /task/{task_id}

Available to Teachers, Admin

JSON Payload

none

Return values

Success

Status 200

Failiure

Error 403 : For action not allowed (User with student role trying to create a task)

Error 500 : For server error





Notice Management

Notices can be used by teachers to give updates to students for a given task.


Creating an notice

POST /task/{task_id}/notice

Available to Teachers, Admin

JSON Payload

{
    title: notice_title,
    body: notice_body
}

Return values

Success

Status 200

Failiure

Error 401 : For user not logged in

Error 403 : For action not allowed (User with student role trying to create a task)

Error 500 : For server error


Getting all notices

GET /task/{task_id}/notice

Available to Students, Teachers, Admin

JSON Payload

none

Return values

Success

Status 200

Example:

[
  {
    "0bn1CarJZXfIwnS31mCK": {
      "owner": "teacher",
      "body": "slngslrk",
      "title": "sjj"
    }
  },
  {
    "wlKMbHoA4jYZ6jHRzzya": {
      "owner": "teacher",
      "body": "sljblrbbil",
      "title": "Project sjj"
    }
  }
]

Failiure

Error 401 : For user not logged in

Error 500 : For server error


Getting a particular notice

GET /task/{task_id}/notice/{notice_id}

Available to Students, Teachers, Admin

JSON Payload

none

Return values

Success

Status 200

Example:

{
    "wlKMbHoA4jYZ6jHRzzya": {
        "owner": "teacher",
        "body": "sljblrbbil",
        "title": "Project sjj"
    }
}

Failiure

Error 401 : For user not logged in

Error 500 : For server error


Deleting a notice

DELETE /task/{task_id}/notice/{notice_id}

Available to Teachers, Admin

JSON Payload

none

Return values

Success

Status 200

Failiure

Error 403 : For action not allowed (User with student role trying to create a task)

Error 500 : For server error





Marks Management

These endpoints can be used by a teacher to update marks of students.


Updating marks of a student

POST /task/{task_id}/updateMarks

Available to Teachers, Admin

JSON Payload

{
    username: student_username,
    marks: marks_to_be_alloted
}

Return values

Success

Status 200

Failiure

Error 401 : For user not logged in

Error 403 : For action not allowed (User with student role trying to create a task)

Error 500 : For server error





Announcements Management

Announcements can be used to give updates to students aside from tasks.

Creating an announcement

POST /announcement

Available to Teachers, Admin

JSON Payload

{
    title: task_title,
    body: task_body
}

Return values

Success

Status 200

Failiure

Error 401 : For user not logged in

Error 403 : For action not allowed (User with student role trying to create a task)

Error 500 : For server error

Getting all anouncements

GET /announcement

Available to Students, Teachers, Admin

JSON Payload

none

Return values

Success

Status 200

Example:

[
  {
    "ivIRncyMa3GxueAXkfTw": {
      "owner": "abc",
      "title": "sglba",
      "body": "sgljblisbliblibt."
    }
  },
  {
    "wIUbf4b8VIQEZ1XNBjsu": {
      "owner": "abc",
      "body": "Test loren ipsum",
      "title": "Test announcement 2"
    }
  }
]

Failiure

Error 401 : For user not logged in

Error 500 : For server error

Getting particular anouncement

GET /announcement/{announcement_id}

Available to Students, Teachers, Admin

JSON Payload

none

Return values

Success

Status 200

Example:

{
"wIUbf4b8VIQEZ1XNBjsu": {
    "owner": "abc",
    "body": "Test loren ipsum",
    "title": "Test announcement 2"
    }
}

Failiure

Error 401 : For user not logged in

Error 500 : For server error


Deleting an announcement

DELETE /announcement/{announcement_id}

Available to Teachers, Admin

JSON Payload

none

Return values

Success

Status 200

Failiure

Error 403 : For action not allowed (User with student role trying to create a task)

Error 500 : For server error