added filter on title and description on post
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user