package com.krylov.refound.controller; import com.krylov.refound.dto.PostFilter; import com.krylov.refound.dto.PostRequest; import com.krylov.refound.dto.PostResponse; import com.krylov.refound.entity.Post; import com.krylov.refound.repository.PostRepository; import com.krylov.refound.service.PostService; import java.util.List; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.http.MediaType; 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.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; @RestController @RequestMapping("/api/v1/posts") @RequiredArgsConstructor @Slf4j public class PostController { private final PostService service; @PostMapping public PostRequest create(@RequestBody PostRequest request) { log.info(request.toString()); return service.create(request); } @GetMapping public List getFeed() { return service.getFeed(); } @PutMapping("/{id}") public PostResponse update(@PathVariable Long id, @RequestBody PostRequest request) { return service.update(id, request); } @DeleteMapping("/{id}") public void delete(@PathVariable Long id) { service.delete(id); } }