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

Dev backend #171

Merged
merged 22 commits into from
Jun 30, 2024
Merged
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
0c23e2e
refactor: ReadNews ๋„๋ฉ”์ธ ๋ถ„๋ฆฌ
yeonjy Jun 22, 2024
e13bb2a
refactor: ReadNews๋„๋ฉ”์ธ ๋ถ„๋ฆฌ ์ ์šฉ
yeonjy Jun 29, 2024
8e786ec
refactor: ReadNews ๋„๋ฉ”์ธ ๋ถ„๋ฆฌ api Test์— ์ ์šฉ
yeonjy Jun 29, 2024
167d066
refactor: ReadNews ๋„๋ฉ”์ธ ๋ถ„๋ฆฌ repository Test ์ ์šฉ
yeonjy Jun 29, 2024
83d8a83
refactor: ํ•„์š”์—†๋Š” mock bean ์ฃผ์ž… ์‚ญ์ œ
yeonjy Jun 29, 2024
b6a091a
refactor: lambda -> method reference
yeonjy Jun 29, 2024
54e2364
Merge pull request #168 from tukcomCD2024/refactor/#166-devide-news-rโ€ฆ
yeonjy Jun 29, 2024
0417379
Merge remote-tracking branch 'origin/Dev-backend' into feat/#169-backโ€ฆ
yeonjy Jun 29, 2024
2a702cb
feat: success response
yeonjy Jun 30, 2024
3308737
refactor: directory config -> common
yeonjy Jun 30, 2024
7f57204
feat: BookmarkApi์— success response ์ ์šฉ
yeonjy Jun 30, 2024
b43489d
refactor: BaseTimeEntity directory ์ด๋™ ์ ์šฉ
yeonjy Jun 30, 2024
dc2bca4
feat: Debate API ์— Success Response ์ ์šฉ
yeonjy Jun 30, 2024
cebd6bf
feat: Member API์— Success Response ์ ์šฉ
yeonjy Jun 30, 2024
107726b
feat: News API์— Success Response ์ ์šฉ
yeonjy Jun 30, 2024
d94fb91
feat: ReadNews API์— Success Response ์ ์šฉ
yeonjy Jun 30, 2024
e33a25e
feat: Statistics API์— Success Response ์ ์šฉ
yeonjy Jun 30, 2024
7c4567d
feat: Auth API์— Success Response ์ ์šฉ
yeonjy Jun 30, 2024
86c8b0a
feat: success message ์ˆ˜์ •
yeonjy Jun 30, 2024
79686b8
refactor: swagger tags -> @Tag
yeonjy Jun 30, 2024
43f0208
refactor: ํ•„์š”์—†๋Š” log ์‚ญ์ œ
yeonjy Jun 30, 2024
e60c1d6
Merge pull request #170 from tukcomCD2024/feat/#169-backend-api-succeโ€ฆ
yeonjy Jun 30, 2024
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
Prev Previous commit
Next Next commit
feat: BookmarkApi์— success response ์ ์šฉ
yeonjy committed Jun 30, 2024

Verified

This commit was signed with the committerโ€™s verified signature.
commit 7f5720476ca7d3dd4205c73b19a6bb0fdd76922b
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@

import com.rollthedice.backend.domain.bookmark.dto.response.BookmarkResponse;
import com.rollthedice.backend.domain.news.dto.response.NewsResponse;
import com.rollthedice.backend.global.common.response.SuccessResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
@@ -22,7 +23,7 @@ public interface BookmarkApi {
responseCode = "200",
description = "OK"
)
List<NewsResponse> getAllBookmarkedNews(
SuccessResponse<List<NewsResponse>> getAllBookmarkedNews(
Pageable pageable
);

@@ -36,7 +37,7 @@ List<NewsResponse> getAllBookmarkedNews(
responseCode = "200",
description = "OK"
)
BookmarkResponse getIsBookmarked(
SuccessResponse<BookmarkResponse> getIsBookmarked(
@Parameter(in = ParameterIn.PATH, description = "๋‰ด์Šค ID", required = true)
Long newsId
);
@@ -52,7 +53,7 @@ BookmarkResponse getIsBookmarked(
responseCode = "201",
description = "Created"
)
void saveBookmark(
SuccessResponse<String> saveBookmark(
@Parameter(in = ParameterIn.PATH, description = "๋‰ด์Šค ID", required = true)
Long newsId
);
@@ -67,7 +68,7 @@ void saveBookmark(
responseCode = "204",
description = "No Content"
)
void deleteBookmark(
SuccessResponse<String> deleteBookmark(
@Parameter(in = ParameterIn.PATH, description = "๋‰ด์Šค ID", required = true)
Long newsId
);
Original file line number Diff line number Diff line change
@@ -3,13 +3,16 @@
import com.rollthedice.backend.domain.bookmark.dto.response.BookmarkResponse;
import com.rollthedice.backend.domain.bookmark.service.BookmarkService;
import com.rollthedice.backend.domain.news.dto.response.NewsResponse;
import com.rollthedice.backend.global.common.response.SuccessResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;

import java.util.List;

import static com.rollthedice.backend.global.common.response.SuccessCode.*;

@RestController
@RequiredArgsConstructor
@RequestMapping("bookmarks")
@@ -19,28 +22,32 @@ public class BookmarkController implements BookmarkApi {
@ResponseStatus(HttpStatus.OK)
@GetMapping("")
@Override
public List<NewsResponse> getAllBookmarkedNews(final Pageable pageable) {
return bookmarkService.getAllBookmarkedNews(pageable);
public SuccessResponse<List<NewsResponse>> getAllBookmarkedNews(final Pageable pageable) {
List<NewsResponse> response = bookmarkService.getAllBookmarkedNews(pageable);
return SuccessResponse.of(GET_ALL_BOOKMARK_SUCCESS, response);
}

@ResponseStatus(HttpStatus.OK)
@GetMapping("/{newsId}")
@Override
public BookmarkResponse getIsBookmarked(@PathVariable final Long newsId) {
return bookmarkService.getIsBookmarked(newsId);
public SuccessResponse<BookmarkResponse> getIsBookmarked(@PathVariable final Long newsId) {
BookmarkResponse response = bookmarkService.getIsBookmarked(newsId);
return SuccessResponse.of(GET_IS_BOOKMARKED_SUCCESS, response);
}

@ResponseStatus(HttpStatus.CREATED)
@PostMapping("/{newsId}")
@Override
public void saveBookmark(@PathVariable final Long newsId) {
public SuccessResponse<String> saveBookmark(@PathVariable final Long newsId) {
bookmarkService.saveBookmark(newsId);
return SuccessResponse.of(CREATE_BOOKMARK_SUCCESS);
}

@ResponseStatus(HttpStatus.NO_CONTENT)
@DeleteMapping("/{newsId}")
@Override
public void deleteBookmark(@PathVariable final Long newsId) {
public SuccessResponse<String> deleteBookmark(@PathVariable final Long newsId) {
bookmarkService.deleteBookmark(newsId);
return SuccessResponse.of(DELETE_BOOKMARK_SUCCESS);
}
}