1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-24 03:54:20 +00:00
royalnet/royalpack/stars/api_diario_all.py

23 lines
613 B
Python
Raw Normal View History

2020-08-29 18:36:58 +00:00
from typing import *
import royalnet.constellation.api as rca
import royalnet.utils as ru
from ..tables import *
class ApiDiarioAllStar(rca.ApiStar):
path = "/api/diario/all/v2"
tags = ["diario"]
@rca.magic
async def get(self, data: rca.ApiData) -> ru.JSON:
"""Get all diario entries."""
entries: List[Diario] = await ru.asyncify(
data.session
.query(self.alchemy.get(Diario))
.order_by(self.alchemy.get(Diario).diario_id)
.all
)
response = [entry.json() for entry in entries]
return response