2019-12-30 01:51:55 +00:00
|
|
|
from starlette.requests import Request
|
|
|
|
from starlette.responses import *
|
|
|
|
from royalnet.constellation import *
|
|
|
|
from royalnet.utils import *
|
|
|
|
from royalnet.backpack.tables import *
|
|
|
|
from ..tables import *
|
2020-02-09 18:12:34 +00:00
|
|
|
from royalnet.constellation.api import *
|
2019-12-30 01:51:55 +00:00
|
|
|
|
|
|
|
|
2020-02-11 18:53:18 +00:00
|
|
|
class ApiWikiListStar(ApiStar):
|
2020-02-09 18:12:34 +00:00
|
|
|
path = "/api/wiki/list/v1"
|
2019-12-30 01:51:55 +00:00
|
|
|
|
2020-03-09 20:21:07 +00:00
|
|
|
summary = "Get a list of available wiki pages."
|
|
|
|
|
|
|
|
tags = ["wiki"]
|
|
|
|
|
2020-03-04 18:57:34 +00:00
|
|
|
async def api(self, data: ApiData) -> JSON:
|
2020-02-09 18:12:34 +00:00
|
|
|
pages: typing.List[WikiPage] = await asyncify(data.session.query(self.alchemy.get(WikiPage)).all)
|
2020-03-04 18:57:34 +00:00
|
|
|
return [page.json_list() for page in sorted(pages, key=lambda p: p.title)]
|