-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEAT] 스토어 상세 디자인 조회 구현 - #29
- Loading branch information
Showing
12 changed files
with
136 additions
and
4 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
11 changes: 11 additions & 0 deletions
11
cakey-api/src/main/java/com/cakey/store/dto/StoreDetailAllDesignRes.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,11 @@ | ||
package com.cakey.store.dto; | ||
|
||
import java.util.List; | ||
|
||
public record StoreDetailAllDesignRes( | ||
List<StoreDetailDesign> storeDesignDtoList | ||
){ | ||
public StoreDetailAllDesignRes from(final List<StoreDetailDesign> storeDesignDtoList) { | ||
return new StoreDetailAllDesignRes(storeDesignDtoList); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
cakey-api/src/main/java/com/cakey/store/dto/StoreDetailDesign.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,23 @@ | ||
package com.cakey.store.dto; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.Builder; | ||
|
||
@Builder(access = AccessLevel.PRIVATE) | ||
public record StoreDetailDesign( | ||
long cakeId, | ||
String imageUrl, | ||
boolean isLiked | ||
) { | ||
public static StoreDetailDesign of(final long cakeId, | ||
final String imageUrl, | ||
final boolean isLiked) { | ||
return StoreDetailDesign.builder() | ||
.cakeId(cakeId) | ||
.imageUrl(imageUrl) | ||
.isLiked(isLiked) | ||
.build(); | ||
} | ||
|
||
|
||
} |
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
13 changes: 13 additions & 0 deletions
13
cakey-domain/src/main/java/com/cakey/cake/dto/CakeDesignDto.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,13 @@ | ||
package com.cakey.cake.dto; | ||
|
||
public record CakeDesignDto( | ||
long cakeId, | ||
String cakeImageUrl, | ||
boolean isLiked | ||
) { | ||
public CakeDesignDto(long cakeId, String cakeImageUrl, boolean isLiked) { | ||
this.cakeId = cakeId; | ||
this.cakeImageUrl = cakeImageUrl; | ||
this.isLiked = isLiked; | ||
} | ||
} |
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: 5 additions & 0 deletions
5
cakey-domain/src/main/java/com/cakey/cake/repository/CakeRepository.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,7 +1,12 @@ | ||
package com.cakey.cake.repository; | ||
|
||
import com.cakey.cake.domain.Cake; | ||
import java.util.List; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.data.repository.query.Param; | ||
|
||
public interface CakeRepository extends JpaRepository<Cake, Long>, CakeRepositoryCustom { | ||
@Query("SELECT c FROM Cake c WHERE c.storeId = :storeId ORDER BY c.id DESC") | ||
List<Cake> findAllByStoreId(@Param("storeId") final long storeId); | ||
} |
14 changes: 14 additions & 0 deletions
14
cakey-domain/src/main/java/com/cakey/cakelike/facade/CakeLikesFacade.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,14 @@ | ||
package com.cakey.cakelike.facade; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
public class CakeLikesFacade { | ||
private final CakeLikesRetriever cakeLikesRetriever; | ||
|
||
public boolean existsCakeLikesByCakeIdAndUserId(Long cakeId, Long userId) { | ||
return cakeLikesRetriever.existsCakeLikesByCakeIdAndUserId(cakeId, userId); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
cakey-domain/src/main/java/com/cakey/cakelike/facade/CakeLikesRetriever.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.cakey.cakelike.facade; | ||
|
||
import com.cakey.cakelike.repository.CakeLikesRepository; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
public class CakeLikesRetriever { | ||
private final CakeLikesRepository cakeLikesRepository; | ||
|
||
public boolean existsCakeLikesByCakeIdAndUserId(Long cakeId, Long userId) { | ||
return cakeLikesRepository.existsByCakeIdAndUserId(cakeId, userId); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
cakey-domain/src/main/java/com/cakey/cakelike/repository/CakeLikesRepository.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,8 @@ | ||
package com.cakey.cakelike.repository; | ||
|
||
import com.cakey.cakelike.domain.CakeLikes; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface CakeLikesRepository extends JpaRepository<CakeLikes, Long> { | ||
boolean existsByCakeIdAndUserId(final Long cakeId, final Long userId); | ||
} |
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