Something went wrong. Try again.
Add sqlite capabilities to wheke with sqlmodel
Something went wrong. Try again.
538 B · 19 lines
Python
at main
1234567891011121314151617181920from collections.abc import Sequence
from fastapi import APIRouterfrom starlette.status import HTTP_201_CREATED
from .models import Entryfrom .service import EntryServiceInjection
router = APIRouter(tags=["entry"])
@router.get("/entries")async def list_entries(service: EntryServiceInjection) -> Sequence[Entry]: return await service.entries.list()
@router.post("/entries", status_code=HTTP_201_CREATED)async def create_entries(entry: Entry, service: EntryServiceInjection) -> None: await service.entries.create(entry)