Skip to content

MemberService.java updateMember - #68

Open
Allimonae wants to merge 2 commits into
mainfrom
members-CRUD
Open

MemberService.java updateMember#68
Allimonae wants to merge 2 commits into
mainfrom
members-CRUD

Conversation

@Allimonae

@Allimonae Allimonae commented Aug 3, 2026

Copy link
Copy Markdown
Member

MemberService updateMember Implemented

The updateMember method now performs a true partial update instead of replacing the entire member object. Only fields provided in the UpdateMemberRequest that are non-null will be applied to the existing member, preserving all other field values.

@NotBlank has been removed from fullName, email, and introduction in UpdateMemberRequest to allow partial updates.

Test Coverage

  • Throws MemberNotFoundException when the member does not exist
  • Updates only the provided field (fullName) while preserving all other existing values
  • Leaves all fields unchanged when all request fields are null
  • Updates all fields when all request fields are provided

Allimonae commented Aug 3, 2026

Copy link
Copy Markdown
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@sonarqubecloud

sonarqubecloud Bot commented Aug 3, 2026

Copy link
Copy Markdown

@Allimonae Allimonae changed the title Instant to OffsetDateTime MemberService.java updateMember Aug 3, 2026
@Allimonae
Allimonae marked this pull request as ready for review August 3, 2026 19:19
@Allimonae
Allimonae requested a review from a team August 3, 2026 19:19
@graphite-app

graphite-app Bot commented Aug 3, 2026

Copy link
Copy Markdown

Graphite Automations

"Request reviewers once CI passes" took an action on this PR • (08/03/26)

2 reviewers were added to this PR based on Henry Chen's automation.

@Allimonae Allimonae mentioned this pull request Aug 3, 2026
@Email String email,
String linkedInUrl,
@NotBlank String introduction,
String introduction,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

will this require a DB migration?

if (request.fullName() != null) {
member.setFullName(request.fullName());
}
if (request.email() != null) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

i'd assume we wouldn't want to assign some of these to blanks either? I think spring has some utils for this

throw new MemberNotFoundException(id);
Member member = memberRepo.getMemberById(id).orElseThrow(() -> new MemberNotFoundException(id));

if (request.fullName() != null) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How does this handle null vs empty in the string?

void updateMember_successWithOnlyNameField() {
final UUID id = UUID.randomUUID();
final UpdateMemberRequest request =
new UpdateMemberRequest("Updated Name", null, null, null, null, null, null, null, null);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How does the controller serialize the JSON into nulls?

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.

3 participants