From 650a7374ff383425d2fce669f3a4ef8c82291df2 Mon Sep 17 00:00:00 2001 From: Thomas Ruoff Date: Sun, 8 Nov 2020 23:04:14 +0100 Subject: [PATCH] add phone --- components/wizard/contact.tsx | 9 ++++++++- components/wizard/context/wizardStore.tsx | 2 ++ db/booker.ts | 2 ++ db/index.ts | 3 ++- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/components/wizard/contact.tsx b/components/wizard/contact.tsx index 9a68f26..993ced1 100644 --- a/components/wizard/contact.tsx +++ b/components/wizard/contact.tsx @@ -5,7 +5,7 @@ import Input from '../input' export default function Contact() { const { state, onChangeEvent } = useContext(WizardContext) - const { org, name, email, street, zip, city } = state.formData + const { org, name, email, phone, street, zip, city } = state.formData return ( <> @@ -25,6 +25,13 @@ export default function Contact() { onChange={onChangeEvent} required /> + ( { name: { type: String, required: true }, email: { type: String, required: true, unique: true, minlength: 5 }, + phone: { type: String, required: false }, street: { type: String, required: true }, zip: { type: String, required: true }, city: { type: String, required: true }, diff --git a/db/index.ts b/db/index.ts index 0cb456d..03e67fd 100644 --- a/db/index.ts +++ b/db/index.ts @@ -48,6 +48,7 @@ export async function createBooking({ destination, name, email, + phone, street, zip, city, @@ -80,7 +81,7 @@ export async function createBooking({ let booker = await BookerModel.findOne({ email }).exec() if (!booker) { - booker = new BookerModel({ name, email, street, zip, city }) + booker = new BookerModel({ name, email, phone, street, zip, city }) await booker.save() }