added filter on title and description on post

This commit is contained in:
SlimusMinus
2026-07-06 00:47:07 +03:00
parent 04f29001ac
commit 97f28b9eca
6 changed files with 84 additions and 69 deletions

View File

@@ -5,6 +5,7 @@ import com.krylov.refound.service.ChatService;
import com.krylov.refound.service.UserService;
import lombok.RequiredArgsConstructor;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@@ -42,4 +43,17 @@ public class ChatController {
return userService.getUserIdByLogin(login);
}
@DeleteMapping("/{chatId}")
public void deleteChat(@PathVariable Long chatId, Authentication auth) {
Long currentUserId = extractUserId(auth);
chatService.deleteChat(chatId);
}
@PostMapping("/api/v1/chats/{chatId}/read")
public void markAsRead(@PathVariable Long chatId) {
Long userId = (Long) SecurityContextHolder.getContext()
.getAuthentication().getPrincipal(); // или твой способ
chatService.markAsRead(chatId, userId);
}
}