-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feature/137-backend-search-scroll
- Loading branch information
Showing
34 changed files
with
644 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/main/java/com/example/epari/admin/dto/InstructorApprovalRequestDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.example.epari.admin.dto; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
/** | ||
* 사용자 승인 요청 DTO | ||
*/ | ||
@Data | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class InstructorApprovalRequestDTO { | ||
|
||
private String username; // Cognito username | ||
|
||
private String name; // Username | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/main/java/com/example/epari/admin/exception/ApprovalException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.example.epari.admin.exception; | ||
|
||
import com.example.epari.global.exception.BusinessBaseException; | ||
import com.example.epari.global.exception.ErrorCode; | ||
|
||
/** | ||
* 승인 간 발생하는 예외를 담는 커스텀 예외 클래스 | ||
*/ | ||
public class ApprovalException extends BusinessBaseException { | ||
|
||
public ApprovalException(ErrorCode errorCode) { | ||
super(errorCode); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 28 additions & 23 deletions
51
src/main/java/com/example/epari/admin/repository/AdminInstructorRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,41 @@ | ||
package com.example.epari.admin.repository; | ||
|
||
import com.example.epari.admin.dto.InstructorSearchResponseDTO; | ||
import com.example.epari.user.domain.Instructor; | ||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.data.repository.query.Param; | ||
|
||
import java.util.List; | ||
import com.example.epari.admin.dto.InstructorSearchResponseDTO; | ||
import com.example.epari.user.domain.Instructor; | ||
|
||
/** | ||
* 관리자 - 강사 정보에 대한 데이터베이스 접근을 담당하는 레포지토리 인터페이스 | ||
*/ | ||
public interface AdminInstructorRepository extends JpaRepository<Instructor, Long> { | ||
|
||
/** | ||
* 이메일로 강사를 검색하는 쿼리 메서드 | ||
* - 이메일이 비어있으면 전체 조회 | ||
* - LIKE 검색으로 부분 일치도 허용 | ||
* - 필요한 필드만 DTO로 직접 매핑 | ||
*/ | ||
@Query(""" | ||
SELECT new com.example.epari.admin.dto.InstructorSearchResponseDTO( | ||
i.id, | ||
u.name, | ||
u.email | ||
) | ||
FROM Instructor i | ||
JOIN BaseUser u ON u.id = i.id | ||
WHERE (:email IS NULL OR | ||
:email = '' OR | ||
LOWER(u.email) LIKE LOWER(CONCAT('%', :email, '%'))) | ||
ORDER BY u.name ASC | ||
""") | ||
List<InstructorSearchResponseDTO> searchInstructorsWithDTO(@Param("email") String email); | ||
/** | ||
* 이메일로 강사를 검색하는 쿼리 메서드 | ||
* - 이메일이 비어있으면 전체 조회 | ||
* - LIKE 검색으로 부분 일치도 허용 | ||
* - 필요한 필드만 DTO로 직접 매핑 | ||
*/ | ||
@Query(""" | ||
SELECT new com.example.epari.admin.dto.InstructorSearchResponseDTO( | ||
i.id, | ||
u.name, | ||
u.email | ||
) | ||
FROM Instructor i | ||
JOIN BaseUser u ON u.id = i.id | ||
WHERE (:email IS NULL OR | ||
:email = '' OR | ||
LOWER(u.email) LIKE LOWER(CONCAT('%', :email, '%'))) | ||
ORDER BY u.name ASC | ||
""") | ||
List<InstructorSearchResponseDTO> searchInstructorsWithDTO(@Param("email") String email); | ||
|
||
Optional<Instructor> findByEmail(String email); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.