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 *
|
2019-11-28 01:30:40 +00:00
|
|
|
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()
|