Skip to content

Deadlines Endpoints

N Vijay Narayanan edited this page Aug 16, 2022 · 13 revisions

Creating a deadline

POST: /api/deadlines

  • Authorization Required: authorizeAdmin

Request Body:

{
    deadline: {
        cohortYear: number
        desc?: string
        name: string
        dueBy: dateTime
        type: enum
        evaluatingDeadlineId?: number; // If type == "Evaluation"
    }
}

Reading deadlines

GET: /api/deadlines

  • Authorization Required: authorizeAdmin
Query Param Description Optional
cohortYear Cohort year of the deadline true
name Name of the deadline to do string matching true

Sample Response:

{
    deadlines: [
        {
            id: 1,
            cohortYear: 2022,
            name: "Milestone 1",
            desc: "This is the first Milestone",
            dueBy: "2022-06-18T02:42:34.564Z",
            createdOn: "2022-06-08T02:42:34.564Z",
            updatedAt: ""2022-06-09T02:42:34.564Z""
            type: "Milestone",
            evaluatingMilestoneId: null (if type == "Evaluation", this would be a number)
            evaluating: null (if type == "Evaluation", this would be a Deadline object, refer to the request body of deadline creation for an example)
        }
    ]
]

Reading a single deadline

GET: /api/deadlines/:deadlineId

  • Authorization Required: authorizeAdmin
  • Currently unused

Sample Response:

{
    id: 1,
    cohortYear: 2022,
    name: "Milestone 1",
    desc: "This is the first Milestone",
    dueBy: "2022-06-18T02:42:34.564Z",
    type: "Milestone"
}

Updating a deadline

PUT: /api/deadlines/:deadlineId

  • Authorization Required: authorizeAdmin

Request Body:

{
    deadline: {
        name?: string
        dueBy?: dateTime
        type?: enum
        evaluatingMilestoneId?: number
    }
}

Deleting a deadline

DELETE: /api/deadlines/:deadlineId

  • Authorization Required: authorizeAdmin

Reading all questions attached to a deadline

GET: /api/deadlines/:deadlineId/questions

  • Authorization Required: authorizeAdmin

Sample Response:

{
    deadline: {
        id: 1,
        cohortYear: 2022,
        name: "Milestone 1",
        desc: "This is the first Milestone"
        dueBy: "2022-06-18T02:42:34.564Z",
        createdOn: "2022-06-08T02:42:34.564Z",
        updatedAt: "2022-06-09T02:42:34.564Z",
        type: "Milestone",
        evaluatingMilestoneId: null,
        evaluating: null
    },
    sections: [{
        id: 1,
        name: "Deliverables",
        desc: "Milestone 1 Deliverables",
        sectionNumber: 1,
        deadlineId: 10,
        questions: [{
                       id: 3,
                       questionNumber: 1,
                       question: "Poster Link",
                       desc: "",
                       type: "Url",
                       isAnonymous: false,
                       sectionId: 1,
                       options:[]
                   }]
              }]

Replace all questions attached to a deadline

PUT: /api/deadlines/:deadlineId/questions

  • Authorization Required: authorizeAdmin

Sample Request Body:

  • (sections order is implied by index)
  • (questions order is implied by index)
  • (options order is implied by index)
{
    sections: [
        {
            name: "Poster Evaluation",
            desc: "How good is this team's poster submission?"
            questions: [
                {
                    question: "How well did this team do?",
                    desc: "Rate the team based on ...",
                    type: "ShortAnswer"
                },
                {
                    question: "What would you rate this team?",
                    desc: "Please rate this team on ...",
                    type: "MultipleChoice",
                    options: [
                        "1 / 5 - Good enough for Vostok",
                        "2 / 5 - Good enough for enough for Gemini"
                    ]
                }
            ]
        }, 
        {
            name: "Video Evaluation",
            desc: "How good is this team's video submission?",
            questions: [
                {
                    question: "How well did this team do?",
                    desc: "Rate the team based on ...",
                    type: "ShortAnswer"
                },
                {
                    question: "What would you rate this team?",
                    desc: "Please rate this team on ...",
                    type: "MultipleChoice",
                    options: [
                        "1 / 5 - Good enough for Vostok",
                        "2 / 5 - Good enough for enough for Gemini"
                    ]
                }
            ]
        }
    
    ]
}

NUS Skylab v2 - Backend

Introduction

Project Organization

Project Requirements

Endpoints

Clone this wiki locally