api: Add support for location in proposed events.

This commit is contained in:
Jonathan Bernard 2021-10-26 11:53:17 -05:00
parent 1d792f96bb
commit efa6ca215e

View File

@ -7,6 +7,7 @@ type
purpose*: string purpose*: string
department*: string department*: string
owner*: string owner*: string
location*: string
date*: DateTime date*: DateTime
budgetInDollars*: int budgetInDollars*: int
@ -41,6 +42,7 @@ proc parseEventProposal*(n: JsonNode): EventProposal {.raises: [JsonParsingError
description: n.getOrFail("description").getStr, description: n.getOrFail("description").getStr,
purpose: n.getOrFail("purpose").getStr, purpose: n.getOrFail("purpose").getStr,
department: n.getOrFail("department").getStr, department: n.getOrFail("department").getStr,
location: n.getOrFail("location").getStr,
owner: n.getOrFail("owner").getStr, owner: n.getOrFail("owner").getStr,
date: n.parseIso8601("date"), date: n.parseIso8601("date"),
budgetInDollars: n.getOrFail("budgetInDollars").getInt) budgetInDollars: n.getOrFail("budgetInDollars").getInt)
@ -53,7 +55,7 @@ proc asNotionPage*(ep: EventProposal): JsonNode =
"Event": { "title": textProp(ep.name) }, "Event": { "title": textProp(ep.name) },
"Date": { "date": { "start": formatIso8601(ep.date) } }, "Date": { "date": { "start": formatIso8601(ep.date) } },
"Department": { "multi_select": [ { "name": ep.department } ] }, "Department": { "multi_select": [ { "name": ep.department } ] },
"Location": { "rich_text": textProp("") }, "Location": { "rich_text": textProp(ep.location) },
"Owner": { "rich_text": textProp(ep.owner) }, "Owner": { "rich_text": textProp(ep.owner) },
"State": { "select": { "name": "Proposed" } } "State": { "select": { "name": "Proposed" } }
}, },