Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat] tag 만들기 response 추가 #119

Merged
merged 1 commit into from
Aug 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import allchive.server.api.tag.model.dto.request.CreateTagRequest;
import allchive.server.api.tag.model.dto.request.UpdateTagRequest;
import allchive.server.api.tag.model.dto.response.AllTagResponse;
import allchive.server.api.tag.model.dto.response.TagResponse;
import allchive.server.api.tag.service.CreateTagUseCase;
import allchive.server.api.tag.service.DeleteTagUseCase;
import allchive.server.api.tag.service.GetAllTagUseCase;
Expand Down Expand Up @@ -33,8 +34,8 @@ public AllTagResponse getAllTag(@RequestParam("latest") Boolean latestStatus) {

@Operation(summary = "태그를 추가합니다.")
@PostMapping()
public void createTag(@RequestBody CreateTagRequest request) {
createTagUseCase.execute(request);
public TagResponse createTag(@RequestBody CreateTagRequest request) {
return createTagUseCase.execute(request);
}

@Operation(summary = "태그를 수정합니다.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import allchive.server.api.config.security.SecurityUtil;
import allchive.server.api.tag.model.dto.request.CreateTagRequest;
import allchive.server.api.tag.model.dto.response.TagResponse;
import allchive.server.api.tag.model.mapper.TagMapper;
import allchive.server.core.annotation.UseCase;
import allchive.server.domain.domains.content.domain.Tag;
Expand All @@ -17,9 +18,10 @@ public class CreateTagUseCase {
private final TagDomainService tagDomainService;

@Transactional
public void execute(CreateTagRequest request) {
public TagResponse execute(CreateTagRequest request) {
Long userId = SecurityUtil.getCurrentUserId();
Tag tag = tagMapper.toEntity(request, userId);
tagDomainService.save(tag);
return TagResponse.from(tag);
}
}
Loading