hackerAPI icon indicating copy to clipboard operation
hackerAPI copied to clipboard

Make Hacker.application nested fields not required

Open logan-r opened this issue 5 years ago • 1 comments

In order to support saving incomplete application data on a tab-by-tab level, POST and PUT requests to the /hacker resource should be able to create Hacker documents that lack subfields of the application field.

For example, I should be able to POST /hacker with a body of

{
    "accountId": "{an id}",
    "application":{
        "general":{
            "school": "McGill University",
            "degree": "Undergraduate",
            "fieldOfStudy": ["Computer Science"],
            "graduationYear": 2021,
            "jobInterest":"Internship",
            "URL":{
                "resume":"resumes/1543458163426-5bff4d736f86be0a41badb91",
                "github":"https://github.com/abcd",
                "dropler":"https://dribbble.com/abcd",
                "personal":"https://www.hi.com/",
                "linkedIn":"https://linkedin.com/in/abcd",
                "other":"https://github.com/hackmcgill/hackerAPI/issues/168"
            }
        },
        "shortAnswer": {
            "skills":["Javascript","Typescript"],
            "question1": "I love McHacks",
            "question2":"Pls accept me",
            "comments":"hi!"
        }
    }
}

and new hacker document will be created, missing the application.accommodation and application.other fields.

Caveat: while say application.other should not be required, every Hacker that has a application.other must have a application.other.privacyPolicy, this applies to all other currently required application.*.* fields

logan-r avatar Oct 09 '20 17:10 logan-r

Further, to ensure data is valid, when creating or updating a new hacker, if Hacker.status is "None" the above applies. However if Hacker.status is anything besides "None", Hacker.application must have all subfields present.

logan-r avatar Oct 09 '20 17:10 logan-r