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

refactor : party leader -> manager로 네이밍 변경 및 party event에 distance 추가 #53

Merged
merged 4 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,14 @@

import java.util.List;

public record PartyEvent(String entryCode, String leaderId, PartyStatus status, List<String> participants, String battleId) {
public record PartyEvent(String entryCode,
int distance,
String managerId,
PartyStatus status,
List<String> participants,
String battleId) {
public PartyEvent(Party party) {
this(party.getEntryCode().getCode(), party.getLeaderId(), party.getStatus(), party.getParticipants(), party.getBattleId());
this(party.getEntryCode().getCode(), party.getDistance().getMeter(), party.getManagerId(),
party.getStatus(), party.getParticipants(), party.getBattleId());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ public class Party {
@Id
String id;
EntryCode entryCode = new EntryCode();
String leaderId;
String managerId;
RunningDistance distance;

PartyStatus status = PartyStatus.WAITING;
List<String> participants = new ArrayList<>();
String battleId;

public Party(String leaderId, RunningDistance distance) {
this.leaderId = leaderId;
public Party(String managerId, RunningDistance distance) {
this.managerId = managerId;
this.distance = distance;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ void postParties() {
@DisplayName("get : join party")
void getPartyEventStream() {
final Flux<PartyEvent> eventResult = Flux.just(
new PartyEvent(ENTRY_CODE, "member1", PartyStatus.WAITING, List.of("member1"), null),
new PartyEvent(ENTRY_CODE, "member1", PartyStatus.WAITING, List.of("member1", "member2"), null),
new PartyEvent(ENTRY_CODE, "member1", PartyStatus.COMPLETED, List.of("member1", "member2"), "battle-id")
new PartyEvent(ENTRY_CODE,1000, "member1", PartyStatus.WAITING, List.of("member1"), null),
new PartyEvent(ENTRY_CODE, 1000, "member1", PartyStatus.WAITING, List.of("member1", "member2"), null),
new PartyEvent(ENTRY_CODE, 1000, "member1", PartyStatus.COMPLETED, List.of("member1", "member2"), "battle-id")
);
given(partyService.joinAndConnectSink(any(Mono.class), any(String.class)))
.willReturn(eventResult);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void clear() {
@DisplayNameGeneration(ReplaceUnderscores.class)
class 파티가_생성된_후 {
EntryCode code = partyRepository.save(partySample).block().getEntryCode();
PartyEvent event = new PartyEvent(code.getCode(), 현준.block(), PartyStatus.WAITING, List.of(현준.block()), null);
PartyEvent event = new PartyEvent(code.getCode(),1000, 현준.block(), PartyStatus.WAITING, List.of(현준.block()), null);

@BeforeEach
void setUp() {
Expand Down
Loading