-
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.
* [feat] setting command dto * [feat] setting repository * [feat] add logic in Entity * [feat] add login in service and controller * [feat] add error code * [feat] imple repository logic * [feat] add check data logic * [refac] change Favorite imageUrl to imageType * [refac] change FavoriteImage variable name * [refac] fix wrong code
- Loading branch information
1 parent
e7ea8bf
commit b8a706f
Showing
20 changed files
with
236 additions
and
32 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
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: 12 additions & 0 deletions
12
...java/org/hankki/hankkiserver/api/favorite/service/command/FavoriteStoreDeleteCommand.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,12 @@ | ||
package org.hankki.hankkiserver.api.favorite.service.command; | ||
|
||
public record FavoriteStoreDeleteCommand( | ||
Long userId, | ||
Long favoriteId, | ||
Long storeId | ||
) { | ||
|
||
public static FavoriteStoreDeleteCommand of(Long userId, Long favoriteId, Long storeId) { | ||
return new FavoriteStoreDeleteCommand(userId, favoriteId, storeId); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...n/java/org/hankki/hankkiserver/api/favorite/service/command/FavoriteStorePostCommand.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 org.hankki.hankkiserver.api.favorite.service.command; | ||
|
||
import org.hankki.hankkiserver.auth.UserId; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
|
||
public record FavoriteStorePostCommand( | ||
Long userId, | ||
Long favoriteId, | ||
Long storeId | ||
) { | ||
|
||
public static FavoriteStorePostCommand of(Long userId, Long favoriteId, Long storeId) { | ||
return new FavoriteStorePostCommand(userId, favoriteId, storeId); | ||
} | ||
} |
4 changes: 1 addition & 3 deletions
4
...java/org/hankki/hankkiserver/api/favorite/service/response/FavoriteStoreFindResponse.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
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
31 changes: 31 additions & 0 deletions
31
src/main/java/org/hankki/hankkiserver/api/favoritestore/service/FavoriteStoreFinder.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,31 @@ | ||
package org.hankki.hankkiserver.api.favoritestore.service; | ||
|
||
import java.util.Optional; | ||
import lombok.RequiredArgsConstructor; | ||
import org.hankki.hankkiserver.common.code.FavoriteStoreErrorCode; | ||
import org.hankki.hankkiserver.common.code.StoreErrorCode; | ||
import org.hankki.hankkiserver.common.exception.NotFoundException; | ||
import org.hankki.hankkiserver.domain.favorite.model.Favorite; | ||
import org.hankki.hankkiserver.domain.favoritestore.model.FavoriteStore; | ||
import org.hankki.hankkiserver.domain.favoritestore.repository.FavoriteStoreRepository; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
public class FavoriteStoreFinder { | ||
|
||
private final FavoriteStoreRepository favoriteStoreRepository; | ||
|
||
public int countByFavorite(final Favorite favorite) { | ||
return favoriteStoreRepository.countByFavorite(favorite); | ||
} | ||
|
||
public FavoriteStore findByFavoriteIdAndStoreId(final Long favoriteId, final Long storeId) { | ||
return favoriteStoreRepository.findByFavoriteIdAndStoreId(favoriteId, storeId) | ||
.orElseThrow(() -> new NotFoundException(FavoriteStoreErrorCode.FAVORITE_STORE_NOT_FOUND)); | ||
} | ||
|
||
public boolean isExist(final Long favoriteId, final Long storeId) { | ||
return favoriteStoreRepository.isExist(favoriteId, storeId); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/org/hankki/hankkiserver/api/favoritestore/service/FavoriteStoreUpdater.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,17 @@ | ||
package org.hankki.hankkiserver.api.favoritestore.service; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import org.hankki.hankkiserver.domain.favoritestore.model.FavoriteStore; | ||
import org.hankki.hankkiserver.domain.favoritestore.repository.FavoriteStoreRepository; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
public class FavoriteStoreUpdater { | ||
|
||
private final FavoriteStoreRepository favoriteStoreRepository; | ||
|
||
public FavoriteStore save(FavoriteStore favoriteStore) { | ||
return favoriteStoreRepository.save(favoriteStore); | ||
} | ||
} |
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: 3 additions & 2 deletions
5
src/main/java/org/hankki/hankkiserver/api/user/service/response/UserFavoriteResponse.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,14 +1,15 @@ | ||
package org.hankki.hankkiserver.api.user.service.response; | ||
|
||
import org.hankki.hankkiserver.domain.favorite.model.Favorite; | ||
import org.hankki.hankkiserver.domain.favorite.model.FavoriteImage; | ||
|
||
public record UserFavoriteResponse( | ||
Long id, | ||
String title, | ||
String imageUrl | ||
FavoriteImage imageUrl | ||
) { | ||
|
||
public static UserFavoriteResponse of(Favorite favorite) { | ||
return new UserFavoriteResponse(favorite.getId(), favorite.getName(), favorite.getImageUrl()); | ||
return new UserFavoriteResponse(favorite.getId(), favorite.getName(), favorite.getImageType()); | ||
} | ||
} |
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
Oops, something went wrong.