feat: Add endpoint to retrieve individual note from Anki

This commit is contained in:
Dendy 2025-02-06 16:08:08 +09:00
parent 2353c1fd1a
commit 5586e80768
1 changed files with 16 additions and 5 deletions

View File

@ -7,14 +7,19 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Routing\Attribute\Route;
#[Route('/anki', name: 'app_anki_')]
class AnkiController extends AbstractController class AnkiController extends AbstractController
{ {
#[Route('/anki', name: 'app_anki')] function __construct(
public function index(AnkiService $ankiService): Response private AnkiService $ankiService,
{ ) {}
$note = $ankiService->getLatestNote();
$ankiService->updateNote($note); #[Route('/', name: 'main')]
public function index(): Response
{
$note = $this->ankiService->getLatestNote();
$this->ankiService->updateNote($note);
dd($note); dd($note);
dd($note->toAnki()); dd($note->toAnki());
@ -23,4 +28,10 @@ class AnkiController extends AbstractController
'controller_name' => $latestId, 'controller_name' => $latestId,
]); ]);
} }
#[Route('/note/{nid}/get', name: 'get_note')]
public function get_note(int $nid)
{
dd($this->ankiService->getNote($nid));
}
} }