add getNotes method for open notes table

This commit is contained in:
Ryan Prather 2024-05-29 00:32:07 -04:00
parent 2552335513
commit a1e921063a

View File

@ -198,7 +198,7 @@ class AjaxController extends AbstractController
{
$res = new Response();
$data = json_decode($req->getContent());
$ref = $emi->getRepository(Reference::class)->find($data->file);
$ref = $emi->getRepository(Reference::class)->find($data->id);
if (!is_a($ref, Reference::class)) {
$ref = new Reference();
@ -247,6 +247,18 @@ class AjaxController extends AbstractController
return $res;
}
#[Route('/get-notes', name: 'app_get_notes')]
public function getNotes(EntityManagerInterface $emi): Response
{
/** @var User $user */
$user = $this->getUser();
$notes = $emi->getRepository(Note::class)->reverseNoteSort($user);
$res = new Response();
$res->setContent(json_encode(['data'=> $notes]));
return $res;
}
#[Route('/get-note', name: 'app_get_note')]
public function getNote(Request $req, EntityManagerInterface $emi): Response
{