1- import { useQuery , UseQueryOptions } from '@tanstack/react-query' ;
1+ import { useQuery , useMutation , UseQueryOptions , UseMutationOptions } from '@tanstack/react-query' ;
22import { fetcher } from './fetcher' ;
33export type Maybe < T > = T | null ;
44export type InputMaybe < T > = Maybe < T > ;
@@ -75,6 +75,7 @@ export type LocationNodeType = {
7575 kind : LocationType ;
7676 parent ?: Maybe < LocationNodeType > ;
7777 parentId ?: Maybe < Scalars [ 'ID' ] [ 'output' ] > ;
78+ patients : Array < PatientType > ;
7879 title : Scalars [ 'String' ] [ 'output' ] ;
7980} ;
8081
@@ -89,6 +90,7 @@ export enum LocationType {
8990
9091export type Mutation = {
9192 __typename ?: 'Mutation' ;
93+ completeTask : TaskType ;
9294 createLocationNode : LocationNodeType ;
9395 createPatient : PatientType ;
9496 createPropertyDefinition : PropertyDefinitionType ;
@@ -97,13 +99,19 @@ export type Mutation = {
9799 deletePatient : Scalars [ 'Boolean' ] [ 'output' ] ;
98100 deletePropertyDefinition : Scalars [ 'Boolean' ] [ 'output' ] ;
99101 deleteTask : Scalars [ 'Boolean' ] [ 'output' ] ;
102+ reopenTask : TaskType ;
100103 updateLocationNode : LocationNodeType ;
101104 updatePatient : PatientType ;
102105 updatePropertyDefinition : PropertyDefinitionType ;
103106 updateTask : TaskType ;
104107} ;
105108
106109
110+ export type MutationCompleteTaskArgs = {
111+ id : Scalars [ 'ID' ] [ 'input' ] ;
112+ } ;
113+
114+
107115export type MutationCreateLocationNodeArgs = {
108116 data : CreateLocationNodeInput ;
109117} ;
@@ -144,6 +152,11 @@ export type MutationDeleteTaskArgs = {
144152} ;
145153
146154
155+ export type MutationReopenTaskArgs = {
156+ id : Scalars [ 'ID' ] [ 'input' ] ;
157+ } ;
158+
159+
147160export type MutationUpdateLocationNodeArgs = {
148161 data : UpdateLocationNodeInput ;
149162 id : Scalars [ 'ID' ] [ 'input' ] ;
@@ -229,12 +242,17 @@ export type PropertyValueType = {
229242export type Query = {
230243 __typename ?: 'Query' ;
231244 locationNode ?: Maybe < LocationNodeType > ;
245+ locationNodes : Array < LocationNodeType > ;
232246 locationRoots : Array < LocationNodeType > ;
247+ me ?: Maybe < UserType > ;
233248 patient ?: Maybe < PatientType > ;
234249 patients : Array < PatientType > ;
235250 propertyDefinitions : Array < PropertyDefinitionType > ;
251+ recentPatients : Array < PatientType > ;
252+ recentTasks : Array < TaskType > ;
236253 task ?: Maybe < TaskType > ;
237254 tasks : Array < TaskType > ;
255+ user ?: Maybe < UserType > ;
238256} ;
239257
240258
@@ -243,6 +261,15 @@ export type QueryLocationNodeArgs = {
243261} ;
244262
245263
264+ export type QueryLocationNodesArgs = {
265+ kind ?: InputMaybe < LocationType > ;
266+ orderByName ?: Scalars [ 'Boolean' ] [ 'input' ] ;
267+ parentId ?: InputMaybe < Scalars [ 'ID' ] [ 'input' ] > ;
268+ recursive ?: Scalars [ 'Boolean' ] [ 'input' ] ;
269+ search ?: InputMaybe < Scalars [ 'String' ] [ 'input' ] > ;
270+ } ;
271+
272+
246273export type QueryPatientArgs = {
247274 id : Scalars [ 'ID' ] [ 'input' ] ;
248275} ;
@@ -253,15 +280,31 @@ export type QueryPatientsArgs = {
253280} ;
254281
255282
283+ export type QueryRecentPatientsArgs = {
284+ limit ?: Scalars [ 'Int' ] [ 'input' ] ;
285+ } ;
286+
287+
288+ export type QueryRecentTasksArgs = {
289+ limit ?: Scalars [ 'Int' ] [ 'input' ] ;
290+ } ;
291+
292+
256293export type QueryTaskArgs = {
257294 id : Scalars [ 'ID' ] [ 'input' ] ;
258295} ;
259296
260297
261298export type QueryTasksArgs = {
299+ assigneeId ?: InputMaybe < Scalars [ 'ID' ] [ 'input' ] > ;
262300 patientId ?: InputMaybe < Scalars [ 'ID' ] [ 'input' ] > ;
263301} ;
264302
303+
304+ export type QueryUserArgs = {
305+ id : Scalars [ 'ID' ] [ 'input' ] ;
306+ } ;
307+
265308export type Subscription = {
266309 __typename ?: 'Subscription' ;
267310 patientCreated : Scalars [ 'ID' ] [ 'output' ] ;
@@ -275,6 +318,8 @@ export type TaskType = {
275318 description ?: Maybe < Scalars [ 'String' ] [ 'output' ] > ;
276319 done : Scalars [ 'Boolean' ] [ 'output' ] ;
277320 id : Scalars [ 'ID' ] [ 'output' ] ;
321+ patient : PatientType ;
322+ patientId : Scalars [ 'ID' ] [ 'output' ] ;
278323 properties : Array < PropertyValueType > ;
279324 title : Scalars [ 'String' ] [ 'output' ] ;
280325 updateDate ?: Maybe < Scalars [ 'DateTime' ] [ 'output' ] > ;
@@ -319,51 +364,122 @@ export type UserType = {
319364 id : Scalars [ 'ID' ] [ 'output' ] ;
320365 lastname ?: Maybe < Scalars [ 'String' ] [ 'output' ] > ;
321366 name : Scalars [ 'String' ] [ 'output' ] ;
367+ tasks : Array < TaskType > ;
322368 title ?: Maybe < Scalars [ 'String' ] [ 'output' ] > ;
369+ username : Scalars [ 'String' ] [ 'output' ] ;
323370} ;
324371
325- export type MyQueryQueryVariables = Exact < { [ key : string ] : never ; } > ;
372+ export type GetMyTasksQueryVariables = Exact < { [ key : string ] : never ; } > ;
373+
374+
375+ export type GetMyTasksQuery = { __typename ?: 'Query' , me ?: { __typename ?: 'UserType' , id : string , tasks : Array < { __typename ?: 'TaskType' , id : string , title : string , description ?: string | null , done : boolean , creationDate : any , patient : { __typename ?: 'PatientType' , id : string , name : string , assignedLocation ?: { __typename ?: 'LocationNodeType' , id : string , title : string , parent ?: { __typename ?: 'LocationNodeType' , id : string , title : string } | null } | null } , assignee ?: { __typename ?: 'UserType' , id : string , name : string , avatarUrl ?: string | null } | null } > } | null } ;
376+
377+ export type CompleteTaskMutationVariables = Exact < {
378+ id : Scalars [ 'ID' ] [ 'input' ] ;
379+ } > ;
380+
381+
382+ export type CompleteTaskMutation = { __typename ?: 'Mutation' , completeTask : { __typename ?: 'TaskType' , id : string , done : boolean , updateDate ?: any | null } } ;
383+
384+ export type ReopenTaskMutationVariables = Exact < {
385+ id : Scalars [ 'ID' ] [ 'input' ] ;
386+ } > ;
326387
327388
328- export type MyQueryQuery = { __typename ?: 'Query ' , patients : Array < { __typename ?: 'PatientType ' , age : number , assignedLocationId ?: string | null , birthdate : any , firstname : string , gender : Gender , id : string , lastname : string , name : string , properties : Array < { __typename ?: 'PropertyValueType' , definition : { __typename ?: 'PropertyDefinitionType' , allowedEntities : Array < PropertyEntity > } } > , tasks : Array < { __typename ?: 'TaskType' , id : string } > } > } ;
389+ export type ReopenTaskMutation = { __typename ?: 'Mutation ' , reopenTask : { __typename ?: 'TaskType ' , id : string , done : boolean , updateDate ?: any | null } } ;
329390
330391
331392
332- export const MyQueryDocument = `
333- query MyQuery {
334- patients {
335- age
336- assignedLocationId
337- birthdate
338- firstname
339- gender
393+ export const GetMyTasksDocument = `
394+ query GetMyTasks {
395+ me {
340396 id
341- lastname
342- name
343- properties {
344- definition {
345- allowedEntities
346- }
347- }
348397 tasks {
349398 id
399+ title
400+ description
401+ done
402+ creationDate
403+ patient {
404+ id
405+ name
406+ assignedLocation {
407+ id
408+ title
409+ parent {
410+ id
411+ title
412+ }
413+ }
414+ }
415+ assignee {
416+ id
417+ name
418+ avatarUrl
419+ }
350420 }
351421 }
352422}
353423 ` ;
354424
355- export const useMyQueryQuery = <
356- TData = MyQueryQuery ,
425+ export const useGetMyTasksQuery = <
426+ TData = GetMyTasksQuery ,
357427 TError = unknown
358428 > (
359- variables ?: MyQueryQueryVariables ,
360- options ?: Omit < UseQueryOptions < MyQueryQuery , TError , TData > , 'queryKey' > & { queryKey ?: UseQueryOptions < MyQueryQuery , TError , TData > [ 'queryKey' ] }
429+ variables ?: GetMyTasksQueryVariables ,
430+ options ?: Omit < UseQueryOptions < GetMyTasksQuery , TError , TData > , 'queryKey' > & { queryKey ?: UseQueryOptions < GetMyTasksQuery , TError , TData > [ 'queryKey' ] }
361431 ) => {
362432
363- return useQuery < MyQueryQuery , TError , TData > (
433+ return useQuery < GetMyTasksQuery , TError , TData > (
434+ {
435+ queryKey : variables === undefined ? [ 'GetMyTasks' ] : [ 'GetMyTasks' , variables ] ,
436+ queryFn : fetcher < GetMyTasksQuery , GetMyTasksQueryVariables > ( GetMyTasksDocument , variables ) ,
437+ ...options
438+ }
439+ ) } ;
440+
441+ export const CompleteTaskDocument = `
442+ mutation CompleteTask($id: ID!) {
443+ completeTask(id: $id) {
444+ id
445+ done
446+ updateDate
447+ }
448+ }
449+ ` ;
450+
451+ export const useCompleteTaskMutation = <
452+ TError = unknown ,
453+ TContext = unknown
454+ > ( options ?: UseMutationOptions < CompleteTaskMutation , TError , CompleteTaskMutationVariables , TContext > ) => {
455+
456+ return useMutation < CompleteTaskMutation , TError , CompleteTaskMutationVariables , TContext > (
457+ {
458+ mutationKey : [ 'CompleteTask' ] ,
459+ mutationFn : ( variables ?: CompleteTaskMutationVariables ) => fetcher < CompleteTaskMutation , CompleteTaskMutationVariables > ( CompleteTaskDocument , variables ) ( ) ,
460+ ...options
461+ }
462+ ) } ;
463+
464+ export const ReopenTaskDocument = `
465+ mutation ReopenTask($id: ID!) {
466+ reopenTask(id: $id) {
467+ id
468+ done
469+ updateDate
470+ }
471+ }
472+ ` ;
473+
474+ export const useReopenTaskMutation = <
475+ TError = unknown ,
476+ TContext = unknown
477+ > ( options ?: UseMutationOptions < ReopenTaskMutation , TError , ReopenTaskMutationVariables , TContext > ) => {
478+
479+ return useMutation < ReopenTaskMutation , TError , ReopenTaskMutationVariables , TContext > (
364480 {
365- queryKey : variables === undefined ? [ 'MyQuery' ] : [ 'MyQuery' , variables ] ,
366- queryFn : fetcher < MyQueryQuery , MyQueryQueryVariables > ( MyQueryDocument , variables ) ,
481+ mutationKey : [ 'ReopenTask' ] ,
482+ mutationFn : ( variables ?: ReopenTaskMutationVariables ) => fetcher < ReopenTaskMutation , ReopenTaskMutationVariables > ( ReopenTaskDocument , variables ) ( ) ,
367483 ...options
368484 }
369485 ) } ;
0 commit comments