aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Hassan Abouelela <[email protected]>2021-01-04 02:25:55 +0300
committerGravatar Hassan Abouelela <[email protected]>2021-01-04 04:02:21 +0300
commitce316baf3c5615122e3ab41ceedbc78137e86b48 (patch)
tree393091f55f93fc04b7f5d96f2e21665177187d1c /src
parentMerge pull request #73 from python-discord/renovate/html-webpack-plugin-4.x (diff)
Updates Models
Changes the models to match the backend. Signed-off-by: Hassan Abouelela <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/api/forms.ts9
-rw-r--r--src/api/question.ts2
-rw-r--r--src/tests/components/FormListing.test.tsx12
-rw-r--r--src/tests/pages/LandingPage.test.tsx6
4 files changed, 21 insertions, 8 deletions
diff --git a/src/api/forms.ts b/src/api/forms.ts
index aec4b99..3869838 100644
--- a/src/api/forms.ts
+++ b/src/api/forms.ts
@@ -6,17 +6,24 @@ export enum FormFeatures {
RequiresLogin = "REQUIRES_LOGIN",
Open = "OPEN",
CollectEmail = "COLLECT_EMAIL",
- DisableAntispam = "DISABLE_ANTISPAM"
+ DisableAntispam = "DISABLE_ANTISPAM",
+ WEBHOOK_ENABLED = "WEBHOOK_ENABLED"
}
export interface Form {
id: string,
features: Array<FormFeatures>,
+ webhook: WebHook | null,
questions: Array<Question>,
name: string,
description: string
}
+export interface WebHook {
+ url: string,
+ message: string | null
+}
+
export async function getForms(): Promise<Form[]> {
const resp = await ApiClient.get("forms/discoverable");
return resp.data;
diff --git a/src/api/question.ts b/src/api/question.ts
index 18951b9..9824b60 100644
--- a/src/api/question.ts
+++ b/src/api/question.ts
@@ -13,6 +13,6 @@ export interface Question {
id: string,
name: string,
type: QuestionType,
- data: { [key: string]: any },
+ data: { [key: string]: string | string[] },
required: boolean
}
diff --git a/src/tests/components/FormListing.test.tsx b/src/tests/components/FormListing.test.tsx
index ad76381..f071c33 100644
--- a/src/tests/components/FormListing.test.tsx
+++ b/src/tests/components/FormListing.test.tsx
@@ -17,9 +17,11 @@ const openFormListing: Form = {
"id": "my-question",
"name": "My question",
"type": QuestionType.ShortText,
- "data": {}
+ "data": {},
+ required: false
}
- ]
+ ],
+ webhook: null
};
const closedFormListing: Form = {
@@ -32,9 +34,11 @@ const closedFormListing: Form = {
"id": "what-should-i-ask",
"name": "What should I ask?",
"type": QuestionType.ShortText,
- "data": {}
+ "data": {},
+ required: false
}
- ]
+ ],
+ webhook: null
};
test("renders form listing with specified title", () => {
diff --git a/src/tests/pages/LandingPage.test.tsx b/src/tests/pages/LandingPage.test.tsx
index 5635e63..e461815 100644
--- a/src/tests/pages/LandingPage.test.tsx
+++ b/src/tests/pages/LandingPage.test.tsx
@@ -17,9 +17,11 @@ const testingForm: forms.Form = {
"id": "my-question",
"name": "My Question",
"type": QuestionType.ShortText,
- "data": {}
+ "data": {},
+ required: true
}
- ]
+ ],
+ "webhook": null
};
test("renders landing page", () => {