Skip to content

Commit

Permalink
Merge pull request #127 from gloddy-dev/fix/#126
Browse files Browse the repository at this point in the history
[FIX]: 지원서 생성 시 이벤트에 CaptainId 넘겨주도록 수정
  • Loading branch information
twoosky committed Nov 10, 2023
2 parents 9e9437b + 395dd82 commit 82a7a62
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public ApplyResponse.Create createApply(Long userId, Long groupId, ApplyRequest.
Apply apply = applyCommandHandler.save(
group.createApply(user, request.getIntroduce(), request.getReason())
);
applyEventProducer.produceEvent(new ApplyCreateEvent(userId, groupId));
applyEventProducer.produceEvent(new ApplyCreateEvent(group.getCaptainId(), groupId, userId));
return new ApplyResponse.Create(apply.getId());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
@AllArgsConstructor
@Getter
public class ApplyCreateEvent implements Event {
private Long userId;
private Long captainId;
private Long groupId;
private Long applyUserId;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor
public class ApplyStatusUpdateEvent implements Event {
private Long userId;
private Long applyGroupId;
private Long captainId;
private Long groupId;
private Long applyUserId;
private Status status;
}
4 changes: 4 additions & 0 deletions src/main/java/com/gloddy/server/group/domain/Group.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ public int getMemberCount() {
return this.groupMemberVOs.getSize();
}

public Long getCaptainId() {
return this.captain.getId();
}

public Apply createApply(User applier, String introduce, String reason) {
return Apply.builder()
.user(applier)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ public class ApplyEventMapper {

public static ApplyAdapterEvent mapToApplyAdapterEventFrom(ApplyCreateEvent applyCreateEvent) {
return new ApplyAdapterEvent(
applyCreateEvent.getUserId(),
applyCreateEvent.getCaptainId(),
applyCreateEvent.getGroupId(),
applyCreateEvent.getUserId(),
applyCreateEvent.getApplyUserId(),
ApplyEventType.APPLY_CREATE
);
}

public static ApplyAdapterEvent mapToApplyAdapterEventFrom(ApplyStatusUpdateEvent applyStatusUpdateEvent) {
return new ApplyAdapterEvent(
applyStatusUpdateEvent.getUserId(),
applyStatusUpdateEvent.getApplyGroupId(),
applyStatusUpdateEvent.getCaptainId(),
applyStatusUpdateEvent.getGroupId(),
applyStatusUpdateEvent.getApplyUserId(),
getApplyEventType(applyStatusUpdateEvent.getStatus())
);
Expand Down

0 comments on commit 82a7a62

Please sign in to comment.