-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ahnfikd7/create accept reject endpoint #57
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯 Just a couple comments but looks good to me overall!
} | ||
|
||
//Check if the string decision matches with the Decision enum | ||
const decisionEnum: Decision = Decision[decision as keyof typeof Decision]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓We definitely need to make sure that the decision
we get is a valid Decision
but I think line 46 in this file (where we type the decision
parameter) tells Nest to check this for us and throw an error if the type doesn't match. Can you try commenting out this check and passing in an invalid value as the decision
and see if the endpoint still responds with a 400 Bad Request
error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⛏️A potentially better alternative altogether is to make an application decision dto whose fields are applicantId
and decision.
Then, you can add decorators from class-validator
such as @IsEnum(Decision)
to the fields to ensure that Nest performs type checks at runtime.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! Just a few suggestions.
ℹ️ Issue
Closes #22
📝 Description
Wrote a new function processDecision inside applications.service that updates the application stage of an applicant to the next stage or to rejected.
In the decision endpoint inside the applications.controller, it delegates the decision making to service i.e processDecision.