-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MARA-54 : 화면설계서 기반 식자재 추가 API 개발, 리팩토링 (#23)
* 식자재 보관 위치 Enum 상수 IngredientLocation 추가 * 식자재, 식자재 상세 @transactional 추가 * 카테고리별 식자재 이미지, 이름 조회 기능 개발 * 남은 소비기한 기준 식재료 상세 개수 조회 기능 개발 * refactoring : 불필요한 userId 요청 제거, getCurrentLoginUser 사용으로 변경 * 식자재 상세 소비기한 임박 순 조회 기능 구현 * deleted 상수화 관리 (임시) * getIngredientDetail 리팩토링 * Pageable 적용 * IngredientGroupResponse 반환 형태 변경 * 변수명 변경 * findIngredientDetailByIngredientDetailId -> 삭제
- Loading branch information
1 parent
21ca08d
commit b6fa680
Showing
13 changed files
with
150 additions
and
36 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
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
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
12 changes: 11 additions & 1 deletion
12
src/main/kotlin/mara/server/domain/ingredient/IngredientDetailRepository.kt
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,13 +1,23 @@ | ||
package mara.server.domain.ingredient | ||
|
||
import mara.server.domain.refrigerator.Refrigerator | ||
import org.springframework.data.domain.Page | ||
import org.springframework.data.domain.Pageable | ||
import org.springframework.data.jpa.repository.JpaRepository | ||
import org.springframework.data.jpa.repository.Query | ||
import org.springframework.data.repository.query.Param | ||
import org.springframework.stereotype.Repository | ||
import java.time.LocalDateTime | ||
import java.util.Optional | ||
|
||
@Repository | ||
interface IngredientDetailRepository : JpaRepository<IngredientDetail, Long> { | ||
|
||
fun findIngredientDetailByIngredientDetailIdAndIsDeletedIsFalse(ingredientDetailId: Long): Optional<IngredientDetail> | ||
fun findIngredientDetailsByRefrigeratorAndIsDeletedIsFalse(refrigerator: Refrigerator): Optional<List<IngredientDetail>> | ||
|
||
@Query("SELECT count(i) from IngredientDetail i where i.refrigerator in (?1) and i.expirationDate between now() and ?2") | ||
fun findIngredientDetailCountByRefrigeratorAndExpirationDate(refrigerator: List<Refrigerator>, expirationDay: LocalDateTime): Long | ||
|
||
@Query("SELECT i from IngredientDetail i where i.refrigerator in (?1)") | ||
fun findByRefrigerators(@Param("refrigerators")refrigerators: List<Refrigerator>, pageable: Pageable): Page<IngredientDetail> | ||
} |
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
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
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
5 changes: 0 additions & 5 deletions
5
src/main/kotlin/mara/server/domain/refrigerator/RefrigeratorDto.kt
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.