Skip to content
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
@@ -0,0 +1,29 @@
package LuckyVicky.backend.display_board.controller;

import LuckyVicky.backend.display_board.service.DisplayBoardService;
import LuckyVicky.backend.global.api_payload.ApiResponse;
import LuckyVicky.backend.global.api_payload.SuccessCode;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "전광판")
@RestController
@RequestMapping("/display-board")
@RequiredArgsConstructor
public class DisplayBoardController {
private final DisplayBoardService displayBoardService;

@Operation(summary = "전광판 큐 리셋 메서드", description = "전광판 큐 내 메세지들을 리셋하는 메서드입니다.")
@ApiResponses(value = {
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "DISPLAY_2001", description = "전광판 큐 내 메세지들이 리셋되었습니다.")
})
@GetMapping("/reset")
public ApiResponse<Integer> resetDisplayBoard() {
return ApiResponse.onSuccess(SuccessCode.DISPLAY_BOARD_RESET_QUEUE_SUCCESS, displayBoardService.initializeQueue());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class DisplayBoardService {
private final Queue<DisplayMessage> displayMessageQueue = new LinkedList<>();

@PostConstruct
private void initializeQueue() {
public Integer initializeQueue() {
try {
displayMessageQueue.clear();

Expand All @@ -40,6 +40,8 @@ private void initializeQueue() {
} catch (Exception e) {
log.error(INITIALIZE_QUEUE_FAIL_MESSAGE, e.getMessage(), e);
}

return displayMessageQueue.size();
}

public DisplayMessage getNextDisplayMessage() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ public enum SuccessCode implements BaseCode {
SMS_CERTIFICATE_SUCCESS(HttpStatus.OK, "SMS_2002", "문자 인증이 완료되었습니다."),

// Fcm
FCM_SEND_SUCCESS(HttpStatus.OK, "FCM_2001", "fcm 알람이 성공적으로 전송되었습니다.");
FCM_SEND_SUCCESS(HttpStatus.OK, "FCM_2001", "fcm 알람이 성공적으로 전송되었습니다."),

// Display Board
DISPLAY_BOARD_RESET_QUEUE_SUCCESS(HttpStatus.OK, "DISPLAY_2001","전광판 큐 내 메세지들이 리셋되었습니다.");

private final HttpStatus httpStatus;
private final String code;
Expand Down
Loading