added scheduler for delete old or found posts
This commit is contained in:
@@ -2,6 +2,7 @@ package com.krylov.refound.controller;
|
||||
|
||||
import com.krylov.refound.dto.PostRequest;
|
||||
import com.krylov.refound.dto.PostResponse;
|
||||
import com.krylov.refound.dto.StatusUpdateRequest;
|
||||
import com.krylov.refound.enums.PostType;
|
||||
import com.krylov.refound.service.PostService;
|
||||
import java.util.List;
|
||||
@@ -12,9 +13,11 @@ import org.springframework.security.core.Authentication;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PatchMapping;
|
||||
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.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RequestPart;
|
||||
@@ -75,4 +78,12 @@ public class PostController {
|
||||
public void delete(@PathVariable Long id) {
|
||||
service.delete(id);
|
||||
}
|
||||
|
||||
@PatchMapping("/{id}/status")
|
||||
public PostResponse updateStatus(
|
||||
@PathVariable Long id,
|
||||
@RequestBody StatusUpdateRequest request
|
||||
) {
|
||||
return service.updateStatus(id, request.getStatus());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user