1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-27 13:34:28 +00:00
royalnet/royalpack/stars/api_diario.py

24 lines
625 B
Python
Raw Normal View History

2020-02-08 00:49:07 +00:00
from royalnet.constellation.api import *
2019-11-11 08:56:08 +00:00
from royalnet.utils import *
from ..tables import *
2019-11-11 08:56:08 +00:00
2020-02-08 00:49:07 +00:00
class ApiDiarioGetStar(ApiStar):
2020-06-22 17:27:11 +00:00
path = "/api/diario/v2"
2020-03-09 20:21:07 +00:00
parameters = {
2020-06-22 17:27:11 +00:00
"get": {
"id": "The id of the diario entry to get."
}
2020-03-09 20:21:07 +00:00
}
tags = ["diario"]
2020-06-22 17:27:11 +00:00
async def get(self, data: ApiData) -> JSON:
"""Get a specific diario entry."""
diario_id = data.int("id")
2020-02-08 00:49:07 +00:00
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()