-
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.
Browse files
Browse the repository at this point in the history
refactor(thumbsup): thumbsup 도메인 리팩토링
- Loading branch information
Showing
19 changed files
with
314 additions
and
207 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
13 changes: 0 additions & 13 deletions
13
src/main/java/com/project/bumawiki/domain/thumbsup/exception/AlreadyThumbsUpException.java
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
src/main/java/com/project/bumawiki/domain/thumbsup/exception/NoDocsYouThumbsUpException.java
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
src/main/java/com/project/bumawiki/domain/thumbsup/exception/YouDontThumbsUpThisDocs.java
This file was deleted.
Oops, something went wrong.
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: 0 additions & 31 deletions
31
src/main/java/com/project/bumawiki/domain/thumbsup/presentation/ThumbsUpCheckController.java
This file was deleted.
Oops, something went wrong.
72 changes: 72 additions & 0 deletions
72
src/main/java/com/project/bumawiki/domain/thumbsup/presentation/ThumbsUpController.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,72 @@ | ||
package com.project.bumawiki.domain.thumbsup.presentation; | ||
|
||
import java.util.List; | ||
|
||
import org.springframework.http.HttpStatus; | ||
import org.springframework.web.bind.annotation.DeleteMapping; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.ResponseStatus; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import com.project.bumawiki.domain.auth.annotation.LoginOrNot; | ||
import com.project.bumawiki.domain.auth.annotation.LoginRequired; | ||
import com.project.bumawiki.domain.auth.service.QueryAuthService; | ||
import com.project.bumawiki.domain.thumbsup.presentation.dto.ThumbsUpCountResponseDto; | ||
import com.project.bumawiki.domain.thumbsup.presentation.dto.ThumbsUpRequestDto; | ||
import com.project.bumawiki.domain.thumbsup.presentation.dto.ThumbsUpResponseDto; | ||
import com.project.bumawiki.domain.thumbsup.service.CommandThumbsUpService; | ||
import com.project.bumawiki.domain.thumbsup.service.QueryThumbsUpService; | ||
|
||
import jakarta.validation.Valid; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@Valid | ||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/api/thumbsup") | ||
public class ThumbsUpController { | ||
private final QueryThumbsUpService queryThumbsUpService; | ||
private final CommandThumbsUpService commandThumbsUpService; | ||
private final QueryAuthService queryAuthService; | ||
|
||
@LoginRequired | ||
@PostMapping | ||
public void createLike(@RequestBody ThumbsUpRequestDto thumbsUpRequestDto) { | ||
commandThumbsUpService.createThumbsUp(queryAuthService.getCurrentUser(), thumbsUpRequestDto.docsId()); | ||
} | ||
|
||
@LoginOrNot | ||
@GetMapping("/like/{docsId}") | ||
@ResponseStatus(HttpStatus.OK) | ||
public Boolean checkYouLikeThis(@PathVariable Long docsId) { | ||
return queryThumbsUpService.checkUserLikeThisDocs( | ||
docsId, queryAuthService.getNullableCurrentUser() | ||
); | ||
} | ||
|
||
@LoginRequired | ||
@GetMapping("/my") | ||
public List<ThumbsUpResponseDto> getThumbsUps() { | ||
return queryThumbsUpService.getThumbsUp(queryAuthService.getCurrentUser()) | ||
.stream() | ||
.map(ThumbsUpResponseDto::new) | ||
.toList(); | ||
} | ||
|
||
@GetMapping("/{title}") | ||
public ThumbsUpCountResponseDto getThumbsUpCount(@PathVariable String title) { | ||
return new ThumbsUpCountResponseDto( | ||
queryThumbsUpService.countThumbsUpByDocsTitle(title) | ||
); | ||
} | ||
|
||
@LoginRequired | ||
@DeleteMapping | ||
public void cancel(@RequestBody ThumbsUpRequestDto thumbsUpRequestDto) { | ||
commandThumbsUpService.cancelThumbsUp(queryAuthService.getCurrentUser(), thumbsUpRequestDto.docsId()); | ||
} | ||
} |
44 changes: 0 additions & 44 deletions
44
...java/com/project/bumawiki/domain/thumbsup/presentation/ThumbsUpInformationController.java
This file was deleted.
Oops, something went wrong.
36 changes: 0 additions & 36 deletions
36
.../java/com/project/bumawiki/domain/thumbsup/presentation/ThumbsUpManipulateController.java
This file was deleted.
Oops, something went wrong.
10 changes: 0 additions & 10 deletions
10
...n/java/com/project/bumawiki/domain/thumbsup/presentation/dto/DocsThumbsUpResponseDto.java
This file was deleted.
Oops, something went wrong.
4 changes: 4 additions & 0 deletions
4
.../java/com/project/bumawiki/domain/thumbsup/presentation/dto/ThumbsUpCountResponseDto.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,4 @@ | ||
package com.project.bumawiki.domain.thumbsup.presentation.dto; | ||
|
||
public record ThumbsUpCountResponseDto(Long thumbsUpsCount) { | ||
} |
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
20 changes: 0 additions & 20 deletions
20
src/main/java/com/project/bumawiki/domain/thumbsup/service/ThumbsUpCountService.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.