update notification reader

This commit is contained in:
Ryan Prather 2025-01-01 05:59:21 +00:00
parent af41590fd3
commit c3bc40561b

View File

@ -21,10 +21,15 @@ class MessageController extends AbstractController
#[Route('/api/notifications/{msgId}', name: 'app_read_message')]
public function readMessage(string $msgId): Response
{
/** @var Messages $message */
$message = $this->entityManager->getRepository(Messages::class)->find($msgId);
$message->setReceived(new \DateTimeImmutable());
$this->entityManager->flush();
return new JsonResponse(true, Response::HTTP_OK);
return $this->json([
'success' => true,
'message' => 'Message marked as read',
'link' => $message->getLink(),
]);
}
}