-
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.
- Loading branch information
Showing
8 changed files
with
122 additions
and
17 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
31 changes: 31 additions & 0 deletions
31
threedollar-application/src/main/java/com/threedollar/service/post/PostFacadeService.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 com.threedollar.service.post; | ||
|
||
import com.threedollar.service.post.request.PostAddRequest; | ||
import jakarta.validation.constraints.NotBlank; | ||
import jakarta.validation.constraints.NotNull; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
|
||
@RequiredArgsConstructor | ||
@Service | ||
public class PostFacadeService { | ||
|
||
private final PostService postService; | ||
|
||
public void addPost(PostAddRequest request, | ||
@NotBlank String workspaceId, | ||
String accountId) { | ||
postService.addPost(request, workspaceId, accountId); | ||
} | ||
|
||
|
||
public void deletePost(@NotBlank String workspaceId, | ||
@NotBlank String accountId, | ||
@NotNull Long postId) { | ||
|
||
postService.deletePost(workspaceId, accountId, postId); | ||
|
||
} | ||
|
||
|
||
} |
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
6 changes: 6 additions & 0 deletions
6
...lar-domain/src/main/java/com/threedollar/domain/post/repository/PostRepositoryCustom.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,4 +1,10 @@ | ||
package com.threedollar.domain.post.repository; | ||
|
||
import com.threedollar.domain.post.Post; | ||
|
||
public interface PostRepositoryCustom { | ||
|
||
Post findByIdAndWorkspaceIdAndAccountId(Long postId, | ||
String accountId, | ||
String workspaceId); | ||
} |
24 changes: 23 additions & 1 deletion
24
...domain/src/main/java/com/threedollar/domain/post/repository/PostRepositoryCustomImpl.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,4 +1,26 @@ | ||
package com.threedollar.domain.post.repository; | ||
|
||
public class PostRepositoryCustomImpl implements PostRepositoryCustom{ | ||
import com.querydsl.jpa.impl.JPAQueryFactory; | ||
import com.threedollar.domain.post.Post; | ||
import com.threedollar.domain.post.PostStatus; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
import static com.threedollar.domain.post.QPost.post; | ||
|
||
@RequiredArgsConstructor | ||
public class PostRepositoryCustomImpl implements PostRepositoryCustom { | ||
|
||
private final JPAQueryFactory jpaQueryFactory; | ||
|
||
@Override | ||
public Post findByIdAndWorkspaceIdAndAccountId(Long postId, String accountId, String workspaceId) { | ||
return jpaQueryFactory.selectFrom(post) | ||
.where( | ||
post.workspaceId.eq(workspaceId), | ||
post.accountId.eq(accountId), | ||
post.id.eq(postId), | ||
post.status.eq(PostStatus.ACTIVE) | ||
) | ||
.fetchOne(); | ||
} | ||
} |