1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00
royalnet/royalpack/stars/api_diario.py
2020-06-22 19:27:11 +02:00

23 lines
625 B
Python

from royalnet.constellation.api import *
from royalnet.utils import *
from ..tables import *
class ApiDiarioGetStar(ApiStar):
path = "/api/diario/v2"
parameters = {
"get": {
"id": "The id of the diario entry to get."
}
}
tags = ["diario"]
async def get(self, data: ApiData) -> JSON:
"""Get a specific diario entry."""
diario_id = data.int("id")
entry: Diario = await asyncify(data.session.query(self.alchemy.get(Diario)).get, diario_id)
if entry is None:
raise NotFoundError("No such diario entry.")
return entry.json()