...
- [] - Homepage
- - Login
- - Register
Falta fazer a parte de atualizar a navbar
- Profile
- Schedule
- [] Results
- [] Notifications
Falta testar em caso de erro
Depois do save apagar a password
-
[] Classes
-
[] GroupView
-
[] Group Create
-
[] Questions Create
-
[] Questions View
-
[] Class Results
-
[] Exam Create
-
[] Exam View Details
-
[] Exam Resolve (make submission)
-
[] Exam Submission Result (Student)(Teacher)
-
[] Exam Submissions Results (Teacher)
-
DashBoard
Refresh - need someones changes
Remove and Edit Group
Many Groups problems with page_content_onresize();
- Schedule
Maybe change colors
- Create Group
Need Tests
- Create Question
Need Tests
./docker_build.sh
./docker_run.sh
Após fazer login e receber o token, deve ser enviado no cabeçalho HTTP:
Authorization = "Bearer TOKEN"
O servidor pode responder a qualquer pedido (excepto de autenticação) com um código HTTP UNAUTHORIZED (401), caso o token seja inválido ou tenha expirado.
{
"message": "Invalid token"
}
{
"message": "Token expired"
}
- POST /auth/login [x]
- POST /auth/signup [x]
- GET /api/classes/{class_id} [x]
- PUT /api/classes/{class_id}
- DELETE /api/classes/{class_id}
- GET /api/classes/{class_id}/questions [x]
- POST /api/classes/{class_id}/questions [x]
- GET /api/classes/{class_id}/categories [x]
- GET /api/classes/{class_id}/groups [x]
- POST /api/classes/{class_id}/groups [x]
- GET /api/questions/{question_id}
- PUT /api/questions/{question_id}
- DELETE /api/questions/{question_id}
- GET /api/groups/{group_id} [x]
- PUT /api/groups/{group_id}
- DELETE /api/groups/{group_id}
- GET /api/groups/{group_id}/students [x]
- POST /api/groups/{group_id}/students [x]
- DELETE /api/groups/{group_id}/students/{student_id} [x]
- GET /api/groups/{group_id}/questions/available
- GET /api/groups/{group_id}/exams
- POST /api/groups/{group_id}/exams
- POST /api/groups/{group_id}/exams/generate
- POST /api/groups/{group_id}/exams/generate/question
- GET /api/groups/{group_id}/scores
- GET /api/exams/{exam_id}
- DELETE /api/exams/{exam_id}
- PUT /api/exams/{exam_id}
- GET /api/exams/{exam_id}/scores
- POST /api/exams/{exam_id}/submission
- GET /api/submissions/{submission_id}
- PUT /api/submissions/{submission_id}
- DELETE /api/submissions/{submission_id}
- GET /api/users/{user_id} [x]
- PUT /api/users/{user_id}
- DELETE /api/users/{user_id}
- POST /api/users/{user_id}/classes [x]
- GET /api/users/{user_id}/classes
- GET /api/users/{user_id}/groups
- DELETE /api/users/{user_id}/groups/{group_id}
- GET /api/users/{user_id}/notifications [x]
- GET /api/users/{user_id}/submissions
- GET /api/users/{user_id}/exams
- GET /api/users/{user_id}/scores
- POST /api/invitations/{invitation_id}/accept [x]
- POST /api/invitations/{invitation_id}/decline [x]
{
"email": "email1@email.com",
"password": "password"
}
{
"token": "header.body.signature",
"user":{
"email": "email1@email.com",
"firstName": "Foo",
"lastName": "Bar",
"type": "Student | Teacher",
"active": true,
"id": 1
}
}
- OK (200)
- INTERNAL_SERVER_ERROR (500)
- UNAUTHORIZED (401) - Invalid authentication, or Unconfirmed email
{
"email": "email1@email.com",
"password": "password",
"firstName": "Foo",
"lastName": "Bar",
"type": "Student | Teacher"
}
{
"email": "email1@email.com",
"firstName": "Foo",
"lastName": "Bar",
"type": "Student | Teacher",
"active": true,
"id": 1
}
- OK (200)
- INTERNAL_SERVER_ERROR (500)
- NOT_ACCEPTABLE (406) - Missing information, Email already in use, Invalid user type
{
"id": 1,
"abbreviation": "AA",
"name": "Arquiteturas Aplicacionais",
"teacher": {
"email": "email1@email.com",
"firstName": "Foo",
"lastName": "Bar",
"type": "Student | Teacher",
"active": true,
"id": 1
}
}
- OK (200)
- INTERNAL_SERVER_ERROR (500)
- NOT_FOUND (404) - No such class
{
"name": "Name1",
"abbreviation": "Abbreviation1"
}
[
{
"name": "Name1",
"abbreviation": "Abbreviation11",
"id": 1
}
]
- OK (200)
- INTERNAL_SERVER_ERROR (500)
- NOT_FOUND (404) - No such class
- NOT_ACCEPTABLE (406) - Class already exists
- OK (200)
- INTERNAL_SERVER_ERROR (500)
- UNAUTHORIZED (401)
- NOT_FOUND (404) - No such class
- NOT_ACCEPTABLE (406) - Class cannot be removed
[
{
"id": 1,
"text": "Enunciado pergunta 1",
"category": "Category 1",
"difficulty": 1,
"answers": [
{
"id": 1,
"text": "Alternativa 1",
"correct": false,
"order": 0
},
{
"id": 2,
"text": "Alternativa 2",
"correct": true,
"order": 1
},
{
"id": 3,
"text": "Alternativa 3",
"correct": true,
"order": 2
}
]
}
]
- OK (200)
- INTERNAL_SERVER_ERROR (500)
- NOT_FOUND (404) - No such class
- UNAUTHORIZED (401) - No permission
{
"text": "Enunciado pergunta 1",
"category": "Category 1",
"difficulty": 1,
"answers": [
{
"text": "Alternativa 1",
"correct": false
},
{
"text": "Alternativa 2",
"correct": true
},
{
"text": "Alternativa 3",
"correct": false
}
]
}
{
"id": 1,
"text": "Enunciado pergunta 1",
"category": "Category 1",
"difficulty": 1,
"answers": [
{
"id": 1,
"text": "Alternativa 1",
"correct": false,
"order": 0,
},
{
"id": 2,
"text": "Alternativa 2",
"correct": false,
"order": 1,
},
{
"id": 3,
"text": "Alternativa 3",
"correct": true,
"order": 2,
}
]
}
- OK (200)
- INTERNAL_SERVER_ERROR (500)
- NOT_FOUND (404) - No such class
- UNAUTHORIZED (401) - No permission
- NOT_ACCEPTABLE (406) - Invalid question, Question already exists
[
"Category1",
"Category2"
]
- OK (200)
- INTERNAL_SERVER_ERROR (500)
- NOT_FOUND (404) - No such class
- UNAUTHORIZED (401) - No permission
[
{
"name": "class1",
"id": 1
},
{
"name": "class2",
"id": 2
}
]
- OK (200)
- INTERNAL_SERVER_ERROR (500)
- NOT_FOUND (404) - No such class
{
"name": "Turma 16/17"
}
{
"name": "Turma 16/17",
"_class": {
"name": "Arquiteturas Aplicacionais",
"abbreviation": "AA",
"teacher": {
"email": "teacher@teacher",
"firstName": "John",
"lastName": "Doe",
"type": "Teacher",
"active": true,
"id": 1
},
"id": 1
},
"id": 1
}
- OK (200)
- INTERNAL_SERVER_ERROR (500)
- NOT_FOUND (404) - No such class
- NOT_ACCEPTABLE (406) - Group already exists
- UNAUTHORIZED (401) - No permission
"id": 6,
"text": "Solve for x: 5 + x = 9",
"category": "Category1",
"difficulty": 3,
"answers": [
{
"id": 24,
"text": "6",
"correct": false,
"order": 0
},
{
"..."
}
]
- OK (200)
- INTERNAL_SERVER_ERROR (500)
- NOT_FOUND (404) - No such question
- UNAUTHORIZED (401) - No permission
Não é possível atualizar uma questão que esteja inserida num exame. Caso contrário, pode ser alterado qualquer um dos atributos text, category, difficulty ou answers.
{
"text": "Which is pi?",
"category": "Category2",
"difficulty": 1,
"answers": [
{
"text": "pi",
"correct": true
},
{
"text": "2*pi",
"correct": false
}
]
}
{
"id": 1,
"text": "Which is pi?",
"category": "Category2",
"difficulty": 1,
"answers": [
{
"id": 3603,
"text": "pi",
"correct": true,
"order": 0
},
{
"id": 3604,
"text": "2*pi",
"correct": false,
"order": 1
}
]
}
- OK (200)
- INTERNAL_SERVER_ERROR (500)
- NOT_FOUND (404) - No such question
- UNAUTHORIZED (401) - No permission
- NOT_ACCEPTABLE (406) - Question in use, Question exists, Invalid question
A questão só pode ser removida se não pertencer a nenhum exame.
- OK (200)
- INTERNAL_SERVER_ERROR (500)
- NOT_FOUND (404) - No such question
- UNAUTHORIZED (401) - No permission
- NOT_ACCEPTABLE (406) - Question cannot be removed
{
"name": "Name2",
"_class": {
"name": "Name1",
"abbreviation": "Abbreviation1",
"teacher": {
"email": "email2",
"firstName": "firstName2",
"lastName": "lastName2",
"type": "Teacher",
"active": true,
"id": 2
},
"id": 1
},
"id": 2
}
- OK (200)
- INTERNAL_SERVER_ERROR (500)
- NOT_FOUND (404) - No such group
{
"name": "Name1"
}
{
"id": 1,
"name": "Name1",
"_class": {
"name": "Name1",
"abbreviation": "Abbreviation1",
"teacher": {
"id": 16,
"email": "email16",
"firstName": "firstName16",
"lastName": "lastName16",
"type": "Teacher",
"active": true
},
"id": 1
}
}
- OK (200)
- INTERNAL_SERVER_ERROR (500)
- NOT_FOUND (404)
- UNAUTHORIZED (401) - No permission
- NOT_ACCEPTABLE (406) - Group already exists
Apaga um grupo apenas se este não tiver nenhuma submissão em algum dos seus exames.
- OK (200)
- INTERNAL_SERVER_ERROR (500)
- NOT_FOUND (404)
- UNAUTHORIZED (401) - No permission
- NOT_ACCEPTABLE (406) - Group cannot be removed
[
{
"accepted": false,
"user": {
"email": "email999",
"firstName": "ND",
"lastName": "ND",
"type": "Student",
"active": false,
"id": 21
}
},
{
"accepted": false,
"user": {
"email": "email1",
"firstName": "firstName1",
"lastName": "lastName1",
"type": "Student",
"active": true,
"id": 1
}
}
]
- OK (200)
- INTERNAL_SERVER_ERROR (500)
- NOT_FOUND (404)
[
"email1@email.com",
"email2@email.com"
]
[
{
"email": "email1@email.com",
"user": {
"email": "email1@email.com",
"firstName": "John",
"lastName": "Doe",
"type": "Student",
"active": true,
"id": 1
}
}
{
"email": "email2@email.com",
"message": "User is a teacher | Student has already been added to the group"
}
]
Nota: Os utilizadores, mesmo que não existam, são adicionados. Nestes casos, a variável "active" toma o valor falso.
- OK (200)
- INTERNAL_SERVER_ERROR (500)
- UNAUTHORIZED (401)
- NOT FOUND (404)
Remove um estudante de um grupo apenas se este ainda não tiver feita nenhuma submissão de um exame.
- OK (200)
- INTERNAL_SERVER_ERROR (500)
- NOT_FOUND (404) - No such group, No such student
Este método devolve as perguntas disponíveis para um dado grupo, organizadas por categoria e dificuldade. Não são necessariamente as mesmas perguntas associadas à disciplina porque algumas dessas podem já ter sido utilizadas num exame anterior do grupo em questão.
{
"Category1": {
"1": {
"available": 1,
"questionIDs": [
1,
]
},
"3": {
"available": 3,
"questionIDs": [
6,
21,
36
]
}
},
"Category2": {
"1": {
"available": 2,
"questionIDs": [
22,
37
]
}
}
}
- OK (200)
- INTERNAL_SERVER_ERROR (500)
- NOT_FOUND (404) - No such group
- UNAUTHORIZED (401) - No permission
- ongoing: Faz com que seja retornada apenas uma lista dos exames a decorrer.
{
"exams": {
"History": [
{
"id": 1,
"name": "Exam 1",
"beginDate": 1498908500000,
"duration": 90,
}
],
"Ongoing": [
{
"..."
}
],
"Upcoming": [
{
"..."
}
],
}
}
- OK (200)
- INTERNAL_SERVER_ERROR (500)
- NOT_FOUND (404) - No such group
- UNAUTHORIZED (401) - No permission
{
"beginDate": "1498908600000",
"duration": 60,
"name": "Exam 1",
"questionIDs": [
31, 7, 11, 6
]
}
{
"id": 4,
"name": "Exam 4",
"beginDate": 1498908600000,
"duration": 60,
"questions": [
{
"id": 6,
"text": "Solve for x: 5 + x = 9",
"category": "Category1",
"difficulty": 3,
"answers": [
{
"id": 24,
"text": "6",
"correct": false,
"order": 0
},
{
"..."
}
],
"score": 5,
"order": 0
},
{
"..."
}
]
}
- OK (200)
- INTERNAL_SERVER_ERROR (500)
- NOT_FOUND (404) - No such group
- UNAUTHORIZED (401) - No permission
- NOT_ACCEPTABLE (406) - Invalid name, Invalid duration, Invalid date, Duplicate questions, Invalid exam, Invalid question (id ID)
[
{
"category": "Category1",
"difficulty": 1
},
{
"category": "Category2",
"difficulty": 3
}
]
[
{
"id": 31,
"text": "Solve for x: 30 + x = 34",
"category": "Category1",
"difficulty": 1,
"answers": [
{
"id": 121,
"text": "31",
"correct": false,
"order": 0,
},
{
"id": 122,
"text": "34",
"correct": true,
"order": 1,
}
{
"id": 123,
"text": "32",
"correct": false,
"order": 2,
},
{
"id": 124,
"text": "33",
"correct": false,
"order": 3,
},
]
},
{
"..."
}
]
- OK (200)
- INTERNAL_SERVER_ERROR (500)
- NOT_FOUND (404) - No such group
- UNAUTHORIZED (401) - No permission
- NOT_ACCEPTABLE (406) - Invalid questions, Insufficient questions
Gera uma única questão para um exame.
No campo excluded devem ir os IDs de perguntas a não considerar.
{
"category": "Category1",
"difficulty": 1,
"excluded": [1,16]
}
{
"id": 31,
"text": "Solve for x: 30 + x = 34",
"category": "Category1",
"difficulty": 1,
"answers": [
{
"id": 122,
"text": "31",
"correct": false,
"order": 0
},
{
"..."
}
]
}
- OK (200)
- INTERNAL_SERVER_ERROR (500)
- NOT_FOUND (404) - No such group
- UNAUTHORIZED (401) - No permission
- NOT_ACCEPTABLE (406) - No such question, Insufficient questions
O campo submissionID pode não existir, caso o aluno não tenha feita uma submissão. Neste caso, o score é 0.
{
"students": [
{
"student": {
"user info..."
},
"exams":[
{
"exam":{
"exam info..."
},
"score": {
"score": 20,
"submissionID": 1
}
}
]
},
]
}
- OK (200)
- INTERNAL_SERVER_ERROR (500)
- NOT_FOUND (404) - No such exam
- UNAUTHORIZED (401) - No permission
Se o utilizador for um aluno e o exame ainda não tiver começado, este método retorna apenas as informações do exame sem as questões; se o exame já tiver começado, então retorna também as perguntas mas sem a indicação de qual a resposta certa.
{
"id": 7,
"name": "Exam 7",
"beginDate": 1498908600000,
"duration": 60,
"questions": [
{
"id": 31,
"text": "Solve for x: 30 + x = 34",
"category": "Category1",
"difficulty": 1,
"answers": [
{
"id": 123,
"text": "31",
"correct": false,
"order": 0
},
{
"..."
}
],
"score": 5,
"order": 0
},
{
"..."
}
]
}
- OK (200)
- INTERNAL_SERVER_ERROR (500)
- NOT_FOUND (404) - No such exam
- UNAUTHORIZED (401) - No permission
Apaga um exame apenas se ainda não tiver sido feita nenhuma submissão.
- OK (200)
- INTERNAL_SERVER_ERROR (500)
- NOT_FOUND (404) - No such exam
- UNAUTHORIZED (401) - No permission
- NOT_ACCEPTABLE (406) - Exam cannot be removed
{
"name": "Exam 1",
"beginDate": 1498908600000,
"duration": 10
}
{
"id": 1,
"name": "Exam 1",
"beginDate": 1498908600000,
"duration": 10
}
- OK (200)
- INTERNAL_SERVER_ERROR (500)
- UNAUTHORIZED (401) - No permission
- NOT_ACCEPTABLE (406) - Exam already exists
O campo submissionID pode não existir, caso o aluno não tenha feita uma submissão. Neste caso, o score é 0.
{
"students": [
{
"student": {
"user info..."
},
"score": {
"score": 20,
"submissionID": 1
}
},
]
}
- OK (200)
- INTERNAL_SERVER_ERROR (500)
- NOT_FOUND (404) - No such exam
- UNAUTHORIZED (401) - No permission
- NOT_ACCEPTABLE (406) - Invalid exam
Mapeamento pergunta: resposta (IDs)
{
"1": 4,
"2": 5
}
São retornadas todas as questões do exame, com a respetiva resposta do estudante. Caso este não dê uma resposta a alguma questão, então o campo "answer" não aparece.
{
"id": 5,
"questions": [
{
"question": {
"id": 1,
"text": "Solve for x: 0 + x = 4",
"category": "Category1",
"difficulty": 1,
"answers": [
{
"id": 1,
"text": "1",
"order": 0
},
{
"..."
}
],
"score": 3.3333333,
"order": 0
},
"answer": {
"id": 4,
"text": "4",
"order": 3
}
},
]
}
- OK (200)
- INTERNAL_SERVER_ERROR (500)
- NOT_FOUND (404) - No such exam
- UNAUTHORIZED (401) - No permission
- NOT_ACCEPTABLE (406) - Existent submission, Invalid answer, Invalid question
Se o aluno não tiver respondido a alguma questão, o campo answer não aparece. Se o exame já tiver terminado, então também é indicado se as respostas estão certas ou não.
{
"id": 1,
"questions": [
{
"question": {
"id": 1,
"text": "Solve for x: 1 + x = 5",
"category": "Category1",
"difficulty": 2,
"answers": [
"answers..."
],
"score": 3.3333333,
"order": 1
},
"answer": {
"id": 4,
"text": "1",
"correct": false,
"order": 0
}
},
]
}
- OK (200)
- INTERNAL_SERVER_ERROR (500)
- NOT_FOUND (404) - No such submissions
Este método altera ou acrescenta novas respostas a uma submissão já existente. O funcionamento é igual a POST /api/exams/{exam_id}/submission
- OK (200)
- INTERNAL_SERVER_ERROR (500)
- NOT_FOUND (404) - No such submissions
- UNAUTHORIZED (401) - No permission
{
"email": "email1@email.com",
"firstName": "Foo",
"lastName": "Bar",
"type": "Student | Teacher",
"active": true,
"id": 1
}
- OK (200)
- INTERNAL_SERVER_ERROR (500)
- NOT_FOUND (404) - No such user
{
"firstName": "John",
"lastName": "Doe",
"password": "password"
}
{
"id": 1,
"email": "email1",
"firstName": "John",
"lastName": "Doe",
"type": "Student",
"active": true
}
- OK (200)
- INTERNAL_SERVER_ERROR (500)
- UNAUTHORIZED (401)
- NOT_FOUND (404) - No such user
- OK (200)
- INTERNAL_SERVER_ERROR (500)
- NOT_FOUND (404) - No such user
- UNAUTHORIZED (401) - No permission
{
"name": "class1",
"abbreviation": "cl1",
}
{
"name": "class1",
"abbreviation": "cl1",
"id": 1
}
- OK (200)
- INTERNAL_SERVER_ERROR (500)
- NOT_FOUND (404) - No such teacher
- NOT_ACCEPTABLE (406) - Missing information, Class already exists
Caso o utilizador seja um professor, nao e enviado o professor.
[
{
"name": "Name1",
"abbreviation": "Abbreviation1",
"id": 1,
"teacher": {
"id": 16,
"email": "email16",
"firstName": "firstName16",
"lastName": "lastName16",
"type": "Teacher",
"active": true
},
}
]
- OK (200)
- INTERNAL_SERVER_ERROR (500)
- NOT_FOUND (404) - No such user
[
{
"id": 1,
"name": "Name1",
"_class": {
"name": "Name1",
"abbreviation": "Abbreviation1",
"teacher": {
"id": 16,
"email": "email16",
"firstName": "firstName16",
"lastName": "lastName16",
"type": "Teacher",
"active": true
},
"id": 1
}
},
]
- OK (200)
- INTERNAL_SERVER_ERROR (500)
- NOT_FOUND (404) - No such user
- OK (200)
- INTERNAL_SERVER_ERROR (500)
- UNAUTHORIZED (401) - No permission
- NOT_FOUND (404) - No such user, No such group
[
{
"type": "Group invitation",
"group": {
"name": "Name1",
"_class": {
"name": "Name1",
"abbreviation": "Abbreviation1",
"teacher": {
"email": "email16",
"firstName": "firstName16",
"lastName": "lastName16",
"type": "Teacher",
"active": true,
"id": 16
},
"id": 1
},
"id": 1
},
"id": 0
}
]
- OK (200)
- INTERNAL_SERVER_ERROR (500)
- NOT_FOUND (404)
- UNAUTHORIZED (401)
- exam=ID
- group=ID
[
{
"id": 5,
"exam": {
"id": 1,
"name": "Exam 8",
"beginDate": 1498908600000,
"duration": 60,
"group": {
"id": 1,
"name": "Name1",
"_class": {
"name": "Name1",
"abbreviation": "Abbreviation1",
"teacher": {
"id": 16,
"email": "email16",
"firstName": "firstName16",
"lastName": "lastName16",
"type": "Teacher",
"active": true
},
"id": 1
}
}
}
}
]
- OK (200)
- INTERNAL_SERVER_ERROR (500)
- NOT_FOUND (404) - No such student
- UNAUTHORIZED (401)
- NOT_ACCEPTABLE (406) - Invalid group, Invalid exam
- ongoing: Faz com que seja retornada apenas uma lista dos exames a decorrer.
{
"exams": {
"History": [
{
"id": 1,
"name": "Exam 1",
"beginDate": 1498908500000,
"duration": 90,
"group": {
"id": 1,
"name": "Name1",
"_class": {
"name": "Name1",
"abbreviation": "Abbreviation1",
"teacher": {
"id": 16,
"email": "email16",
"firstName": "firstName16",
"lastName": "lastName16",
"type": "Teacher",
"active": true
},
"id": 1
}
}
}
],
"Ongoing": [
{
"..."
}
],
"Upcoming": [
{
"..."
}
],
}
}
- OK (200)
- INTERNAL_SERVER_ERROR (500)
- NOT_FOUND (404)
- UNAUTHORIZED (401)
- exam=ID
- group=ID
A resposta abaixo é enviada quando não é passado nenhum parâmetro. Caso seja passado um ID de um grupo, então é enviado apenas o correspondente ao array exams; caso seja passado um ID de um exame, é enviado apenas o correspondente ao objeto score.
{
"groups": [
{
"group": {
"id": 1,
"name": "Name1",
"_class": {
"name": "Name1",
"abbreviation": "Abbreviation1",
"teacher": {
"..."
},
"id": 1
}
},
"exams": [
{
"exam": {
"id": 1,
"name": "Exam 8",
"beginDate": 1498908600000,
"duration": 60
},
"score": {
"submissionID": 1,
"score": 0
}
}
]
}
]
}
- OK (200)
- INTERNAL_SERVER_ERROR (500)
- NOT_FOUND (404) - No such student
- UNAUTHORIZED (401)
- NOT_ACCEPTABLE (406) - Invalid group, Invalid exam
"name": "Name1",
"abbreviation": "Abbreviation1",
"teacher": {
"email": "email16",
"firstName": "firstName16",
"lastName": "lastName16",
"type": "Teacher",
"active": true,
"id": 16
},
"id": 1
- OK (200)
- INTERNAL_SERVER_ERROR (500)
- NOT_FOUND (404)
- UNAUTHORIZED (401)
- OK (200)
- INTERNAL_SERVER_ERROR (500)
- NOT_FOUND (404)
- UNAUTHORIZED (401)