Skip to content
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

Feat update curriculummembership api #1043

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

jayanta2018
Copy link
Contributor

This end point is required by the Bulk Upload service for updating curriculum memberships.
TIS21-3819

@jayanta2018 jayanta2018 force-pushed the feat-update-curriculummembership-api branch from e068655 to 2ed80c1 Compare January 16, 2025 12:12
Copy link
Contributor

@hihilary hihilary left a comment

Choose a reason for hiding this comment

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

One thing I feel not very clear is whether the field TIS_ProgrammeMembership_ID* in the template is for update or for validation.

* @param curriculumMembershipDto the dto to patch
* @return the ResponseEntity with status 200 (OK) and with body the patched dto
*/
@PatchMapping("/curriculum-membership")
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. Pepe suggested using the plural format: https://hee-nhs-tis.slack.com/archives/C03GBMYGZD4/p1736356584130419?thread_ts=1736352700.784459&cid=C03GBMYGZD4
  2. Just want to check with you. patch requests are not going to be logged in the AuditingAspect class, are you okay with it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. Ok thanks. I will go for plural format.
  2. Yeah, looks like it is, patch requests are not logged in because we don't have patch enum here in the GenericAuditEventType class. We also need to write a pointcut and advice (that might be a new Jira ticket, what do you think?) Patch was used earlier in ProgrammeMembership update. So I went for patch because of this AC "Given I have left some of the column empty on the template
    When the template is uploaded
    Then existing TIS values should not be overwritten with blanks."

@Transactional
public CurriculumMembershipDTO patch(CurriculumMembershipDTO cmDto) {
log.debug("Request to patch CurriculumMembership : {}", cmDto);
CurriculumMembershipDTO curriculumMembershipDtoFromDb = findOne(cmDto.getId());
Copy link
Contributor

Choose a reason for hiding this comment

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

Please check the explanation on Sonar. Any method marked with @Transactional seems to be executed asynchronously, so it suggets to use a injected instance to invoke it rather than this.

public CurriculumMembershipDTO patch(CurriculumMembershipDTO cmDto) {
log.debug("Request to patch CurriculumMembership : {}", cmDto);
CurriculumMembershipDTO curriculumMembershipDtoFromDb = findOne(cmDto.getId());
if (curriculumMembershipDtoFromDb == null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is the only place curriculumMembershipDtoFromDb is used, but I thought you would update it with the dto got from the client.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point

@jayanta2018 jayanta2018 force-pushed the feat-update-curriculummembership-api branch from 6d7f575 to 69450f9 Compare January 20, 2025 14:26
@jayanta2018 jayanta2018 force-pushed the feat-update-curriculummembership-api branch from 69450f9 to 53c6c5b Compare January 20, 2025 14:50
@jayanta2018 jayanta2018 requested a review from hihilary January 20, 2025 14:54
@jayanta2018
Copy link
Contributor Author

One thing I feel not very clear is whether the field TIS_ProgrammeMembership_ID* in the template is for update or for validation.

Checked with James and Ade. It is for validation only. The confluence page also says so.

@jayanta2018 jayanta2018 force-pushed the feat-update-curriculummembership-api branch from ba8cc3e to 9b09123 Compare January 20, 2025 21:25
@jayanta2018 jayanta2018 force-pushed the feat-update-curriculummembership-api branch from 9b09123 to 0d5d7a5 Compare January 21, 2025 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants