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_all.py

22 lines
613 B
Python

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