From b79a7c74109838650808b5f4e1bc9ad79331efbd Mon Sep 17 00:00:00 2001 From: Max Ehrlicher-Schmidt Date: Mon, 7 Dec 2020 00:21:32 +0100 Subject: [PATCH] Add graphql fragments --- src/app/components/table/table.component.ts | 1 - .../fragments/bikeEvent.graphql | 27 ++- .../fragments/bikeEventType.graphql | 2 + .../fragments/engagement.graphql | 42 ++-- .../fragments/engagementType.graphql | 11 +- .../fragments/participant.graphql | 44 ++-- .../fragments/workshop.graphql | 27 +++ .../fragments/workshopType.graphql | 12 + src/generated/graphql.ts | 208 ++++++++++++++++-- 9 files changed, 319 insertions(+), 55 deletions(-) create mode 100644 src/app/graphqlOperations/fragments/workshop.graphql create mode 100644 src/app/graphqlOperations/fragments/workshopType.graphql diff --git a/src/app/components/table/table.component.ts b/src/app/components/table/table.component.ts index 630bcba..e11d938 100644 --- a/src/app/components/table/table.component.ts +++ b/src/app/components/table/table.component.ts @@ -102,7 +102,6 @@ export class TableComponent implements AfterViewInit { ngAfterViewInit(): void { this.addColumnPropertiesFromGQLSchemaToColumnInfo(); - console.log(this.columnInfo) this.data.paginator = this.paginator; this.data.sortingDataAccessor = (item, columnName) => { if (typeof item[columnName] === 'string') { diff --git a/src/app/graphqlOperations/fragments/bikeEvent.graphql b/src/app/graphqlOperations/fragments/bikeEvent.graphql index 293e30b..7933131 100644 --- a/src/app/graphqlOperations/fragments/bikeEvent.graphql +++ b/src/app/graphqlOperations/fragments/bikeEvent.graphql @@ -4,10 +4,33 @@ fragment BikeEventFieldsForBikePage on BikeEvent { ...BikeEventTypeFields } responsible { - ...ParticipantFieldsForBikePage + ...ParticipantFieldsGeneral } date - responsible { +} + +fragment BikeEventFieldsForTable on BikeEvent { + id + bikeEventType { + ...BikeEventTypeFields + } + cargoBike { id + name + } + responsible { + ...ParticipantFieldsGeneral } + related { + ...ParticipantFieldsGeneral + } + date + description + documents + remark + + isLockedByMe + isLocked + lockedBy + lockedUntil } diff --git a/src/app/graphqlOperations/fragments/bikeEventType.graphql b/src/app/graphqlOperations/fragments/bikeEventType.graphql index 550b51f..88f7ce0 100644 --- a/src/app/graphqlOperations/fragments/bikeEventType.graphql +++ b/src/app/graphqlOperations/fragments/bikeEventType.graphql @@ -1,7 +1,9 @@ fragment BikeEventTypeFields on BikeEventType { id name + isLocked isLockedByMe + lockedBy lockedUntil } diff --git a/src/app/graphqlOperations/fragments/engagement.graphql b/src/app/graphqlOperations/fragments/engagement.graphql index 6f96b75..bbb5850 100644 --- a/src/app/graphqlOperations/fragments/engagement.graphql +++ b/src/app/graphqlOperations/fragments/engagement.graphql @@ -1,17 +1,33 @@ fragment EngagementFieldsForBikePage on Engagement { - id - engagementType { - ...EngagementTypeFields - } - dateRange { - from - to - } - participant { - ...ParticipantFieldsForBikePage - } - isLocked + id + engagementType { + ...EngagementTypeFields + } + dateRange { + from + to + } + participant { + ...ParticipantFieldsGeneral + } + + isLocked isLockedByMe lockedBy lockedUntil -} \ No newline at end of file +} + +fragment EngagementFieldsForParticipant on Engagement { + id + engagementType { + ...EngagementTypeFields + } + dateRange { + from + to + } + cargoBike { + id + name + } +} diff --git a/src/app/graphqlOperations/fragments/engagementType.graphql b/src/app/graphqlOperations/fragments/engagementType.graphql index f8e2bbf..1d754d8 100644 --- a/src/app/graphqlOperations/fragments/engagementType.graphql +++ b/src/app/graphqlOperations/fragments/engagementType.graphql @@ -1,9 +1,10 @@ fragment EngagementTypeFields on EngagementType { - id - name - description - isLocked + id + name + description + + isLocked isLockedByMe lockedBy lockedUntil -} \ No newline at end of file +} diff --git a/src/app/graphqlOperations/fragments/participant.graphql b/src/app/graphqlOperations/fragments/participant.graphql index d82450d..023c128 100644 --- a/src/app/graphqlOperations/fragments/participant.graphql +++ b/src/app/graphqlOperations/fragments/participant.graphql @@ -1,17 +1,35 @@ -fragment ParticipantFieldsForBikePage on Participant { - id - dateRange { - from - to - } - usernamefLotte - usernameSlack - contactInformation { - ...ContactInformationFieldsGeneral - } +fragment ParticipantFieldsGeneral on Participant { + id + dateRange { + from + to + } + contactInformation { + ...ContactInformationFieldsGeneral + } + usernamefLotte + usernameSlack +} - isLocked +fragment ParticipantFieldsForTable on Participant { + ...ParticipantFieldsGeneral + memberADFC + locationZIPs + memberCoreTeam + distributedActiveBikeParte + + isLocked isLockedByMe lockedBy lockedUntil -} \ No newline at end of file +} + +fragment ParticipantFieldsForPage on Participant { + ...ParticipantFieldsForTable + engagement { + ...EngagementFieldsForParticipant + } + workshops { + ...WorkshopFieldsGeneral + } +} diff --git a/src/app/graphqlOperations/fragments/workshop.graphql b/src/app/graphqlOperations/fragments/workshop.graphql new file mode 100644 index 0000000..8a1bf68 --- /dev/null +++ b/src/app/graphqlOperations/fragments/workshop.graphql @@ -0,0 +1,27 @@ +fragment WorkshopFieldsGeneral on Workshop { + id + title + description + date + workshopType { + ...WorkshopTypefieldsGeneral + } + trainer1 { + ...ParticipantFieldsGeneral + } + trainer2 { + ...ParticipantFieldsGeneral + } + +} + +fragment WorkshopFieldsForTable on Workshop { + ...WorkshopFieldsGeneral + participants { + ...ParticipantFieldsGeneral + } + isLocked + isLockedByMe + lockedBy + lockedUntil +} \ No newline at end of file diff --git a/src/app/graphqlOperations/fragments/workshopType.graphql b/src/app/graphqlOperations/fragments/workshopType.graphql new file mode 100644 index 0000000..27fe830 --- /dev/null +++ b/src/app/graphqlOperations/fragments/workshopType.graphql @@ -0,0 +1,12 @@ +fragment WorkshopTypefieldsGeneral on WorkshopType { + id + name +} + +fragment WorkshopTypefieldsForTable on WorkshopType { + ...WorkshopTypefieldsGeneral + isLocked + isLockedByMe + lockedBy + lockedUntil +} diff --git a/src/generated/graphql.ts b/src/generated/graphql.ts index 23e244b..dd6bf9d 100644 --- a/src/generated/graphql.ts +++ b/src/generated/graphql.ts @@ -2042,11 +2042,22 @@ export type BikeEventFieldsForBikePageFragment = { __typename?: 'BikeEvent', id: { __typename?: 'BikeEventType' } & BikeEventTypeFieldsFragment ), responsible?: Maybe<( - { __typename?: 'Participant', id: string } - & ParticipantFieldsForBikePageFragment + { __typename?: 'Participant' } + & ParticipantFieldsGeneralFragment + )> }; + +export type BikeEventFieldsForTableFragment = { __typename?: 'BikeEvent', id: string, date: any, description?: Maybe, documents: Array, remark?: Maybe, isLockedByMe: boolean, isLocked: boolean, lockedBy?: Maybe, lockedUntil?: Maybe, bikeEventType: ( + { __typename?: 'BikeEventType' } + & BikeEventTypeFieldsFragment + ), cargoBike: { __typename?: 'CargoBike', id: string, name: string }, responsible?: Maybe<( + { __typename?: 'Participant' } + & ParticipantFieldsGeneralFragment + )>, related?: Maybe<( + { __typename?: 'Participant' } + & ParticipantFieldsGeneralFragment )> }; -export type BikeEventTypeFieldsFragment = { __typename?: 'BikeEventType', id: string, name: string, isLocked: boolean, isLockedByMe: boolean, lockedUntil?: Maybe }; +export type BikeEventTypeFieldsFragment = { __typename?: 'BikeEventType', id: string, name: string, isLocked: boolean, isLockedByMe: boolean, lockedBy?: Maybe, lockedUntil?: Maybe }; export type ContactInformationFieldsGeneralFragment = { __typename?: 'ContactInformation', id: string, phone?: Maybe, phone2?: Maybe, email?: Maybe, email2?: Maybe, note?: Maybe, person: ( { __typename?: 'Person' } @@ -2063,9 +2074,14 @@ export type EngagementFieldsForBikePageFragment = { __typename?: 'Engagement', i & EngagementTypeFieldsFragment ), dateRange: { __typename?: 'DateRange', from: any, to?: Maybe }, participant: ( { __typename?: 'Participant' } - & ParticipantFieldsForBikePageFragment + & ParticipantFieldsGeneralFragment ) }; +export type EngagementFieldsForParticipantFragment = { __typename?: 'Engagement', id: string, engagementType: ( + { __typename?: 'EngagementType' } + & EngagementTypeFieldsFragment + ), dateRange: { __typename?: 'DateRange', from: any, to?: Maybe }, cargoBike: { __typename?: 'CargoBike', id: string, name: string } }; + export type EngagementTypeFieldsFragment = { __typename?: 'EngagementType', id: string, name: string, description: string, isLocked: boolean, isLockedByMe: boolean, lockedBy?: Maybe, lockedUntil?: Maybe }; export type EquipmentFieldsForBikePageFragment = { __typename?: 'Equipment', id: string, serialNo: string, title: string, description?: Maybe, cargoBike?: Maybe<{ __typename?: 'CargoBike', name: string }> }; @@ -2125,11 +2141,27 @@ export type OrganisationFieldsForPageFragment = ( & OrganisationFieldsForTableFragment ); -export type ParticipantFieldsForBikePageFragment = { __typename?: 'Participant', id: string, usernamefLotte?: Maybe, usernameSlack?: Maybe, isLocked: boolean, isLockedByMe: boolean, lockedBy?: Maybe, lockedUntil?: Maybe, dateRange: { __typename?: 'DateRange', from: any, to?: Maybe }, contactInformation: ( +export type ParticipantFieldsGeneralFragment = { __typename?: 'Participant', id: string, usernamefLotte?: Maybe, usernameSlack?: Maybe, dateRange: { __typename?: 'DateRange', from: any, to?: Maybe }, contactInformation: ( { __typename?: 'ContactInformation' } & ContactInformationFieldsGeneralFragment ) }; +export type ParticipantFieldsForTableFragment = ( + { __typename?: 'Participant', memberADFC: boolean, locationZIPs: Array>, memberCoreTeam: boolean, distributedActiveBikeParte: boolean, isLocked: boolean, isLockedByMe: boolean, lockedBy?: Maybe, lockedUntil?: Maybe } + & ParticipantFieldsGeneralFragment +); + +export type ParticipantFieldsForPageFragment = ( + { __typename?: 'Participant', engagement?: Maybe>>, workshops?: Maybe>> } + & ParticipantFieldsForTableFragment +); + export type PersonFieldsGeneralFragment = { __typename?: 'Person', id: string, name: string, firstName: string }; export type PersonFieldsForTableFragment = { __typename?: 'Person', id: string, name: string, firstName: string, isLocked: boolean, isLockedByMe: boolean, lockedUntil?: Maybe }; @@ -2169,6 +2201,32 @@ export type TimeFrameFieldsForLendingStationFragment = { __typename?: 'TimeFrame export type TimeFrameFieldsFragment = { __typename?: 'TimeFrame', id: string, note?: Maybe, isLocked: boolean, isLockedByMe: boolean, lockedBy?: Maybe, lockedUntil?: Maybe, dateRange: { __typename?: 'DateRange', from: any, to?: Maybe }, lendingStation: { __typename?: 'LendingStation', id: string, name: string }, cargoBike: { __typename?: 'CargoBike', id: string, name: string } }; +export type WorkshopFieldsGeneralFragment = { __typename?: 'Workshop', id: string, title: string, description: string, date: any, workshopType: ( + { __typename?: 'WorkshopType' } + & WorkshopTypefieldsGeneralFragment + ), trainer1: ( + { __typename?: 'Participant' } + & ParticipantFieldsGeneralFragment + ), trainer2?: Maybe<( + { __typename?: 'Participant' } + & ParticipantFieldsGeneralFragment + )> }; + +export type WorkshopFieldsForTableFragment = ( + { __typename?: 'Workshop', isLocked: boolean, isLockedByMe: boolean, lockedBy?: Maybe, lockedUntil?: Maybe, participants?: Maybe>> } + & WorkshopFieldsGeneralFragment +); + +export type WorkshopTypefieldsGeneralFragment = { __typename?: 'WorkshopType', id: string, name: string }; + +export type WorkshopTypefieldsForTableFragment = ( + { __typename?: 'WorkshopType', isLocked: boolean, isLockedByMe: boolean, lockedBy?: Maybe, lockedUntil?: Maybe } + & WorkshopTypefieldsGeneralFragment +); + export type GetLendingStationsQueryVariables = Exact<{ [key: string]: never; }>; @@ -2711,25 +2769,22 @@ export const BikeEventTypeFieldsFragmentDoc = gql` name isLocked isLockedByMe + lockedBy lockedUntil } `; -export const ParticipantFieldsForBikePageFragmentDoc = gql` - fragment ParticipantFieldsForBikePage on Participant { +export const ParticipantFieldsGeneralFragmentDoc = gql` + fragment ParticipantFieldsGeneral on Participant { id dateRange { from to } - usernamefLotte - usernameSlack contactInformation { ...ContactInformationFieldsGeneral } - isLocked - isLockedByMe - lockedBy - lockedUntil + usernamefLotte + usernameSlack } ${ContactInformationFieldsGeneralFragmentDoc}`; export const BikeEventFieldsForBikePageFragmentDoc = gql` @@ -2739,16 +2794,12 @@ export const BikeEventFieldsForBikePageFragmentDoc = gql` ...BikeEventTypeFields } responsible { - ...ParticipantFieldsForBikePage - id + ...ParticipantFieldsGeneral } date - responsible { - id - } } ${BikeEventTypeFieldsFragmentDoc} -${ParticipantFieldsForBikePageFragmentDoc}`; +${ParticipantFieldsGeneralFragmentDoc}`; export const EquipmentFieldsForBikePageFragmentDoc = gql` fragment EquipmentFieldsForBikePage on Equipment { id @@ -2793,7 +2844,7 @@ export const EngagementFieldsForBikePageFragmentDoc = gql` to } participant { - ...ParticipantFieldsForBikePage + ...ParticipantFieldsGeneral } isLocked isLockedByMe @@ -2801,7 +2852,7 @@ export const EngagementFieldsForBikePageFragmentDoc = gql` lockedUntil } ${EngagementTypeFieldsFragmentDoc} -${ParticipantFieldsForBikePageFragmentDoc}`; +${ParticipantFieldsGeneralFragmentDoc}`; export const TimeFrameFieldsForBikePageFragmentDoc = gql` fragment TimeFrameFieldsForBikePage on TimeFrame { id @@ -2843,6 +2894,33 @@ ${EquipmentFieldsForBikePageFragmentDoc} ${EquipmentTypeFieldsFragmentDoc} ${EngagementFieldsForBikePageFragmentDoc} ${TimeFrameFieldsForBikePageFragmentDoc}`; +export const BikeEventFieldsForTableFragmentDoc = gql` + fragment BikeEventFieldsForTable on BikeEvent { + id + bikeEventType { + ...BikeEventTypeFields + } + cargoBike { + id + name + } + responsible { + ...ParticipantFieldsGeneral + } + related { + ...ParticipantFieldsGeneral + } + date + description + documents + remark + isLockedByMe + isLocked + lockedBy + lockedUntil +} + ${BikeEventTypeFieldsFragmentDoc} +${ParticipantFieldsGeneralFragmentDoc}`; export const ContactInformationFieldsFragmentDoc = gql` fragment ContactInformationFields on ContactInformation { ...ContactInformationFieldsGeneral @@ -2973,6 +3051,72 @@ export const OrganisationFieldsForPageFragmentDoc = gql` } ${OrganisationFieldsForTableFragmentDoc} ${ProviderFieldsForPageFragmentDoc}`; +export const ParticipantFieldsForTableFragmentDoc = gql` + fragment ParticipantFieldsForTable on Participant { + ...ParticipantFieldsGeneral + memberADFC + locationZIPs + memberCoreTeam + distributedActiveBikeParte + isLocked + isLockedByMe + lockedBy + lockedUntil +} + ${ParticipantFieldsGeneralFragmentDoc}`; +export const EngagementFieldsForParticipantFragmentDoc = gql` + fragment EngagementFieldsForParticipant on Engagement { + id + engagementType { + ...EngagementTypeFields + } + dateRange { + from + to + } + cargoBike { + id + name + } +} + ${EngagementTypeFieldsFragmentDoc}`; +export const WorkshopTypefieldsGeneralFragmentDoc = gql` + fragment WorkshopTypefieldsGeneral on WorkshopType { + id + name +} + `; +export const WorkshopFieldsGeneralFragmentDoc = gql` + fragment WorkshopFieldsGeneral on Workshop { + id + title + description + date + workshopType { + ...WorkshopTypefieldsGeneral + } + trainer1 { + ...ParticipantFieldsGeneral + } + trainer2 { + ...ParticipantFieldsGeneral + } +} + ${WorkshopTypefieldsGeneralFragmentDoc} +${ParticipantFieldsGeneralFragmentDoc}`; +export const ParticipantFieldsForPageFragmentDoc = gql` + fragment ParticipantFieldsForPage on Participant { + ...ParticipantFieldsForTable + engagement { + ...EngagementFieldsForParticipant + } + workshops { + ...WorkshopFieldsGeneral + } +} + ${ParticipantFieldsForTableFragmentDoc} +${EngagementFieldsForParticipantFragmentDoc} +${WorkshopFieldsGeneralFragmentDoc}`; export const PersonFieldsForTableFragmentDoc = gql` fragment PersonFieldsForTable on Person { id @@ -3015,6 +3159,28 @@ export const TimeFrameFieldsFragmentDoc = gql` lockedUntil } `; +export const WorkshopFieldsForTableFragmentDoc = gql` + fragment WorkshopFieldsForTable on Workshop { + ...WorkshopFieldsGeneral + participants { + ...ParticipantFieldsGeneral + } + isLocked + isLockedByMe + lockedBy + lockedUntil +} + ${WorkshopFieldsGeneralFragmentDoc} +${ParticipantFieldsGeneralFragmentDoc}`; +export const WorkshopTypefieldsForTableFragmentDoc = gql` + fragment WorkshopTypefieldsForTable on WorkshopType { + ...WorkshopTypefieldsGeneral + isLocked + isLockedByMe + lockedBy + lockedUntil +} + ${WorkshopTypefieldsGeneralFragmentDoc}`; export const GetCargoBikesDocument = gql` query GetCargoBikes { cargoBikes {