aboutsummaryrefslogtreecommitdiffstats
path: root/backend/routes/forms/discover.py
diff options
context:
space:
mode:
authorGravatar ks129 <[email protected]>2020-12-17 09:30:48 +0200
committerGravatar GitHub <[email protected]>2020-12-17 09:30:48 +0200
commit3d4038b4d96fddaec545682fbb83481299c1029e (patch)
tree7fa8e7a118499d7020a80ff5074253a1973af488 /backend/routes/forms/discover.py
parentMerge pull request #38 from python-discord/submission-timestamp (diff)
parentMerge branch 'main' into docs/api-spec (diff)
Merge pull request #37 from python-discord/docs/api-spec
Provide HTML documentation of endpoints
Diffstat (limited to 'backend/routes/forms/discover.py')
-rw-r--r--backend/routes/forms/discover.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/backend/routes/forms/discover.py b/backend/routes/forms/discover.py
index bba6fd4..9400f05 100644
--- a/backend/routes/forms/discover.py
+++ b/backend/routes/forms/discover.py
@@ -1,11 +1,13 @@
"""
Return a list of all publicly discoverable forms to unauthenticated users.
"""
+from spectree.response import Response
from starlette.requests import Request
from starlette.responses import JSONResponse
-from backend.models import Form
+from backend.models import Form, FormList
from backend.route import Route
+from backend.validation import api
class DiscoverableFormsList(Route):
@@ -16,7 +18,9 @@ class DiscoverableFormsList(Route):
name = "discoverable_forms_list"
path = "/discoverable"
+ @api.validate(resp=Response(HTTP_200=FormList), tags=["forms"])
async def get(self, request: Request) -> JSONResponse:
+ """List all discoverable forms that should be shown on the homepage."""
forms = []
cursor = request.state.db.forms.find({"features": "DISCOVERABLE"})