Skip to content

Commit

Permalink
[#151] Fix: PinOrderUpdate 반환값 LexoRank로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
haeun-i committed Mar 1, 2024
1 parent 4d9100a commit 87e692b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public BasicResponse<PinSaveRes> savePin(
@SendTo("/sub/{courseId}/pin/modification/sequence")
public BasicResponse<PinOrderUpdateRes> updateOrder(
@DestinationVariable Long courseId, @RequestBody PinOrderUpdateReq pinOrderUpdateReq) {
return BasicResponse.success(pinService.updatePinOrder(courseId, pinOrderUpdateReq));
return BasicResponse.success(pinService.updatePinSequence(courseId, pinOrderUpdateReq));
}

@MessageMapping("/{courseId}/pin/modification/name")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public BasicResponse<PinSaveRes> savePin(
@PatchMapping("/{courseId}/order")
public BasicResponse<PinOrderUpdateRes> updatePinOrder(
@PathVariable("courseId") Long courseId, @RequestBody PinOrderUpdateReq pinOrderUpdateReq) {
return BasicResponse.success(pinService.updatePinOrder(courseId, pinOrderUpdateReq));
return BasicResponse.success(pinService.updatePinSequence(courseId, pinOrderUpdateReq));
}

@PatchMapping("/{courseId}/name")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class PinOrderUpdateRes {
private UUID pinId;
private int order;
private String sequence;

@Builder
private PinOrderUpdateRes(UUID pinId, int order) {
private PinOrderUpdateRes(UUID pinId, String sequence) {
this.pinId = pinId;
this.order = order;
this.sequence = sequence;
}
}
7 changes: 5 additions & 2 deletions src/main/java/com/pcb/audy/domain/pin/service/PinService.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public PinSaveRes savePin(Long courseId, PinSaveReq pinSaveReq) {
return PinServiceMapper.INSTANCE.toPinSaveRes(pinRedisRes);
}

public PinOrderUpdateRes updatePinOrder(Long courseId, PinOrderUpdateReq pinOrderUpdateReq) {
public PinOrderUpdateRes updatePinSequence(Long courseId, PinOrderUpdateReq pinOrderUpdateReq) {
String key = getKey(courseId, pinOrderUpdateReq.getPinId());
String sequence = lexoRankUtil.getLexoRank(courseId, pinOrderUpdateReq.getOrder());

Expand All @@ -57,7 +57,10 @@ public PinOrderUpdateRes updatePinOrder(Long courseId, PinOrderUpdateReq pinOrde
.build();

redisProvider.setPin(key, updatedPinRedisRes, PIN_EXPIRE_TIME);
return PinServiceMapper.INSTANCE.toPinOrderUpdateRes(pinOrderUpdateReq);
return PinOrderUpdateRes.builder()
.pinId(updatedPinRedisRes.getPinId())
.sequence(updatedPinRedisRes.getSequence())
.build();
}

public PinNameUpdateRes updatePinName(Long courseId, PinNameUpdateReq pinNameUpdateReq) {
Expand Down

0 comments on commit 87e692b

Please sign in to comment.