Skip to content

PM-5417 - fix creation of appeal response - use direct appealResponse.create#290

Open
vas3a wants to merge 1 commit into
PM-4011_manager-accessfrom
PM-5417_appeal-response-creation-fix
Open

PM-5417 - fix creation of appeal response - use direct appealResponse.create#290
vas3a wants to merge 1 commit into
PM-4011_manager-accessfrom
PM-5417_appeal-response-creation-fix

Conversation

@vas3a

@vas3a vas3a commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

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 new appealResponse record and simplifies the return value and event publishing logic.

Refactor of appeal response creation:

  • Changed the service to use prisma.appealResponse.create directly, rather than updating the appeal record with a nested create, simplifying the data flow and making the intent clearer.
  • Updated event publishing and return logic to use the newly created appealResponse's ID and data directly, improving clarity and reducing unnecessary nesting.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 direct appealResponse.create(...).
  • Updated event publishing to use the created appeal response’s id.
  • Simplified the returned value to return the created appealResponse record.

💡 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,
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants