-
Notifications
You must be signed in to change notification settings - Fork 5
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
16 changed files
with
184 additions
and
158 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package develup.api; | ||
|
||
import java.util.List; | ||
import develup.api.common.ApiResponse; | ||
import develup.application.hashtag.HashTagResponse; | ||
import develup.application.hashtag.HashTagService; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@Tag(name = "해시태그 API") | ||
class HashTagApi { | ||
|
||
private final HashTagService hashTagService; | ||
|
||
public HashTagApi(HashTagService hashTagService) { | ||
this.hashTagService = hashTagService; | ||
} | ||
|
||
@GetMapping("/hash-tags") | ||
@Operation(summary = "해시태그 목록 조회 API", description = "해시태그 목록을 조회합니다.") | ||
public ResponseEntity<ApiResponse<List<HashTagResponse>>> getHashTags() { | ||
List<HashTagResponse> responses = hashTagService.getHashTags(); | ||
|
||
return ResponseEntity.ok(new ApiResponse<>(responses)); | ||
} | ||
} |
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
21 changes: 21 additions & 0 deletions
21
backend/src/main/java/develup/application/hashtag/HashTagService.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,21 @@ | ||
package develup.application.hashtag; | ||
|
||
import java.util.List; | ||
import develup.domain.hashtag.HashTagRepository; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
public class HashTagService { | ||
|
||
private final HashTagRepository hashTagRepository; | ||
|
||
public HashTagService(HashTagRepository hashTagRepository) { | ||
this.hashTagRepository = hashTagRepository; | ||
} | ||
|
||
public List<HashTagResponse> getHashTags() { | ||
return hashTagRepository.findAll().stream() | ||
.map(HashTagResponse::from) | ||
.toList(); | ||
} | ||
} |
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
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.