Skip to content

Commit

Permalink
feat: saveBookmark & deleteBookmark 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
yeonjy committed Apr 20, 2024
1 parent 5c19680 commit 562a2df
Showing 1 changed file with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequiredArgsConstructor
@RequestMapping("bookmark")
@RequestMapping("bookmarks")
public class BookmarkController {
private final BookmarkService bookmarkService;

Expand All @@ -24,4 +21,15 @@ public List<NewsResponse> getBookmarked(final Pageable pageable) {
return bookmarkService.getBookmarkedNews(pageable);
}

@ResponseStatus(HttpStatus.CREATED)
@PostMapping("/{newsId}")
public void saveBookmark(@PathVariable final Long newsId) {
bookmarkService.saveBookmark(newsId);
}

@ResponseStatus(HttpStatus.NO_CONTENT)
@DeleteMapping("/{newsId}")
public void deleteBookmark(@PathVariable final Long newsId) {
bookmarkService.deleteBookmark(newsId);
}
}

0 comments on commit 562a2df

Please sign in to comment.