-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
Background
MongoDB is a schema-less and document-base database. Therefore, database schema is enforced on the application layer. We can utilize this flexibility to store impartial application data in our MongoDB cluster. On the backend, we would be have all the properties of ApplicationResponses interface to be optional to allow for “incomplete” applications. Lucky for us, this is already in place as seen snippet below:
In order to populate an incomplete application, we need to be able to get the applicant response data of a user from mongoDB.
/**
* @param applicationStatus deez nuts :0
*/
export interface User {
email: string;
// TODO: Remove the Optional Modifer
applicationResponses?: ApplicationResponses; // this here
postAcceptanceResponses?: PostAcceptanceResponses;
isAdmin: boolean;
applicationStatus: ApplicationStatus;
postAcceptanceStatus?: ApplicationStatus;
// Decision status might not exist because of backwards compatibility
decisionStatus?: DecisionStatus;
rsvpStatus: RSVPStatus;
responses?: Array<QuestionResponse>; // legacy
appSubmissionTime?: Date;
rsvpSubmissionTime?: Date;
}To ensure we don't run into any null point exceptions, we also need to make applicationResponses a required field that is always created upon the creation of a User
AC:
- Update the applicationResponses field in the User interface to be require
- Update the behavior so that when a user is created, the applicationResponses is an empty object
- Create a GET endpoint to fetch the applicationResponses from Mongo given the user id
Reactions are currently unavailable
