web: EntryProposal form implementation.

This commit is contained in:
2021-10-26 01:46:59 -05:00
parent e055bee0f3
commit 3675c6054a
32 changed files with 705 additions and 203 deletions

View File

@ -126,9 +126,15 @@ proc start*(cfg: HffEntryFormsApiConfig): void =
get "/version":
jsonResp(Http200, $(%("hff_entry_forms_api v" & HFF_ENTRY_FORMS_API_VERSION)))
options "/add-page": optionsResp(@[HttpPost])
options "/event-proposals/config": optionsResp(@[HttpGet])
post "/propose-event":
get "/event-proposals/config":
withApiErrors:
dataResp(%getEventProposalConfig(cfg))
options "/event-proposals": optionsResp(@[HttpPost])
post "/event-proposals":
withApiErrors:
let ep = parseEventProposal(parseJson(request.body))
if createProposedEvent(cfg, ep): statusResp(Http200)