From 3fdf2d748f519c4d66cc9a83de03ac0013ea9837 Mon Sep 17 00:00:00 2001 From: theyokohamalife Date: Thu, 7 Dec 2023 02:14:11 +0900 Subject: [PATCH 1/3] update submission store --- stores/submissionStore.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/stores/submissionStore.ts b/stores/submissionStore.ts index 127a0628..1d777d79 100644 --- a/stores/submissionStore.ts +++ b/stores/submissionStore.ts @@ -10,6 +10,21 @@ export const useSubmissionStore = defineStore('submissionStore', () => { const otherNotes = ref('') const submissionCompleted = ref(false) + const createSubmissionMutation = gql`mutation CreateSubmission($input: CreateSubmissionInput!) { + createSubmission(input: $input) { + id + googleMapsUrl + healthcareProfessionalName + spokenLanguages + isApproved + isRejected + isUnderReview + createdDate + updatedDate + } + }` + + function submit() { const spokenLanguages = [] @@ -30,6 +45,13 @@ export const useSubmissionStore = defineStore('submissionStore', () => { } console.log('submission =', submission) + const createSubmissionRequest = { + query: createSubmissionMutation, + variables: { + input: submission + } + } + submissionCompleted.value = true } From bddafcb906d6d406e57d0391f751bdb32184b7a3 Mon Sep 17 00:00:00 2001 From: theyokohamalife Date: Thu, 7 Dec 2023 02:34:53 +0900 Subject: [PATCH 2/3] updating store need notes --- stores/submissionStore.ts | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/stores/submissionStore.ts b/stores/submissionStore.ts index 1d777d79..ab68958d 100644 --- a/stores/submissionStore.ts +++ b/stores/submissionStore.ts @@ -1,5 +1,9 @@ import { defineStore } from "pinia" import { ref } from 'vue' +import { useMutation } from '@vue/apollo-composable' +import gql from 'graphql-tag' +import { CreateSubmissionInput, Locale } from "~/typedefs/gqlTypes" +import { as } from "vitest/dist/reporters-5f784f42.js" export const useSubmissionStore = defineStore('submissionStore', () => { const location = ref('') @@ -25,16 +29,18 @@ export const useSubmissionStore = defineStore('submissionStore', () => { }` + + function submit() { - const spokenLanguages = [] + const spokenLanguages: Locale[] = [] if (selectLanguage1.value !== '') { console.log('selectLanguage1 =', selectLanguage1) - spokenLanguages.push(selectLanguage1.value) + spokenLanguages.push(selectLanguage1.value as Locale) } if (selectLanguage2.value !== '') { - spokenLanguages.push(selectLanguage2.value) + spokenLanguages.push(selectLanguage2.value as Locale) } const submission = { @@ -42,15 +48,12 @@ export const useSubmissionStore = defineStore('submissionStore', () => { "healthcareProfessionalName": `${firstName.value} ${lastName.value}`, "spokenLanguages": spokenLanguages, "notes": otherNotes.value - } + } satisfies CreateSubmissionInput console.log('submission =', submission) - const createSubmissionRequest = { - query: createSubmissionMutation, - variables: { - input: submission - } - } + const createSubmissionData = {input: submission} + + const { error } = useMutation(createSubmissionMutation, createSubmissionData) submissionCompleted.value = true } From 76afc089a549e894cfb456a11ed62df1c2cd1a2c Mon Sep 17 00:00:00 2001 From: theyokohamalife Date: Thu, 7 Dec 2023 03:24:56 +0900 Subject: [PATCH 3/3] submission form is working --- stores/submissionStore.ts | 9 ++++----- typedefs/gqlTypes.ts | 7 +++++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/stores/submissionStore.ts b/stores/submissionStore.ts index ab68958d..d103886f 100644 --- a/stores/submissionStore.ts +++ b/stores/submissionStore.ts @@ -1,9 +1,8 @@ import { defineStore } from "pinia" -import { ref } from 'vue' +import { ref, watch } from 'vue' import { useMutation } from '@vue/apollo-composable' import gql from 'graphql-tag' import { CreateSubmissionInput, Locale } from "~/typedefs/gqlTypes" -import { as } from "vitest/dist/reporters-5f784f42.js" export const useSubmissionStore = defineStore('submissionStore', () => { const location = ref('') @@ -49,12 +48,12 @@ export const useSubmissionStore = defineStore('submissionStore', () => { "spokenLanguages": spokenLanguages, "notes": otherNotes.value } satisfies CreateSubmissionInput - console.log('submission =', submission) - const createSubmissionData = {input: submission} + console.log('submission =', submission) - const { error } = useMutation(createSubmissionMutation, createSubmissionData) + const { mutate: sendSubmission } = useMutation(createSubmissionMutation, () => ({variables: {input: submission}})) + sendSubmission() submissionCompleted.value = true } diff --git a/typedefs/gqlTypes.ts b/typedefs/gqlTypes.ts index 9959be0f..203bb2a6 100644 --- a/typedefs/gqlTypes.ts +++ b/typedefs/gqlTypes.ts @@ -52,6 +52,7 @@ export type CreateHealthcareProfessionalInput = { export type CreateSubmissionInput = { googleMapsUrl?: InputMaybe; healthcareProfessionalName?: InputMaybe; + notes?: InputMaybe; spokenLanguages?: InputMaybe>; }; @@ -64,7 +65,6 @@ export enum Degree { Do = 'DO', Dpm = 'DPM', Dpt = 'DPT', - DPhil = 'DPhil', Dsw = 'DSW', DSc = 'DSc', Dvm = 'DVM', @@ -180,7 +180,6 @@ export enum Locale { EtEe = 'et_EE', FaAf = 'fa_AF', FiFi = 'fi_FI', - FilPh = 'fil_PH', FrFr = 'fr_FR', GuzKe = 'guz_KE', HeIl = 'he_IL', @@ -211,6 +210,7 @@ export enum Locale { SrCyrl = 'sr_Cyrl', SwKe = 'sw_KE', ThTh = 'th_TH', + TlPh = 'tl_PH', TrTr = 'tr_TR', ViVn = 'vi_VN', ZhCn = 'zh_CN', @@ -414,6 +414,7 @@ export type Submission = { isApproved: Scalars['Boolean']; isRejected: Scalars['Boolean']; isUnderReview: Scalars['Boolean']; + notes?: Maybe; spokenLanguages: Array; updatedDate: Scalars['String']; }; @@ -458,6 +459,7 @@ export type UpdateSubmissionInput = { isApproved?: InputMaybe; isRejected?: InputMaybe; isUnderReview?: InputMaybe; + notes?: InputMaybe; spokenLanguages?: InputMaybe>; }; @@ -716,6 +718,7 @@ export type SubmissionResolvers; isRejected?: Resolver; isUnderReview?: Resolver; + notes?: Resolver, ParentType, ContextType>; spokenLanguages?: Resolver, ParentType, ContextType>; updatedDate?: Resolver; __isTypeOf?: IsTypeOfResolverFn;