update notification reader
This commit is contained in:
parent
af41590fd3
commit
c3bc40561b
@ -21,10 +21,15 @@ class MessageController extends AbstractController
|
|||||||
#[Route('/api/notifications/{msgId}', name: 'app_read_message')]
|
#[Route('/api/notifications/{msgId}', name: 'app_read_message')]
|
||||||
public function readMessage(string $msgId): Response
|
public function readMessage(string $msgId): Response
|
||||||
{
|
{
|
||||||
|
/** @var Messages $message */
|
||||||
$message = $this->entityManager->getRepository(Messages::class)->find($msgId);
|
$message = $this->entityManager->getRepository(Messages::class)->find($msgId);
|
||||||
$message->setReceived(new \DateTimeImmutable());
|
$message->setReceived(new \DateTimeImmutable());
|
||||||
$this->entityManager->flush();
|
$this->entityManager->flush();
|
||||||
|
|
||||||
return new JsonResponse(true, Response::HTTP_OK);
|
return $this->json([
|
||||||
|
'success' => true,
|
||||||
|
'message' => 'Message marked as read',
|
||||||
|
'link' => $message->getLink(),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user