apc-unb / apc-api

MIT License
4 stars 0 forks source link

New project work flow #45

Closed VerasThiago closed 5 years ago

VerasThiago commented 5 years ago

Based on #21

Project work flow:

1. Check if user have already submitted a file to that current project.

POST localhost:8080/project/check
{
    "StudentID": "5db31b89241de02e187c63fa",
    "ProjectTypeID": "5db31b89241de02e187c6400"
}

1.1 This request will return STATUS 200 OK if the project have a previous submission

{
    "filename": "160146682.zip",
    "monitorEmail": "email.do.monitor@gmail.com",
    "monitorName": "Monitor Monitorado",
    "monitorid": "5db31b89241de02e187c63fd",
    "projectid": "5db31b8a241de02e187c6403",
    "status": "Created",
    "updatedat": "0000-12-31T21:00:00-03:00"
}

1.2 This request will return STATUS 404 Not Found if the project don't have a previous submission

{
    "error": "Project not found"
}

2. According to the first step, the front need to alert the user that have already a submission to that project type and ask if he wants to overwrite the current submission (show submission info and handle the project status if needed)

2.1 In case that don't have a submission to that file

POST localhost:8080/project
{
    "studentid"     :   ObjectID,
    "projecttypeid" :   ObjectID,
    "classid"       :   ObjectId,
    "filename"      :   String
}

2.2 In case that have a submission to that file

PUT localhost:8080/project
"id": ObjectID,
"filename": String

PS: The PUT localhost:8080/project request change the Status to Updated

Gguidini commented 5 years ago

That's a good workflow, for now. Later on we'll see in the extra API call is a performance issue.