Skip to content

Commit

Permalink
Revert: "test: 임의의 테스트 등록 API"
Browse files Browse the repository at this point in the history
This reverts commit 4193943.
  • Loading branch information
Youthhing committed Aug 30, 2024
1 parent 4193943 commit 0462a87
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.cotato.csquiz.api.event.dto.TimeRequest;
import org.cotato.csquiz.common.sse.SseService;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
Expand All @@ -22,17 +19,10 @@
public class EventController {

private final SseService sseService;
private final TestService testService;

@Operation(summary = "최초 로그인 시 출결 알림 구독 API")
@GetMapping(value = "/attendances", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
public ResponseEntity<SseEmitter> subscribeAttendance(@AuthenticationPrincipal Long memberId) {
return ResponseEntity.ok().body(sseService.subscribeAttendance(memberId));
}

@PostMapping("/test")
public ResponseEntity<Void> enrollTime(@RequestBody TimeRequest request) {
testService.enrollTestSchedule(request.testTime());
return ResponseEntity.ok().build();
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.Date;
import java.util.List;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
Expand Down Expand Up @@ -62,9 +63,4 @@ public void scheduleSessionNotification(LocalDate sessionDate) {

taskScheduler.schedule(() -> sseSender.sendNotification(notificationTime), zonedDateTime.toInstant());
}

public void scheduleNotification(LocalDateTime testTime) {
ZonedDateTime zonedDateTime = testTime.atZone(ZoneId.of("Asia/Seoul"));
taskScheduler.schedule(sseSender::sendTestNotification, zonedDateTime.toInstant());
}
}
15 changes: 0 additions & 15 deletions src/main/java/org/cotato/csquiz/common/sse/SseSender.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,21 +67,6 @@ public void sendNotification(LocalDateTime notificationDate) {
}
}

public void sendTestNotification() {
Set<DataWithMediaType> data = SseEmitter.event()
.name(ATTENDANCE_STATUS)
.data(AttendanceStatusInfo.builder()
.attendanceId(1L)
.openStatus(AttendanceOpenStatus.OPEN)
.build())
.build();

List<SseEmitter> all = sseAttendanceRepository.findAll();
for (SseEmitter sseEmitter : all) {
send(sseEmitter, data);
}
}

private void send(SseEmitter sseEmitter, Set<DataWithMediaType> data) {
try {
sseEmitter.send(data);
Expand Down

0 comments on commit 0462a87

Please sign in to comment.