From b0194b156a97ce9baf5b7015d3f1b339004181f3 Mon Sep 17 00:00:00 2001 From: SHEOMM Date: Mon, 4 Mar 2024 01:14:04 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20sessionDetail=EC=97=90=EC=84=9C=20id?= =?UTF-8?q?=EB=A5=BC=20=EB=82=B4=EB=A0=A4=EC=A3=BC=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../attendee/domain/repository/AttendeeRepository.java | 4 ++-- .../attendee/domain/repository/dto/SessionAttendeeInfo.java | 2 ++ .../areyouhere/attendee/service/AttendeeServiceImpl.java | 2 ++ .../areyouhere/attendee/service/dto/SessionAttendees.java | 5 ++++- .../waruru/areyouhere/auth/interceptor/LoginInterceptor.java | 2 -- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/waruru/areyouhere/attendee/domain/repository/AttendeeRepository.java b/src/main/java/com/waruru/areyouhere/attendee/domain/repository/AttendeeRepository.java index b0f15b0..63c6d59 100644 --- a/src/main/java/com/waruru/areyouhere/attendee/domain/repository/AttendeeRepository.java +++ b/src/main/java/com/waruru/areyouhere/attendee/domain/repository/AttendeeRepository.java @@ -13,14 +13,14 @@ public interface AttendeeRepository extends JpaRepository { @Query(value = "SELECT * FROM attendee WHERE attendee.course_id = :courseId And attendee.id NOT IN (SELECT att.attendee_id FROM attendance as att WHERE att.session_id = :sessionId)", nativeQuery = true) public List findAbsenteeBySessionIdWhenNoRegister(@Param("courseId") Long courseId, @Param("sessionId") Long sessionId); - @Query(value = "SELECT atdee.name as AttendeeName, atda.is_attended as AttendanceStatus, atda.created_at as AttendanceTime \n" + @Query(value = "SELECT atdee.id as attendeeId, atdee.name as AttendeeName, atda.is_attended as AttendanceStatus, atda.created_at as AttendanceTime \n" + "FROM attendee as atdee \n" + "INNER JOIN attendance as atda ON atdee.id = atda.attendee_id \n" + "WHERE atda.session_id = :sessionId", nativeQuery = true) public List findSessionAttendees(@Param("sessionId") Long sessionId); - @Query(value = "SELECT atdee.name as AttendeeName, atda.is_attended as AttendanceStatus, atda.created_at as AttendanceTime \n" + @Query(value = "SELECT atdee.id as attendeeId,atdee.name as AttendeeName, atda.is_attended as AttendanceStatus, atda.created_at as AttendanceTime \n" + "FROM attendee as atdee \n" + "INNER JOIN attendance as atda ON atdee.id = atda.attendee_id \n" + "WHERE atda.session_id = :sessionId \n" diff --git a/src/main/java/com/waruru/areyouhere/attendee/domain/repository/dto/SessionAttendeeInfo.java b/src/main/java/com/waruru/areyouhere/attendee/domain/repository/dto/SessionAttendeeInfo.java index b7f5005..2949024 100644 --- a/src/main/java/com/waruru/areyouhere/attendee/domain/repository/dto/SessionAttendeeInfo.java +++ b/src/main/java/com/waruru/areyouhere/attendee/domain/repository/dto/SessionAttendeeInfo.java @@ -3,6 +3,8 @@ import java.time.LocalDateTime; public interface SessionAttendeeInfo { + + public Long getAttendeeId(); public String getAttendeeName(); public Boolean getAttendanceStatus(); diff --git a/src/main/java/com/waruru/areyouhere/attendee/service/AttendeeServiceImpl.java b/src/main/java/com/waruru/areyouhere/attendee/service/AttendeeServiceImpl.java index f86308f..0bac932 100644 --- a/src/main/java/com/waruru/areyouhere/attendee/service/AttendeeServiceImpl.java +++ b/src/main/java/com/waruru/areyouhere/attendee/service/AttendeeServiceImpl.java @@ -57,6 +57,7 @@ public List getSessionAttendeesIfExistsOrEmpty(Long sessionId) return sessionAttendees == null || sessionAttendees.isEmpty() ? Collections.emptyList() : sessionAttendees.stream().map(sessionAttendee -> SessionAttendees.builder() + .id(sessionAttendee.getAttendeeId()) .attendeeName(sessionAttendee.getAttendeeName()) .attendanceStatus(sessionAttendee.getAttendanceStatus()) .attendanceTime(sessionAttendee.getAttendanceTime()) @@ -69,6 +70,7 @@ public List getSessionAbsenteesIfExistsOrEmpty(Long sessionId) return sessionAttendees == null || sessionAttendees.isEmpty() ? Collections.emptyList() : sessionAttendees.stream().map(sessionAttendee -> SessionAttendees.builder() + .id(sessionAttendee.getAttendeeId()) .attendeeName(sessionAttendee.getAttendeeName()) .attendanceStatus(sessionAttendee.getAttendanceStatus()) .attendanceTime(sessionAttendee.getAttendanceTime()) diff --git a/src/main/java/com/waruru/areyouhere/attendee/service/dto/SessionAttendees.java b/src/main/java/com/waruru/areyouhere/attendee/service/dto/SessionAttendees.java index 127cd5e..9a0634c 100644 --- a/src/main/java/com/waruru/areyouhere/attendee/service/dto/SessionAttendees.java +++ b/src/main/java/com/waruru/areyouhere/attendee/service/dto/SessionAttendees.java @@ -10,6 +10,8 @@ @Getter public class SessionAttendees { + private Long id; + private String attendeeName; private boolean attendanceStatus; @@ -18,7 +20,8 @@ public class SessionAttendees { @Builder - public SessionAttendees(String attendeeName, boolean attendanceStatus, LocalDateTime attendanceTime) { + public SessionAttendees(Long id, String attendeeName, boolean attendanceStatus, LocalDateTime attendanceTime) { + this.id = id; this.attendeeName = attendeeName; this.attendanceStatus = attendanceStatus; this.attendanceTime = attendanceTime; diff --git a/src/main/java/com/waruru/areyouhere/auth/interceptor/LoginInterceptor.java b/src/main/java/com/waruru/areyouhere/auth/interceptor/LoginInterceptor.java index 20fa850..3f3383a 100644 --- a/src/main/java/com/waruru/areyouhere/auth/interceptor/LoginInterceptor.java +++ b/src/main/java/com/waruru/areyouhere/auth/interceptor/LoginInterceptor.java @@ -28,8 +28,6 @@ public boolean preHandle(HttpServletRequest request, HttpServletResponse respons try { Manager manager = managerService.getLoginUser(); } catch (UnAuthenticatedException e) { - request.setAttribute("message", "로그인이 필요합니다."); - request.setAttribute("exception", "UnAuthenticatedException"); request.getRequestDispatcher("/api/manager/unauthorized").forward(request, response); return false; }