Skip to content

Commit

Permalink
fix: createdDate가 정상적으로 작동하도록 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
SHEOMM committed Feb 22, 2024
1 parent 1346763 commit a33fe98
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.CreatedDate;


import org.springframework.data.jpa.domain.support.AuditingEntityListener;

//TODO: createdTime 별도 테이블로 분리


@Getter
@Entity(name = "attendance")
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@EntityListeners(AuditingEntityListener.class)
public class Attendance {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@
import org.springframework.data.annotation.CreatedDate;

import java.time.LocalDateTime;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

// TODO : jpa Auditing 사용해서 baseEntity 상속하게 만들기

@Getter
@Entity(name = "session")
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@EntityListeners(AuditingEntityListener.class)
public class Session {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ public interface SessionRepository extends JpaRepository<Session, Long>{
public List<Session> findAllByCourseId(@Param("courseId") Long courseId);


@Query("SELECT s FROM session s WHERE s.course.id = :courseId order by s.authCodeCreatedAt desc limit 6")
@Query("SELECT s FROM session s WHERE s.course.id = :courseId order by s.createdAt desc limit 6")
public List<Session> findTOP6BySessionByCourseId(@Param("courseId") Long courseId);

@Query("SELECT s FROM session s WHERE s.course.id = :courseId order by s.authCodeCreatedAt desc limit 1")
@Query("SELECT s FROM session s WHERE s.course.id = :courseId order by s.createdAt desc limit 1")
public Optional<Session> findMostRecentSessionByCourseId(@Param("courseId") Long courseId);

//find attendee who participate particular course and no attendance in particular session by query
Expand Down

0 comments on commit a33fe98

Please sign in to comment.