Skip to content

Commit

Permalink
fix: sessionDetail에서 id를 내려주도록 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
SHEOMM committed Mar 3, 2024
1 parent 2d13389 commit b0194b1
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ public interface AttendeeRepository extends JpaRepository<Attendee, Long> {
@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<Attendee> 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<SessionAttendeeInfo> 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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import java.time.LocalDateTime;

public interface SessionAttendeeInfo {

public Long getAttendeeId();
public String getAttendeeName();

public Boolean getAttendanceStatus();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public List<SessionAttendees> 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())
Expand All @@ -69,6 +70,7 @@ public List<SessionAttendees> 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())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
@Getter
public class SessionAttendees {

private Long id;

private String attendeeName;

private boolean attendanceStatus;
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit b0194b1

Please sign in to comment.