PM-5417 - fix creation of appeal response - use direct appealResponse.create#290
Open
vas3a wants to merge 1 commit into
Open
PM-5417 - fix creation of appeal response - use direct appealResponse.create#290vas3a wants to merge 1 commit into
vas3a wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors AppealService.createAppealResponse to create an appealResponse directly via prisma.appealResponse.create(...) instead of performing a nested create inside prisma.appeal.update(...), and adjusts the subsequent event publishing + return value to use the newly created record.
Changes:
- Replaced nested
appeal.update(... appealResponse.create ...)with directappealResponse.create(...). - Updated event publishing to use the created appeal response’s
id. - Simplified the returned value to return the created
appealResponserecord.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| reviewerResource, | ||
| }); | ||
| return data.appealResponse as AppealResponseResponseDto; | ||
| return data as AppealResponseResponseDto; |
Comment on lines
+685
to
691
| const data = await this.prisma.appealResponse.create({ | ||
| data: { | ||
| appealResponse: { | ||
| create: { | ||
| ...mapAppealResponseRequestToDto(body), | ||
| resourceId: reviewerResourceId, | ||
| }, | ||
| }, | ||
| }, | ||
| include: { | ||
| appealResponse: true, | ||
| appealId, | ||
| ...mapAppealResponseRequestToDto(body), | ||
| resourceId: reviewerResourceId, | ||
| }, | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request refactors how appeal responses are created and returned in the
AppealService. Instead of updating an existing appeal with a nested appeal response, the code now directly creates a newappealResponserecord and simplifies the return value and event publishing logic.Refactor of appeal response creation:
prisma.appealResponse.createdirectly, rather than updating theappealrecord with a nested create, simplifying the data flow and making the intent clearer.appealResponse's ID and data directly, improving clarity and reducing unnecessary nesting.