2019-11-11 08:56:08 +00:00
|
|
|
from starlette.requests import Request
|
|
|
|
from starlette.responses import *
|
2019-11-28 01:30:40 +00:00
|
|
|
from royalnet.constellation import *
|
2019-11-11 08:56:08 +00:00
|
|
|
from royalnet.utils import *
|
2019-11-28 01:30:40 +00:00
|
|
|
from royalnet.backpack.tables import *
|
|
|
|
from ..tables import *
|
2019-11-11 08:56:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
class ApiUserListStar(PageStar):
|
|
|
|
path = "/api/user/list"
|
|
|
|
tables = {User}
|
|
|
|
|
|
|
|
async def page(self, request: Request) -> JSONResponse:
|
|
|
|
async with self.alchemy.session_acm() as session:
|
2019-11-28 01:30:40 +00:00
|
|
|
users: typing.List[User] = await asyncify(session.query(self.alchemy.get(User)).all)
|
2019-11-11 08:56:08 +00:00
|
|
|
return JSONResponse([user.json() for user in users])
|