-
Notifications
You must be signed in to change notification settings - Fork 3
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
MCR-4449: Rate create rate question response api #2824
Conversation
@@ -701,7 +705,7 @@ type CreateRateQuestionPayload { | |||
# question: Question! | |||
#} | |||
|
|||
input CreateContractQuestionResponseInput { | |||
input CreateQuestionResponseInput { |
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.
Can you clarify in the naming or the comment this is a generic type it works for both rate and question responses. I think its worth clarifying because everything else seems to have distinct types (either contract or rate) for this API
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.
This looks good - lets merge through and start to build some UI to test
@@ -39,15 +42,14 @@ export async function insertContractQuestionResponse( | |||
include: questionInclude, | |||
}) | |||
|
|||
return questionPrismaToDomainType(result) | |||
return contractQuestionPrismaToDomainType(result) | |||
} catch (e) { | |||
// Return a NotFoundError if prisma fails on the primary key constraint | |||
// An operation failed because it depends on one or more records | |||
// that were required but not found. | |||
if (e.code === 'P2025') { |
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.
I said this to @macrael in an earlier PR, it seems brittle to hardcode these error codes in random postgres functions we should be using helper functions. seems like this is isMissingRelatedRecord
or something like that because record to update doesnt exist
Summary
MCR-4449
Related issues
Screenshots
Test cases covered
createRateQuestionResponse.test.ts
'returns question response data'
'returns an error when attempting to create a response for a question that does not exist'
'returns an error if a cms user attempts to create a response for a rate question'
QA guidance