Skip to content

Commit

Permalink
ci: 브랜치 최신화
Browse files Browse the repository at this point in the history
  • Loading branch information
JJ503 committed Feb 4, 2024
2 parents 9da2cb6 + e204348 commit 0c6d595
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dev-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
host: ${{ secrets.DEV_PUBLIC_IP }}
key: ${{ secrets.DEV_PRIVATE_KEY }}
script: |
sudo /home/ubuntu/deploy.sh
sudo sh /home/ubuntu/deploy.sh
- name: send result to slack
if: always()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public class FriendService {
public Long request(final Long userId, final Long friendId) {
validateFriendStatus(userId, friendId);

final User user = findUser(userId);
final User friendUser = findUser(friendId);
final User user = getUser(userId);
final User friendUser = getUser(friendId);
final Friend friend = new Friend(user, friendUser);
friendRepository.save(friend);

Expand All @@ -46,44 +46,44 @@ private void validateFriendStatus(final Long userId, final Long friendId) {
}
}

private User findUser(final Long userId) {
private User getUser(final Long userId) {
return userRepository.findByIdAndDeletedIsFalse(userId)
.orElseThrow(NotFoundUserException::new);
}

@Transactional(readOnly = true)
public ReadFriendsDto readAllByRequestId(final Long userId) {
final User user = findUser(userId);
final User user = getUser(userId);
final List<Friend> requestUsers = friendRepository.findAllByRequestUserId(userId);

return ReadFriendsDto.of(requestUsers, user, FriendType.REQUEST);
}

@Transactional(readOnly = true)
public ReadFriendsDto readAllByRequestedId(final Long userId) {
final User user = findUser(userId);
final User user = getUser(userId);
final List<Friend> requestedUser = friendRepository.findAllByRequestedUserId(userId);

return ReadFriendsDto.of(requestedUser, user, FriendType.REQUESTED);
}

@Transactional(readOnly = true)
public ReadFriendsDto readAllMutualByUserId(final Long userId) {
final User user = findUser(userId);
final User user = getUser(userId);
final List<Friend> friends = friendRepository.findAllByUserIdAndIsFriends(userId);

return ReadFriendsDto.of(friends, user, FriendType.FRIENDS);
}

public void accept(final Long userId, final Long requestId) {
final User user = findUser(userId);
final Friend friend = findFriend(requestId);
final User user = getUser(userId);
final Friend friend = getFriend(requestId);
validateRequestedUser(user, friend);

friend.acceptRequest();
}

private Friend findFriend(final Long requestId) {
private Friend getFriend(final Long requestId) {
return friendRepository.findById(requestId)
.orElseThrow(NotFoundFriendRequestException::new);
}
Expand All @@ -95,8 +95,8 @@ private void validateRequestedUser(final User user, final Friend friend) {
}

public void delete(final Long userId, final Long requestId) {
final User user = findUser(userId);
final Friend friend = findFriend(requestId);
final User user = getUser(userId);
final Friend friend = getFriend(requestId);
validateCanDelete(user, friend);

friendRepository.delete(friend);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ public ReadUserDto updateById(final Long userId, final UpdateUserDto updateUserD
final User user = userRepository.findById(userId)
.orElseThrow(NotFoundUserException::new);
updateUserByRequest(user, updateUserDto);
userRepository.flush();

return ReadUserDto.from(user);
}
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/com/backend/blooming/user/domain/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,19 @@ private User(
this.oAuthType = oAuthType;
this.email = email;
this.name = name;
this.color = processColor(color);
this.statusMessage = processStatusMessage(statusMessage);
this.color = processDefaultColor(color);
this.statusMessage = processDefaultStatusMessage(statusMessage);
}

private ThemeColor processColor(final ThemeColor color) {
private ThemeColor processDefaultColor(final ThemeColor color) {
if (color == null) {
return DEFAULT_THEME_COLOR;
}

return color;
}

private String processStatusMessage(final String statusMessage) {
private String processDefaultStatusMessage(final String statusMessage) {
if (statusMessage == null) {
return DEFAULT_STATUS_MESSAGE;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,12 @@ class UserRepositoryTest extends UserRepositoryTestFixture {
// then
assertSoftly(SoftAssertions -> {
assertThat(actual).hasSize(3);
assertThat(actual.get(0).getId()).isEqualTo(사용자_아이디);
assertThat(actual.get(0).getId()).isEqualTo(사용자.getId());
assertThat(actual.get(0).getName()).isEqualTo(사용자.getName());
assertThat(actual.get(1).getId()).isEqualTo(사용자2.getId());
assertThat(actual.get(2).getId()).isEqualTo(삭제된_사용자_아이디);
assertThat(actual.get(1).getName()).isEqualTo(사용자2.getName());
assertThat(actual.get(2).getId()).isEqualTo(삭제된_사용자.getId());
assertThat(actual.get(2).getName()).isEqualTo(삭제된_사용자.getName());
});
}
}

0 comments on commit 0c6d595

Please sign in to comment.