Skip to content

Commit

Permalink
fix: 그룹 초대 수락 반환dto 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
SangWoon123 committed May 22, 2024
1 parent d0b9510 commit 0d765a2
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.tukorea.planding.common.CommonResponse;
import com.tukorea.planding.common.CommonUtils;
import com.tukorea.planding.domain.group.dto.request.GroupInviteRequest;
import com.tukorea.planding.domain.group.dto.response.GroupInviteAcceptResponse;
import com.tukorea.planding.domain.group.service.GroupInviteService;
import com.tukorea.planding.domain.group.dto.response.GroupInviteMessageResponse;
import com.tukorea.planding.domain.user.dto.UserInfo;
Expand All @@ -29,9 +30,9 @@ public CommonResponse<GroupInviteMessageResponse> invite(@AuthenticationPrincipa

@Operation(summary = "초대를 수락한다")
@GetMapping("/accept/{groupId}/{code}")
public CommonResponse<?> accept(@AuthenticationPrincipal UserInfo userInfo, @PathVariable(name = "groupId") Long groupId, @PathVariable(name = "code") String code) {
groupInviteService.acceptInvitation(userInfo, code, groupId);
return CommonUtils.success("수락완료");
public CommonResponse<GroupInviteAcceptResponse> accept(@AuthenticationPrincipal UserInfo userInfo, @PathVariable(name = "groupId") Long groupId, @PathVariable(name = "code") String code) {
GroupInviteAcceptResponse response = groupInviteService.acceptInvitation(userInfo, code, groupId);
return CommonUtils.success(response);
}

@Operation(summary = "초대를 받은 목록", description = "아직 초대의 상태를 바꾸지 않은 경우만")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.tukorea.planding.domain.group.dto.response;

import lombok.Builder;

@Builder
public record GroupInviteAcceptResponse(
Long groupId
) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.tukorea.planding.domain.group.dto.GroupInviteEvent;
import com.tukorea.planding.domain.group.dto.request.GroupInviteRequest;
import com.tukorea.planding.domain.group.dto.response.GroupInviteAcceptResponse;
import com.tukorea.planding.domain.group.dto.response.GroupInviteMessageResponse;
import com.tukorea.planding.domain.group.entity.GroupRoom;
import com.tukorea.planding.domain.group.entity.UserGroup;
Expand Down Expand Up @@ -60,14 +61,16 @@ public GroupInviteMessageResponse inviteGroupRoom(UserInfo userInfo, GroupInvite
}

@Transactional
public void acceptInvitation(UserInfo userInfo, String code, Long groupId) {
public GroupInviteAcceptResponse acceptInvitation(UserInfo userInfo, String code, Long groupId) {
User user = userQueryService.getUserByUserCode(userInfo.getUserCode());
GroupRoom group = groupQueryService.getGroupById(groupId);

final UserGroup userGroup = UserGroup.createUserGroup(user, group);
userGroupQueryService.save(userGroup);

redisGroupInviteService.deleteInvitation(userInfo.getUserCode(), code);

return GroupInviteAcceptResponse.builder().groupId(groupId).build();
}

public List<GroupInviteMessageResponse> getInvitations(UserInfo userInfo) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ public void notifyInvitation(final String userCode, final String groupName) {
eventPublisher.publishEvent(event);
}

public void notifyGroupSchedule(final String userCode, final String schedule) {

}

@EventListener
public void handleGroupInvitedEvent(GroupInviteEvent event) {
NotificationScheduleRequest request = NotificationScheduleRequest.builder()
Expand Down

0 comments on commit 0d765a2

Please sign in to comment.