From 296ee9774e53d990f73bf7f56edc5ec351f0609f Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Sun, 13 Dec 2020 20:44:28 +0200 Subject: Update form interface and add features --- src/api/forms.ts | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'src/api/forms.ts') diff --git a/src/api/forms.ts b/src/api/forms.ts index a4a4981..c20a587 100644 --- a/src/api/forms.ts +++ b/src/api/forms.ts @@ -1,17 +1,22 @@ import { Question, QuestionType } from "./question" -export interface AllFormsForm { - title: string, - id: string, - description: string, - open: boolean +export enum FormFeatures { + Discoverable = "DISCOVERABLE", + RequiresLogin = "REQUIRES_LOGIN", + Open = "OPEN", + CollectEmail = "COLLECT_EMAIL", + DisableAntispam = "DISABLE_ANTISPAM" } -export interface Form extends AllFormsForm { - questions: Array +export interface Form { + id: string, + features: Array, + questions: Array, + name: string, + description: string } -export function getForms(): AllFormsForm[] { +export function getForms(): Form[] { return [ { title: "Ban Appeals", @@ -36,14 +41,16 @@ export function getForms(): AllFormsForm[] { export function getForm(id: string): Promise
{ const data: Form = { - title: "Ban Appeals", + name: "Ban Appeals", id: "ban-appeals", description: "Appealing bans from the Discord server", - open: true, + features: [FormFeatures.Discoverable, FormFeatures.Open], questions: [ { + id: "how-spanish-are-you", name: "How Spanish are you?", - type: QuestionType.Text + type: QuestionType.ShortText, + data: {} } ] } -- cgit v1.2.3