Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feat/user' into feat/user
Browse files Browse the repository at this point in the history
  • Loading branch information
tlarbals824 committed May 24, 2023
2 parents c961a56 + c3ce7d2 commit b674690
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,17 @@ public class CommentInfoResponse {
private final String description;
private final String writer;
private final String writerProfileImageUrl;
private final boolean deleted;
private final boolean changeable;
private List<CommentInfoResponse> child;

@Builder
public CommentInfoResponse(Long commentId, String description, String writer, String writerProfileImageUrl, boolean changeable) {
public CommentInfoResponse(Long commentId, String description, String writer, String writerProfileImageUrl, boolean deleted, boolean changeable) {
this.commentId = commentId;
this.description = description;
this.writer = writer;
this.writerProfileImageUrl = writerProfileImageUrl;
this.deleted = deleted;
this.changeable = changeable;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public static CommentInfoResponse mapToCommentInfoResponse(Comment comment, User
.description(comment.getDescription())
.writer(writer.getNickname())
.writerProfileImageUrl(writer.getMypet().getPetImageUrl())
.deleted(comment.isDeleted())
.changeable(Objects.equals(writer.getId(), accessUser.getId()))
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,20 @@
import com.kusitms.samsion.domain.comment.application.mapper.CommentMapper;
import com.kusitms.samsion.domain.comment.domain.entity.Comment;
import com.kusitms.samsion.domain.comment.domain.service.CommentQueryService;
import com.kusitms.samsion.domain.comment.domain.service.CommentSaveService;
import com.kusitms.samsion.domain.comment.domain.service.CommentValidAccessService;
import com.kusitms.samsion.domain.user.domain.entity.User;
import lombok.RequiredArgsConstructor;

import javax.transaction.Transactional;

@UseCase
@RequiredArgsConstructor
public class CommentUpdateUseCase {
private final UserUtils userUtils;
private final CommentQueryService commentQueryService;
private final CommentValidAccessService commentValidAccessService;
@Transactional
public CommentInfoResponse updateComment(Long commentId, CommentUpdateRequest commentUpdateRequest) {
final User user = userUtils.getUser();
final Comment comment = commentQueryService.getCommentById(commentId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public CommentInfoResponse update(@PathVariable Long commentId, @RequestBody Com

@CacheEvict(value = CachingStoreConst.COMMENT_COUNT_CACHE_NAME, key = "#albumId",condition="#albumId!=null")
@DeleteMapping("/{albumId}/comment/{commentId}")
public void delete(@PathVariable Long commentId){
public void delete(@PathVariable Long albumId,@PathVariable Long commentId){
commentDeleteUseCase.deleteComment(commentId);
}

Expand Down
38 changes: 34 additions & 4 deletions src/main/resources/static/docs/Comment-API.html
Original file line number Diff line number Diff line change
Expand Up @@ -534,13 +534,14 @@ <h4 id="Comment-๋Œ“๊ธ€-์ €์žฅ_http_response">HTTP response</h4>
<div class="content">
<pre class="highlight nowrap"><code class="language-http" data-lang="http">HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 159
Content-Length: 181

{
"commentId" : 1,
"description" : "testCommentDescription",
"writer" : "test",
"writerProfileImageUrl" : "testImageUrl",
"deleted" : false,
"changeable" : true
}</code></pre>
</div>
Expand Down Expand Up @@ -583,6 +584,11 @@ <h4 id="Comment-๋Œ“๊ธ€-์ €์žฅ_response_fields">Response fields</h4>
<td class="tableblock halign-left valign-top"><p class="tableblock">์ž‘์„ฑ์ž ํ”„๋กœํ•„ ์‚ฌ์ง„</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>deleted</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>Boolean</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">์‚ญ์ œ ์—ฌ๋ถ€. ์‚ญ์ œ ๋˜์—ˆ์œผ๋ฉด true, ์•„๋‹ˆ๋ฉด false</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>changeable</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>Boolean</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">๋ณ€๊ฒฝ ๊ฐ€๋Šฅ ์—ฌ๋ถ€</p></td>
Expand Down Expand Up @@ -687,13 +693,14 @@ <h4 id="Comment-๋Œ€๋Œ“๊ธ€-์ €์žฅ_http_response">HTTP response</h4>
<div class="content">
<pre class="highlight nowrap"><code class="language-http" data-lang="http">HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 164
Content-Length: 186

{
"commentId" : 2,
"description" : "testChildCommentDescription",
"writer" : "test",
"writerProfileImageUrl" : "testImageUrl",
"deleted" : false,
"changeable" : true
}</code></pre>
</div>
Expand Down Expand Up @@ -736,6 +743,11 @@ <h4 id="Comment-๋Œ€๋Œ“๊ธ€-์ €์žฅ_response_fields">Response fields</h4>
<td class="tableblock halign-left valign-top"><p class="tableblock">์ž‘์„ฑ์ž ํ”„๋กœํ•„ ์‚ฌ์ง„</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>deleted</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>Boolean</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">์‚ญ์ œ ์—ฌ๋ถ€. ์‚ญ์ œ ๋˜์—ˆ์œผ๋ฉด true, ์•„๋‹ˆ๋ฉด false</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>changeable</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>Boolean</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">๋ณ€๊ฒฝ ๊ฐ€๋Šฅ ์—ฌ๋ถ€</p></td>
Expand Down Expand Up @@ -840,13 +852,14 @@ <h4 id="Comment-๋Œ“๊ธ€-์ˆ˜์ •_http_response">HTTP response</h4>
<div class="content">
<pre class="highlight nowrap"><code class="language-http" data-lang="http">HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 165
Content-Length: 187

{
"commentId" : 1,
"description" : "testUpdateCommentDescription",
"writer" : "test",
"writerProfileImageUrl" : "testImageUrl",
"deleted" : false,
"changeable" : true
}</code></pre>
</div>
Expand Down Expand Up @@ -889,6 +902,11 @@ <h4 id="Comment-๋Œ“๊ธ€-์ˆ˜์ •_response_fields">Response fields</h4>
<td class="tableblock halign-left valign-top"><p class="tableblock">์ž‘์„ฑ์ž ํ”„๋กœํ•„ ์‚ฌ์ง„</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>deleted</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>Boolean</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">์‚ญ์ œ ์—ฌ๋ถ€. ์‚ญ์ œ ๋˜์—ˆ์œผ๋ฉด true, ์•„๋‹ˆ๋ฉด false</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>changeable</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>Boolean</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">๋ณ€๊ฒฝ ๊ฐ€๋Šฅ ์—ฌ๋ถ€</p></td>
Expand Down Expand Up @@ -1053,20 +1071,22 @@ <h4 id="Comment-๋Œ“๊ธ€-์กฐํšŒ_http_response">HTTP response</h4>
<div class="content">
<pre class="highlight nowrap"><code class="language-http" data-lang="http">HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 459
Content-Length: 509

{
"content" : [ {
"commentId" : 1,
"description" : "testCommentDescription",
"writer" : "test",
"writerProfileImageUrl" : "testImageUrl",
"deleted" : false,
"changeable" : false,
"child" : [ {
"commentId" : 2,
"description" : "testChildCommentDescription",
"writer" : "test",
"writerProfileImageUrl" : "testImageUrl",
"deleted" : false,
"changeable" : false
} ]
} ],
Expand Down Expand Up @@ -1114,6 +1134,11 @@ <h4 id="Comment-๋Œ“๊ธ€-์กฐํšŒ_response_fields">Response fields</h4>
<td class="tableblock halign-left valign-top"><p class="tableblock">์ž‘์„ฑ์ž ํ”„๋กœํ•„ ์‚ฌ์ง„</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>content[].deleted</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>Boolean</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">์‚ญ์ œ ์—ฌ๋ถ€. ์‚ญ์ œ ๋˜์—ˆ์œผ๋ฉด true, ์•„๋‹ˆ๋ฉด false</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>content[].changeable</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>Boolean</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">๋ณ€๊ฒฝ ๊ฐ€๋Šฅ ์—ฌ๋ถ€</p></td>
Expand All @@ -1139,6 +1164,11 @@ <h4 id="Comment-๋Œ“๊ธ€-์กฐํšŒ_response_fields">Response fields</h4>
<td class="tableblock halign-left valign-top"><p class="tableblock">์ž‘์„ฑ์ž ํ”„๋กœํ•„ ์‚ฌ์ง„</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>content[].child[].deleted</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>Boolean</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">์‚ญ์ œ ์—ฌ๋ถ€. ์‚ญ์ œ ๋˜์—ˆ์œผ๋ฉด true, ์•„๋‹ˆ๋ฉด false</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>content[].child[].changeable</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>Boolean</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">๋ณ€๊ฒฝ ๊ฐ€๋Šฅ ์—ฌ๋ถ€</p></td>
Expand Down
38 changes: 34 additions & 4 deletions src/main/resources/static/docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1725,13 +1725,14 @@ <h4 id="Comment-๋Œ“๊ธ€-์ €์žฅ_http_response"><a class="link" href="#Comment-๋Œ“
<div class="content">
<pre class="highlightjs highlight nowrap"><code data-lang="http" class="language-http hljs">HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 159
Content-Length: 181

{
"commentId" : 1,
"description" : "testCommentDescription",
"writer" : "test",
"writerProfileImageUrl" : "testImageUrl",
"deleted" : false,
"changeable" : true
}</code></pre>
</div>
Expand Down Expand Up @@ -1774,6 +1775,11 @@ <h4 id="Comment-๋Œ“๊ธ€-์ €์žฅ_response_fields"><a class="link" href="#Comment-
<td class="tableblock halign-left valign-top"><p class="tableblock">์ž‘์„ฑ์ž ํ”„๋กœํ•„ ์‚ฌ์ง„</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>deleted</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>Boolean</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">์‚ญ์ œ ์—ฌ๋ถ€. ์‚ญ์ œ ๋˜์—ˆ์œผ๋ฉด true, ์•„๋‹ˆ๋ฉด false</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>changeable</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>Boolean</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">๋ณ€๊ฒฝ ๊ฐ€๋Šฅ ์—ฌ๋ถ€</p></td>
Expand Down Expand Up @@ -1878,13 +1884,14 @@ <h4 id="Comment-๋Œ€๋Œ“๊ธ€-์ €์žฅ_http_response"><a class="link" href="#Comment-
<div class="content">
<pre class="highlightjs highlight nowrap"><code data-lang="http" class="language-http hljs">HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 164
Content-Length: 186

{
"commentId" : 2,
"description" : "testChildCommentDescription",
"writer" : "test",
"writerProfileImageUrl" : "testImageUrl",
"deleted" : false,
"changeable" : true
}</code></pre>
</div>
Expand Down Expand Up @@ -1927,6 +1934,11 @@ <h4 id="Comment-๋Œ€๋Œ“๊ธ€-์ €์žฅ_response_fields"><a class="link" href="#Comment
<td class="tableblock halign-left valign-top"><p class="tableblock">์ž‘์„ฑ์ž ํ”„๋กœํ•„ ์‚ฌ์ง„</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>deleted</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>Boolean</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">์‚ญ์ œ ์—ฌ๋ถ€. ์‚ญ์ œ ๋˜์—ˆ์œผ๋ฉด true, ์•„๋‹ˆ๋ฉด false</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>changeable</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>Boolean</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">๋ณ€๊ฒฝ ๊ฐ€๋Šฅ ์—ฌ๋ถ€</p></td>
Expand Down Expand Up @@ -2031,13 +2043,14 @@ <h4 id="Comment-๋Œ“๊ธ€-์ˆ˜์ •_http_response"><a class="link" href="#Comment-๋Œ“
<div class="content">
<pre class="highlightjs highlight nowrap"><code data-lang="http" class="language-http hljs">HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 165
Content-Length: 187

{
"commentId" : 1,
"description" : "testUpdateCommentDescription",
"writer" : "test",
"writerProfileImageUrl" : "testImageUrl",
"deleted" : false,
"changeable" : true
}</code></pre>
</div>
Expand Down Expand Up @@ -2080,6 +2093,11 @@ <h4 id="Comment-๋Œ“๊ธ€-์ˆ˜์ •_response_fields"><a class="link" href="#Comment-
<td class="tableblock halign-left valign-top"><p class="tableblock">์ž‘์„ฑ์ž ํ”„๋กœํ•„ ์‚ฌ์ง„</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>deleted</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>Boolean</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">์‚ญ์ œ ์—ฌ๋ถ€. ์‚ญ์ œ ๋˜์—ˆ์œผ๋ฉด true, ์•„๋‹ˆ๋ฉด false</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>changeable</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>Boolean</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">๋ณ€๊ฒฝ ๊ฐ€๋Šฅ ์—ฌ๋ถ€</p></td>
Expand Down Expand Up @@ -2244,20 +2262,22 @@ <h4 id="Comment-๋Œ“๊ธ€-์กฐํšŒ_http_response"><a class="link" href="#Comment-๋Œ“
<div class="content">
<pre class="highlightjs highlight nowrap"><code data-lang="http" class="language-http hljs">HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 459
Content-Length: 509

{
"content" : [ {
"commentId" : 1,
"description" : "testCommentDescription",
"writer" : "test",
"writerProfileImageUrl" : "testImageUrl",
"deleted" : false,
"changeable" : false,
"child" : [ {
"commentId" : 2,
"description" : "testChildCommentDescription",
"writer" : "test",
"writerProfileImageUrl" : "testImageUrl",
"deleted" : false,
"changeable" : false
} ]
} ],
Expand Down Expand Up @@ -2305,6 +2325,11 @@ <h4 id="Comment-๋Œ“๊ธ€-์กฐํšŒ_response_fields"><a class="link" href="#Comment-
<td class="tableblock halign-left valign-top"><p class="tableblock">์ž‘์„ฑ์ž ํ”„๋กœํ•„ ์‚ฌ์ง„</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>content[].deleted</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>Boolean</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">์‚ญ์ œ ์—ฌ๋ถ€. ์‚ญ์ œ ๋˜์—ˆ์œผ๋ฉด true, ์•„๋‹ˆ๋ฉด false</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>content[].changeable</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>Boolean</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">๋ณ€๊ฒฝ ๊ฐ€๋Šฅ ์—ฌ๋ถ€</p></td>
Expand All @@ -2330,6 +2355,11 @@ <h4 id="Comment-๋Œ“๊ธ€-์กฐํšŒ_response_fields"><a class="link" href="#Comment-
<td class="tableblock halign-left valign-top"><p class="tableblock">์ž‘์„ฑ์ž ํ”„๋กœํ•„ ์‚ฌ์ง„</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>content[].child[].deleted</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>Boolean</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">์‚ญ์ œ ์—ฌ๋ถ€. ์‚ญ์ œ ๋˜์—ˆ์œผ๋ฉด true, ์•„๋‹ˆ๋ฉด false</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>content[].child[].changeable</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>Boolean</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">๋ณ€๊ฒฝ ๊ฐ€๋Šฅ ์—ฌ๋ถ€</p></td>
Expand Down
Loading

0 comments on commit b674690

Please sign in to comment.