added scheduler for delete old or found posts

This commit is contained in:
SlimusMinus
2026-06-25 00:48:55 +03:00
parent 6f90562982
commit ec5cc6cedd
8 changed files with 148 additions and 0 deletions

View File

@@ -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());
}
}