Add bike editing

pull/1/head
Max Ehrlicher-Schmidt 4 years ago
parent ac6af032f2
commit ee0ca0ddce

@ -1,5 +1,4 @@
overwrite: true overwrite: true
wtach: true
schema: "http://localhost:4000/graphql" schema: "http://localhost:4000/graphql"
documents: "src/app/graphqlOperations/**/*" documents: "src/app/graphqlOperations/**/*"
generates: generates:

File diff suppressed because it is too large Load Diff

@ -1,26 +1,24 @@
import { BrowserModule } from '@angular/platform-browser'; import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import {FormsModule, ReactiveFormsModule} from '@angular/forms'; import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { HttpClientModule } from '@angular/common/http'; import { HttpClientModule } from '@angular/common/http';
import {DragDropModule} from '@angular/cdk/drag-drop'; import { DragDropModule } from '@angular/cdk/drag-drop';
// Angular Material Components // Angular Material Components
import {MatToolbarModule} from '@angular/material/toolbar'; import { MatToolbarModule } from '@angular/material/toolbar';
import {MatButtonModule} from '@angular/material/button'; import { MatButtonModule } from '@angular/material/button';
import {MatTableModule} from '@angular/material/table'; import { MatTableModule } from '@angular/material/table';
import {MatInputModule} from '@angular/material/input'; import { MatInputModule } from '@angular/material/input';
import {MatMenuModule} from '@angular/material/menu'; import { MatMenuModule } from '@angular/material/menu';
import {MatSlideToggleModule} from '@angular/material/slide-toggle'; import { MatSlideToggleModule } from '@angular/material/slide-toggle';
import {MatIconModule} from '@angular/material/icon'; import { MatIconModule } from '@angular/material/icon';
import {MatSidenavModule} from '@angular/material/sidenav'; import { MatSidenavModule } from '@angular/material/sidenav';
import {MatListModule} from '@angular/material/list'; import { MatListModule } from '@angular/material/list';
import {MatFormFieldModule} from '@angular/material/form-field'; import { MatFormFieldModule } from '@angular/material/form-field';
import {MatProgressSpinnerModule} from '@angular/material/progress-spinner'; import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import {MatProgressBarModule} from '@angular/material/progress-bar'; import { MatProgressBarModule } from '@angular/material/progress-bar';
import {MatCheckboxModule} from '@angular/material/checkbox'; import { MatCheckboxModule } from '@angular/material/checkbox';
import { AppRoutingModule } from './app-routing.module'; import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
@ -33,8 +31,6 @@ import { LendingStationsComponent } from './pages/tables/lending-stations/lendin
import { TableOverviewComponent } from './pages/table-overview/table-overview.component'; import { TableOverviewComponent } from './pages/table-overview/table-overview.component';
import { StringCellComponent } from './components/tableComponents/string-cell/string-cell.component'; import { StringCellComponent } from './components/tableComponents/string-cell/string-cell.component';
@NgModule({ @NgModule({
declarations: [ declarations: [
AppComponent, AppComponent,
@ -43,7 +39,7 @@ import { StringCellComponent } from './components/tableComponents/string-cell/st
ParticipantsComponent, ParticipantsComponent,
LendingStationsComponent, LendingStationsComponent,
TableOverviewComponent, TableOverviewComponent,
StringCellComponent StringCellComponent,
], ],
imports: [ imports: [
BrowserModule, BrowserModule,
@ -66,9 +62,10 @@ import { StringCellComponent } from './components/tableComponents/string-cell/st
MatProgressBarModule, MatProgressBarModule,
MatCheckboxModule, MatCheckboxModule,
GraphQLModule, GraphQLModule,
DragDropModule DragDropModule,
], ],
providers: [], providers: [],
bootstrap: [AppComponent] bootstrap: [AppComponent],
}) })
export class AppModule { } export class AppModule {
}

@ -1,6 +1,6 @@
import {NgModule} from '@angular/core'; import {NgModule} from '@angular/core';
import {APOLLO_OPTIONS} from 'apollo-angular'; import {APOLLO_OPTIONS} from 'apollo-angular';
import {ApolloClientOptions, InMemoryCache} from '@apollo/client/core'; import {ApolloClientOptions, ApolloLink, InMemoryCache} from '@apollo/client/core';
import {HttpLink} from 'apollo-angular/http'; import {HttpLink} from 'apollo-angular/http';
import { environment } from '../environments/environment'; import { environment } from '../environments/environment';
@ -8,7 +8,7 @@ const uri = environment.apiUrl + '/graphql'; // <-- add the URL of the GraphQL s
export function createApollo(httpLink: HttpLink): ApolloClientOptions<any> { export function createApollo(httpLink: HttpLink): ApolloClientOptions<any> {
return { return {
link: httpLink.create({uri}), link: httpLink.create({uri}),
cache: new InMemoryCache(), cache: new InMemoryCache({}),
}; };
} }
@ -21,4 +21,5 @@ export function createApollo(httpLink: HttpLink): ApolloClientOptions<any> {
}, },
], ],
}) })
export class GraphQLModule {} export class GraphQLModule {
}

@ -1,5 +1,11 @@
query GetCargoBikeById($id: ID!){ query GetCargoBikeById($id: ID!) {
cargoBikeById(id: $id) { cargoBikeById(id: $id) {
...CargoBikeFragment ...CargoBikeFields
}
}
mutation UpdateCargoBike($bike: CargoBikeUpdateInput!) {
updateCargoBike(cargoBike: $bike) {
...CargoBikeFields
} }
} }

@ -1,5 +1,5 @@
query GetCargoBikes{ query GetCargoBikes {
cargoBikes { cargoBikes(limit: 100, offset: 0) {
...CargoBikeFragment ...CargoBikeFields
} }
} }

@ -1,12 +1,14 @@
fragment CargoBikeFragment on CargoBike { fragment CargoBikeFields on CargoBike {
id id
group group
name name
events { bikeEvents {
date date
id
} }
insuranceData { insuranceData {
billing billing
hasFixedRate
} }
dimensionsAndLoad { dimensionsAndLoad {
bikeLength bikeLength

@ -0,0 +1,9 @@
export function extractType<T>(properties: Record<keyof T, true>){
return function<TActual extends T>(value: TActual){
let result = {} as T;
for (const property of Object.keys(properties) as Array<keyof T>) {
result[property] = value[property];
}
return result;
}
}

@ -114,7 +114,11 @@
> >
<mat-icon>save</mat-icon> <mat-icon>save</mat-icon>
</button> </button>
<button mat-icon-button *ngIf="element.isGettingEdited"> <button
mat-icon-button
*ngIf="element.isGettingEdited"
(click)="cancel(element)"
>
<mat-icon>cancel</mat-icon> <mat-icon>cancel</mat-icon>
</button> </button>

@ -2,7 +2,7 @@ import { SelectionModel } from '@angular/cdk/collections';
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop'; import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop';
import { BikesService, CargoBikeResult } from 'src/app/services/bikes.service'; import { BikesService, CargoBikeResult } from 'src/app/services/bikes.service';
import { deepCopy } from 'src/app/services/deepCopy'; import { deepCopy } from 'src/app/helperFunctions/deepCopy';
type CargoBikeDataRow = CargoBikeResult & { type CargoBikeDataRow = CargoBikeResult & {
waitingForEditPermissions: boolean; waitingForEditPermissions: boolean;
@ -50,17 +50,19 @@ export class BikesComponent {
setTimeout(() => { setTimeout(() => {
row.waitingForEditPermissions = false; row.waitingForEditPermissions = false;
row.isGettingEdited = true; row.isGettingEdited = true;
}, 800); }, Math.random()*1000);
} }
save(row: CargoBikeDataRow) { save(row: CargoBikeDataRow) {
console.log(row); //remove lock
this.bikesService.updateBike({bike: row})
} }
cancel(row: CargoBikeDataRow) { cancel(row: CargoBikeDataRow) {
//fetch it again //fetch it again
//TODO: remove lock //TODO: remove lock
this.bikesService.reloadBike({id: row.id}); this.bikesService.reloadBike({ id: row.id });
console.log('cancel');
} }
drop(event: CdkDragDrop<string[]>) { drop(event: CdkDragDrop<string[]>) {

@ -1,6 +1,6 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { BehaviorSubject } from 'rxjs'; import { BehaviorSubject } from 'rxjs';
import { GetCargoBikesGQL, GetCargoBikesQuery, GetCargoBikeByIdGQL, GetCargoBikeByIdQuery, GetCargoBikeByIdQueryVariables } from 'src/generated/graphql'; import { GetCargoBikesGQL, GetCargoBikesQuery, GetCargoBikeByIdGQL, GetCargoBikeByIdQueryVariables, UpdateCargoBikeGQL, UpdateCargoBikeMutationVariables, UpdateCargoBikeDocument, CargoBikeFieldsFragmentDoc} from 'src/generated/graphql';
import { DeepExtractTypeSkipArrays } from 'ts-deep-extract-types'; import { DeepExtractTypeSkipArrays } from 'ts-deep-extract-types';
export type CargoBikeResult = DeepExtractTypeSkipArrays<GetCargoBikesQuery, ["cargoBikes"]>; export type CargoBikeResult = DeepExtractTypeSkipArrays<GetCargoBikesQuery, ["cargoBikes"]>;
@ -11,18 +11,25 @@ export type CargoBikeResult = DeepExtractTypeSkipArrays<GetCargoBikesQuery, ["ca
export class BikesService { export class BikesService {
bikes: BehaviorSubject<CargoBikeResult[]> = new BehaviorSubject([]); bikes: BehaviorSubject<CargoBikeResult[]> = new BehaviorSubject([]);
constructor(private getCargoBikesGQL: GetCargoBikesGQL, private getCargoBikeByIdGQL: GetCargoBikeByIdGQL) { } constructor(private getCargoBikesGQL: GetCargoBikesGQL, private getCargoBikeByIdGQL: GetCargoBikeByIdGQL, private updateCargoBikeGQL: UpdateCargoBikeGQL) { }
loadBikes() { loadBikes() {
this.getCargoBikesGQL.watch().valueChanges.subscribe((result) => { this.getCargoBikesGQL.fetch().subscribe((result) => {
this.bikes.next(result.data.cargoBikes); this.bikes.next(result.data.cargoBikes);
}); });
} }
reloadBike(parameter: GetCargoBikeByIdQueryVariables) { reloadBike(variables: GetCargoBikeByIdQueryVariables) {
this.getCargoBikeByIdGQL.watch().valueChanges.subscribe((result) => { this.getCargoBikeByIdGQL.fetch(variables).subscribe((result) => {
const newBike = result.data.cargoBikeById; const newBike = result.data.cargoBikeById;
this.bikes.next(this.bikes.value.map(bike => (newBike.id === bike.id) ? newBike : bike)); this.bikes.next(this.bikes.value.map(bike => (newBike.id === bike.id) ? newBike : bike));
}); });
} }
updateBike(variableValues: UpdateCargoBikeMutationVariables) {
this.updateCargoBikeGQL.mutate(variableValues).subscribe((result) => {
const newBike = result.data.updateCargoBike;
this.bikes.next(this.bikes.value.map(bike => (newBike.id === bike.id) ? newBike : bike));
})
}
} }

@ -39,24 +39,38 @@ export type CargoBike = {
technicalEquipment?: Maybe<TechnicalEquipment>; technicalEquipment?: Maybe<TechnicalEquipment>;
/** Does not refere to an extra table in the database. */ /** Does not refere to an extra table in the database. */
dimensionsAndLoad: DimensionsAndLoad; dimensionsAndLoad: DimensionsAndLoad;
events?: Maybe<Array<Maybe<BikeEvent>>>; bikeEvents?: Maybe<Array<Maybe<BikeEvent>>>;
equipment?: Maybe<Array<Maybe<Equipment>>>; equipment?: Maybe<Array<Maybe<Equipment>>>;
/** Refers to equipment that is not unique. See kommentierte info tabelle -> Fragen -> Frage 2 */ /** Refers to equipment that is not unique. See kommentierte info tabelle -> Fragen -> Frage 2 */
otherEquipment?: Maybe<Array<Maybe<Scalars['String']>>>; miscellaneousEquipment?: Maybe<Array<Maybe<Scalars['String']>>>;
chainSwaps?: Maybe<Array<Maybe<ChainSwap>>>;
/** Sticker State */ /** Sticker State */
stickerBikeNameState?: Maybe<StickerBikeNameState>; stickerBikeNameState?: Maybe<StickerBikeNameState>;
note?: Maybe<Scalars['String']>; note?: Maybe<Scalars['String']>;
provider?: Maybe<Provider>; provider?: Maybe<Provider>;
coordinator?: Maybe<Participant>; coordinator?: Maybe<Participant>;
insuranceData: InsuranceData; insuranceData: InsuranceData;
lendingstation?: Maybe<LendingStation>; lendingStation?: Maybe<LendingStation>;
taxes?: Maybe<Taxes>; taxes?: Maybe<Taxes>;
engagement?: Maybe<Array<Maybe<Engagement>>>;
/** null if not locked by other user */ /** null if not locked by other user */
lockedBy?: Maybe<Scalars['ID']>; lockedBy?: Maybe<Scalars['ID']>;
lockedUntil?: Maybe<Scalars['Date']>; lockedUntil?: Maybe<Scalars['Date']>;
}; };
/** The CargoBike type is central to the graph. You could call it the root. */
export type CargoBikeEquipmentArgs = {
offset: Scalars['Int'];
limit: Scalars['Int'];
};
/** The CargoBike type is central to the graph. You could call it the root. */
export type CargoBikeEngagementArgs = {
offset: Scalars['Int'];
limit: Scalars['Int'];
};
export type CargoBikeCreateInput = { export type CargoBikeCreateInput = {
/** see column A in info tabelle */ /** see column A in info tabelle */
group: Group; group: Group;
@ -76,13 +90,13 @@ export type CargoBikeCreateInput = {
/** Does not refere to an extra table in the database. */ /** Does not refere to an extra table in the database. */
dimensionsAndLoad: DimensionsAndLoadCreateInput; dimensionsAndLoad: DimensionsAndLoadCreateInput;
/** Refers to equipment that is not unique. See kommentierte info tabelle -> Fragen -> Frage 2 */ /** Refers to equipment that is not unique. See kommentierte info tabelle -> Fragen -> Frage 2 */
otherEquipment?: Maybe<Array<Maybe<Scalars['String']>>>; miscellaneousEquipment?: Maybe<Array<Maybe<Scalars['String']>>>;
/** Sticker State */ /** Sticker State */
stickerBikeNameState?: Maybe<StickerBikeNameState>; stickerBikeNameState?: Maybe<StickerBikeNameState>;
note?: Maybe<Scalars['String']>; note?: Maybe<Scalars['String']>;
provider?: Maybe<Scalars['String']>; provider?: Maybe<Scalars['String']>;
insuranceData: InsuranceDataCreateInput; insuranceData: InsuranceDataCreateInput;
taxes?: Maybe<TaxesCreateInput>; taxes: TaxesCreateInput;
}; };
export type CargoBikeUpdateInput = { export type CargoBikeUpdateInput = {
@ -105,7 +119,8 @@ export type CargoBikeUpdateInput = {
/** Does not refere to an extra table in the database. */ /** Does not refere to an extra table in the database. */
dimensionsAndLoad?: Maybe<DimensionsAndLoadUpdateInput>; dimensionsAndLoad?: Maybe<DimensionsAndLoadUpdateInput>;
/** Refers to equipment that is not unique. See kommentierte info tabelle -> Fragen -> Frage 2 */ /** Refers to equipment that is not unique. See kommentierte info tabelle -> Fragen -> Frage 2 */
otherEquipment?: Maybe<Array<Maybe<Scalars['String']>>>; miscellaneousEquipment?: Maybe<Array<Maybe<Scalars['String']>>>;
lendingStationId?: Maybe<Scalars['ID']>;
/** Sticker State */ /** Sticker State */
stickerBikeNameState?: Maybe<StickerBikeNameState>; stickerBikeNameState?: Maybe<StickerBikeNameState>;
note?: Maybe<Scalars['String']>; note?: Maybe<Scalars['String']>;
@ -194,13 +209,13 @@ export type Participant = {
__typename?: 'Participant'; __typename?: 'Participant';
id: Scalars['ID']; id: Scalars['ID'];
start: Scalars['Date']; start: Scalars['Date'];
end: Scalars['Date']; end?: Maybe<Scalars['Date']>;
mentor: ContactInformation; contactInformation: ContactInformation;
usernamefLotte?: Maybe<Scalars['String']>; usernamefLotte?: Maybe<Scalars['String']>;
usernameSlack?: Maybe<Scalars['String']>; usernameSlack?: Maybe<Scalars['String']>;
memberADFC: Scalars['Boolean']; memberADFC: Scalars['Boolean'];
locationZIPs?: Maybe<Array<Maybe<Scalars['String']>>>; locationZIPs?: Maybe<Array<Maybe<Scalars['String']>>>;
roleCoreTeam: Scalars['Boolean']; memberCoreTeam: Scalars['Boolean'];
roleCoordinator: Scalars['Boolean']; roleCoordinator: Scalars['Boolean'];
roleEmployeADFC: Scalars['Boolean']; roleEmployeADFC: Scalars['Boolean'];
/** Wahr, wenn die Person Pate ist. */ /** Wahr, wenn die Person Pate ist. */
@ -219,6 +234,52 @@ export type Participant = {
*/ */
distributedActiveBikeParte: Scalars['Boolean']; distributedActiveBikeParte: Scalars['Boolean'];
reserve?: Maybe<Scalars['String']>; reserve?: Maybe<Scalars['String']>;
engagement?: Maybe<Array<Maybe<Engagement>>>;
};
export type ParticipantCreateInput = {
start: Scalars['Date'];
end?: Maybe<Scalars['Date']>;
/** must create contactinformation first, if you want to use new */
contactInformationId: Scalars['ID'];
usernamefLotte?: Maybe<Scalars['String']>;
usernameSlack?: Maybe<Scalars['String']>;
memberADFC: Scalars['Boolean'];
locationZIPs?: Maybe<Array<Maybe<Scalars['String']>>>;
memberCoreTeam: Scalars['Boolean'];
/** Date of workshop to become Mentor dt. Pate */
workshopMentor?: Maybe<Scalars['Date']>;
/** Date of last Erste Hilfe Kurs? */
workshopAmbulance?: Maybe<Scalars['Date']>;
reserve?: Maybe<Scalars['String']>;
};
export type Engagement = {
__typename?: 'Engagement';
id: Scalars['ID'];
from: Scalars['Date'];
to?: Maybe<Scalars['Date']>;
participant?: Maybe<Participant>;
cargoBike?: Maybe<CargoBike>;
roleCoordinator: Scalars['Boolean'];
roleEmployeADFC: Scalars['Boolean'];
/** Wahr, wenn die Person Pate ist. */
roleMentor: Scalars['Boolean'];
roleAmbulance: Scalars['Boolean'];
roleBringer: Scalars['Boolean'];
};
export type EngagementCreateInput = {
from: Scalars['Date'];
to?: Maybe<Scalars['Date']>;
participantId: Scalars['ID'];
cargoBikeId: Scalars['ID'];
roleCoordinator: Scalars['Boolean'];
roleEmployeADFC: Scalars['Boolean'];
/** Wahr, wenn die Person Pate ist. */
roleMentor: Scalars['Boolean'];
roleAmbulance: Scalars['Boolean'];
roleBringer: Scalars['Boolean'];
}; };
export type Taxes = { export type Taxes = {
@ -261,21 +322,53 @@ export type Equipment = {
serialNo: Scalars['String']; serialNo: Scalars['String'];
/** TODO unclear what this means. tomy fragen */ /** TODO unclear what this means. tomy fragen */
investable?: Maybe<Scalars['Boolean']>; investable?: Maybe<Scalars['Boolean']>;
name?: Maybe<Scalars['String']>; title: Scalars['String'];
description?: Maybe<Scalars['String']>;
cargoBike?: Maybe<CargoBike>;
};
export type EquipmentCreateInput = {
serialNo: Scalars['String'];
/** TODO unclear what this means. tomy fragen */
title: Scalars['String'];
description?: Maybe<Scalars['String']>;
investable?: Maybe<Scalars['Boolean']>;
cargoBikeId?: Maybe<Scalars['ID']>;
};
export type EquipmentUpdateInput = {
id: Scalars['ID'];
serialNo?: Maybe<Scalars['String']>;
/** TODO unclear what this means. tomy fragen */
title?: Maybe<Scalars['String']>;
description?: Maybe<Scalars['String']>;
investable?: Maybe<Scalars['Boolean']>;
cargoBikeId?: Maybe<Scalars['ID']>;
}; };
/** An Event is a point in time, when the state of the bike somehow changed. */ /** An Event is a point in time, when the state of the bike somehow changed. */
export type BikeEvent = { export type BikeEvent = {
__typename?: 'BikeEvent'; __typename?: 'BikeEvent';
id: Scalars['ID']; id: Scalars['ID'];
eventType?: Maybe<BikeEventType>; eventType: BikeEventType;
cargoBike: CargoBike;
date: Scalars['Date']; date: Scalars['Date'];
note?: Maybe<Scalars['String']>; note?: Maybe<Scalars['String']>;
/** Path to documents */ /** Path to documents */
documents?: Maybe<Array<Maybe<Scalars['String']>>>; documents: Array<Maybe<Scalars['String']>>;
}; };
/** TODO: Some eventTypes are missing (und auf deutsch) */ export type BikeEventCreateInput = {
eventType: BikeEventType;
/** it is enough to pass the cargoBike id */
cargoBikeId: Scalars['ID'];
date: Scalars['Date'];
note?: Maybe<Scalars['String']>;
/** Path to documents */
documents: Array<Maybe<Scalars['String']>>;
};
/** TODO: Some eventTypes are missing */
export enum BikeEventType { export enum BikeEventType {
/** /**
* The enum EventType can also be represented as an enum in postgresQL. * The enum EventType can also be represented as an enum in postgresQL.
@ -286,7 +379,8 @@ export enum BikeEventType {
Kauf = 'KAUF', Kauf = 'KAUF',
Inbetriebnahme = 'INBETRIEBNAHME', Inbetriebnahme = 'INBETRIEBNAHME',
Ausfall = 'AUSFALL', Ausfall = 'AUSFALL',
Wartung = 'WARTUNG' Wartung = 'WARTUNG',
Andere = 'ANDERE'
} }
/** How are the dimensions and how much weight can handle a bike. This data is merged in the CargoBike table and the BikeModel table. */ /** How are the dimensions and how much weight can handle a bike. This data is merged in the CargoBike table and the BikeModel table. */
@ -408,7 +502,6 @@ export type Provider = {
id: Scalars['ID']; id: Scalars['ID'];
name: Scalars['String']; name: Scalars['String'];
formularName?: Maybe<Scalars['String']>; formularName?: Maybe<Scalars['String']>;
address?: Maybe<Address>;
providerContactPerson?: Maybe<Array<Maybe<ContactInformation>>>; providerContactPerson?: Maybe<Array<Maybe<ContactInformation>>>;
isPrivatePerson: Scalars['Boolean']; isPrivatePerson: Scalars['Boolean'];
organisation?: Maybe<Organisation>; organisation?: Maybe<Organisation>;
@ -431,8 +524,8 @@ export type ContactInformation = {
}; };
export type ContactInformationCreateInput = { export type ContactInformationCreateInput = {
name?: Maybe<Scalars['String']>; name: Scalars['String'];
firstName?: Maybe<Scalars['String']>; firstName: Scalars['String'];
retiredAt?: Maybe<Scalars['Date']>; retiredAt?: Maybe<Scalars['Date']>;
phoneExtern?: Maybe<Scalars['String']>; phoneExtern?: Maybe<Scalars['String']>;
phone2Extern?: Maybe<Scalars['String']>; phone2Extern?: Maybe<Scalars['String']>;
@ -457,9 +550,28 @@ export type ContactInformationUpdateInput = {
note?: Maybe<Scalars['String']>; note?: Maybe<Scalars['String']>;
}; };
export type ContactPerson = {
__typename?: 'ContactPerson';
id: Scalars['ID'];
intern: Scalars['Boolean'];
contactInformation: ContactInformation;
};
export type ContactPersonCreateInput = {
intern: Scalars['Boolean'];
contactInformationId: Scalars['ID'];
};
export type ContactPersonUpdateInput = {
id: Scalars['ID'];
intern?: Maybe<Scalars['Boolean']>;
contactInformationId?: Maybe<Scalars['ID']>;
};
export type Organisation = { export type Organisation = {
__typename?: 'Organisation'; __typename?: 'Organisation';
id: Scalars['ID']; id: Scalars['ID'];
address?: Maybe<Address>;
/** (dt. Ausleihstation) */ /** (dt. Ausleihstation) */
lendingStations?: Maybe<Array<Maybe<LendingStation>>>; lendingStations?: Maybe<Array<Maybe<LendingStation>>>;
/** registration number of association */ /** registration number of association */
@ -475,18 +587,21 @@ export type LendingStation = {
__typename?: 'LendingStation'; __typename?: 'LendingStation';
id: Scalars['ID']; id: Scalars['ID'];
name: Scalars['String']; name: Scalars['String'];
contactInformation: Array<Maybe<ContactInformation>>; contactPersons: Array<Maybe<ContactPerson>>;
address: Address; address: Address;
loanTimes?: Maybe<LoanTimes>; timeFrames: Array<Maybe<TimeFrame>>;
loanPeriods: Array<Maybe<LoanPeriod>>; loanPeriods?: Maybe<LoanPeriods>;
cargoBikes?: Maybe<Array<Maybe<CargoBike>>>;
/** Totola Amount of cargoBikes currently assigned to the lending station */
numCargoBikes: Scalars['Int'];
}; };
export type LendingStationCreateInput = { export type LendingStationCreateInput = {
name: Scalars['String']; name: Scalars['String'];
contactInformation: Array<Maybe<ContactInformationCreateInput>>; contactInformation: Array<Maybe<ContactInformationCreateInput>>;
address: AddressCreateInput; address: AddressCreateInput;
loanTimes?: Maybe<LoanTimesInput>; loanPeriods?: Maybe<LoanPeriodsInput>;
loanPeriods: Array<Maybe<LoanPeriodCreateInput>>; timeFrames: Array<Maybe<TimeFrameCreateInput>>;
}; };
export type LendingStationUpdateInput = { export type LendingStationUpdateInput = {
@ -494,13 +609,13 @@ export type LendingStationUpdateInput = {
name?: Maybe<Scalars['String']>; name?: Maybe<Scalars['String']>;
contactInformation?: Maybe<Array<Maybe<ContactInformationUpdateInput>>>; contactInformation?: Maybe<Array<Maybe<ContactInformationUpdateInput>>>;
address?: Maybe<AddressUpdateInput>; address?: Maybe<AddressUpdateInput>;
loanTimes?: Maybe<LoanTimesInput>; loanPeriods?: Maybe<LoanPeriodsInput>;
loanPeriods?: Maybe<Array<Maybe<LoanPeriodUpdateInput>>>; timeFrames?: Maybe<Array<Maybe<TimeFrameUpdateInput>>>;
}; };
/** (dt. Ausleihzeiten) */ /** (dt. Ausleihzeiten) not implemented */
export type LoanTimes = { export type LoanPeriods = {
__typename?: 'LoanTimes'; __typename?: 'LoanPeriods';
generalRemark?: Maybe<Scalars['String']>; generalRemark?: Maybe<Scalars['String']>;
/** notes for each day of the week, starting on Monday */ /** notes for each day of the week, starting on Monday */
notes?: Maybe<Array<Maybe<Scalars['String']>>>; notes?: Maybe<Array<Maybe<Scalars['String']>>>;
@ -512,7 +627,7 @@ export type LoanTimes = {
}; };
/** (dt. Ausleihzeiten) */ /** (dt. Ausleihzeiten) */
export type LoanTimesInput = { export type LoanPeriodsInput = {
generalRemark?: Maybe<Scalars['String']>; generalRemark?: Maybe<Scalars['String']>;
/** notes for each day of the week, starting on Monday */ /** notes for each day of the week, starting on Monday */
notes?: Maybe<Array<Maybe<Scalars['String']>>>; notes?: Maybe<Array<Maybe<Scalars['String']>>>;
@ -524,8 +639,8 @@ export type LoanTimesInput = {
}; };
/** (dt. Zeitscheibe) */ /** (dt. Zeitscheibe) */
export type LoanPeriod = { export type TimeFrame = {
__typename?: 'LoanPeriod'; __typename?: 'TimeFrame';
id: Scalars['ID']; id: Scalars['ID'];
from: Scalars['Date']; from: Scalars['Date'];
to?: Maybe<Scalars['Date']>; to?: Maybe<Scalars['Date']>;
@ -534,7 +649,7 @@ export type LoanPeriod = {
cargoBike: CargoBike; cargoBike: CargoBike;
}; };
export type LoanPeriodCreateInput = { export type TimeFrameCreateInput = {
from?: Maybe<Scalars['Date']>; from?: Maybe<Scalars['Date']>;
to?: Maybe<Scalars['Date']>; to?: Maybe<Scalars['Date']>;
note?: Maybe<Scalars['String']>; note?: Maybe<Scalars['String']>;
@ -542,7 +657,7 @@ export type LoanPeriodCreateInput = {
cargoBikeID?: Maybe<CargoBikeCreateInput>; cargoBikeID?: Maybe<CargoBikeCreateInput>;
}; };
export type LoanPeriodUpdateInput = { export type TimeFrameUpdateInput = {
id: Scalars['ID']; id: Scalars['ID'];
from?: Maybe<Scalars['Date']>; from?: Maybe<Scalars['Date']>;
to?: Maybe<Scalars['Date']>; to?: Maybe<Scalars['Date']>;
@ -572,18 +687,26 @@ export type AddressUpdateInput = {
export type Query = { export type Query = {
__typename?: 'Query'; __typename?: 'Query';
/** Will (evetually) return all properties of cargo bike */
cargoBikeById?: Maybe<CargoBike>; cargoBikeById?: Maybe<CargoBike>;
/** returns all cargoBikes */ /** returns cargoBikes ordered by name ascending, relations are not loaded, use cargoBikeById instead */
cargoBikes: Array<Maybe<CargoBike>>; cargoBikes: Array<Maybe<CargoBike>>;
/** not important, you can just use providerById {cargoBikes} */ /** return null if id not found */
cargoBikesByProvider: Array<Maybe<CargoBike>>;
providerById?: Maybe<Provider>; providerById?: Maybe<Provider>;
/** unique equipment with pagination, contains relation to bike (with no further joins), so if you wanna know more about the bike, use cargoBikeById */
equipment: Array<Maybe<Equipment>>;
/** equipment by id, will return null if id not found */
equipmentById?: Maybe<Equipment>;
providers: Array<Maybe<Provider>>; providers: Array<Maybe<Provider>>;
/** particcipant by id */
participantById?: Maybe<Participant>; participantById?: Maybe<Participant>;
/** p */
participants: Array<Maybe<Participant>>; participants: Array<Maybe<Participant>>;
lendingStationById?: Maybe<LendingStation>; lendingStationById?: Maybe<LendingStation>;
lendingStations: Array<Maybe<LendingStation>>; lendingStations: Array<Maybe<LendingStation>>;
contactInformation: Array<Maybe<ContactInformation>>; contactInformation: Array<Maybe<ContactInformation>>;
/** returns BikeEvent with CargoBike */
bikeEventById: BikeEvent;
}; };
@ -592,8 +715,9 @@ export type QueryCargoBikeByIdArgs = {
}; };
export type QueryCargoBikesByProviderArgs = { export type QueryCargoBikesArgs = {
providerId: Scalars['ID']; offset: Scalars['Int'];
limit: Scalars['Int'];
}; };
@ -602,38 +726,80 @@ export type QueryProviderByIdArgs = {
}; };
export type QueryEquipmentArgs = {
offset: Scalars['Int'];
limit: Scalars['Int'];
};
export type QueryEquipmentByIdArgs = {
id: Scalars['ID'];
};
export type QueryParticipantByIdArgs = { export type QueryParticipantByIdArgs = {
id: Scalars['ID']; id: Scalars['ID'];
}; };
export type QueryParticipantsArgs = {
offset: Scalars['Int'];
limit: Scalars['Int'];
};
export type QueryLendingStationByIdArgs = { export type QueryLendingStationByIdArgs = {
id: Scalars['ID']; id: Scalars['ID'];
}; };
export type QueryLendingStationsArgs = {
offset: Scalars['Int'];
limit: Scalars['Int'];
};
export type QueryBikeEventByIdArgs = {
id: Scalars['ID'];
};
export type Mutation = { export type Mutation = {
__typename?: 'Mutation'; __typename?: 'Mutation';
/** for testing */
addBike: CargoBike;
/** creates new cargoBike and returns cargobike with new ID */ /** creates new cargoBike and returns cargobike with new ID */
createCargoBike: CargoBike; createCargoBike: CargoBike;
/** lock cargoBike - not implemented */
lockCargoBikeById: Scalars['Boolean'];
/** updates cargoBike of given ID with supplied fields and returns updated cargoBike */ /** updates cargoBike of given ID with supplied fields and returns updated cargoBike */
updateCargoBike: CargoBike; updateCargoBike: CargoBike;
/** creates new peace of unique Equipment */
createEquipment: Equipment;
/** update Equipment, returns updated equipment. CargoBike will be null, if cargoBikeId is not set. Pass null for cargoBikeIs to delete the relation */
updateEquipment: Equipment;
/** creates new lendingStation and returns lendingStation with new ID */ /** creates new lendingStation and returns lendingStation with new ID */
createLendingStation: LendingStation; createLendingStation: LendingStation;
/** updates lendingStation of given ID with supplied fields and returns updated lendingStation */ /** updates lendingStation of given ID with supplied fields and returns updated lendingStation */
updateLendingStation: LendingStation; updateLendingStation: LendingStation;
/** creates new BikeEvent */
createBikeEvent: BikeEvent;
/** create participant */
createParticipant: Participant;
/** create new contactInfo */
createContactInformation: ContactInformation;
/** create Engagement */
createEngagement: Engagement;
/** createContacPerson ,return null if contactInformationId does not exist */
createContactPerson?: Maybe<ContactPerson>;
updateContactPerson?: Maybe<ContactPerson>;
}; };
export type MutationAddBikeArgs = { export type MutationCreateCargoBikeArgs = {
id: Scalars['ID']; cargoBike: CargoBikeCreateInput;
name?: Maybe<Scalars['String']>;
}; };
export type MutationCreateCargoBikeArgs = { export type MutationLockCargoBikeByIdArgs = {
cargoBike: CargoBikeCreateInput; id: Scalars['ID'];
}; };
@ -642,6 +808,16 @@ export type MutationUpdateCargoBikeArgs = {
}; };
export type MutationCreateEquipmentArgs = {
equipment: EquipmentCreateInput;
};
export type MutationUpdateEquipmentArgs = {
equipment: EquipmentUpdateInput;
};
export type MutationCreateLendingStationArgs = { export type MutationCreateLendingStationArgs = {
lendingStation?: Maybe<LendingStationCreateInput>; lendingStation?: Maybe<LendingStationCreateInput>;
}; };
@ -651,6 +827,36 @@ export type MutationUpdateLendingStationArgs = {
lendingstation: LendingStationUpdateInput; lendingstation: LendingStationUpdateInput;
}; };
export type MutationCreateBikeEventArgs = {
bikeEvent?: Maybe<BikeEventCreateInput>;
};
export type MutationCreateParticipantArgs = {
participant: ParticipantCreateInput;
};
export type MutationCreateContactInformationArgs = {
contactInformation: ContactInformationCreateInput;
};
export type MutationCreateEngagementArgs = {
engagement?: Maybe<EngagementCreateInput>;
};
export type MutationCreateContactPersonArgs = {
contactPerson?: Maybe<ContactPersonCreateInput>;
};
export type MutationUpdateContactPersonArgs = {
contactPerson?: Maybe<ContactPersonUpdateInput>;
};
export enum CacheControlScope { export enum CacheControlScope {
Public = 'PUBLIC', Public = 'PUBLIC',
Private = 'PRIVATE' Private = 'PRIVATE'
@ -666,10 +872,23 @@ export type GetCargoBikeByIdQuery = (
{ __typename?: 'Query' } { __typename?: 'Query' }
& { cargoBikeById?: Maybe<( & { cargoBikeById?: Maybe<(
{ __typename?: 'CargoBike' } { __typename?: 'CargoBike' }
& CargoBikeFragmentFragment & CargoBikeFieldsFragment
)> } )> }
); );
export type UpdateCargoBikeMutationVariables = Exact<{
bike: CargoBikeUpdateInput;
}>;
export type UpdateCargoBikeMutation = (
{ __typename?: 'Mutation' }
& { updateCargoBike: (
{ __typename?: 'CargoBike' }
& CargoBikeFieldsFragment
) }
);
export type GetCargoBikesQueryVariables = Exact<{ [key: string]: never; }>; export type GetCargoBikesQueryVariables = Exact<{ [key: string]: never; }>;
@ -677,19 +896,19 @@ export type GetCargoBikesQuery = (
{ __typename?: 'Query' } { __typename?: 'Query' }
& { cargoBikes: Array<Maybe<( & { cargoBikes: Array<Maybe<(
{ __typename?: 'CargoBike' } { __typename?: 'CargoBike' }
& CargoBikeFragmentFragment & CargoBikeFieldsFragment
)>> } )>> }
); );
export type CargoBikeFragmentFragment = ( export type CargoBikeFieldsFragment = (
{ __typename?: 'CargoBike' } { __typename?: 'CargoBike' }
& Pick<CargoBike, 'id' | 'group' | 'name' | 'numberOfChildren'> & Pick<CargoBike, 'id' | 'group' | 'name' | 'numberOfChildren'>
& { events?: Maybe<Array<Maybe<( & { bikeEvents?: Maybe<Array<Maybe<(
{ __typename?: 'BikeEvent' } { __typename?: 'BikeEvent' }
& Pick<BikeEvent, 'date'> & Pick<BikeEvent, 'date' | 'id'>
)>>>, insuranceData: ( )>>>, insuranceData: (
{ __typename?: 'InsuranceData' } { __typename?: 'InsuranceData' }
& Pick<InsuranceData, 'billing'> & Pick<InsuranceData, 'billing' | 'hasFixedRate'>
), dimensionsAndLoad: ( ), dimensionsAndLoad: (
{ __typename?: 'DimensionsAndLoad' } { __typename?: 'DimensionsAndLoad' }
& Pick<DimensionsAndLoad, 'bikeLength' | 'bikeWeight' | 'bikeHeight' | 'bikeWidth' | 'boxHeight' | 'boxLength' | 'boxWidth' | 'hasCoverBox' | 'lockable' | 'maxWeightBox' | 'maxWeightLuggageRack' | 'maxWeightTotal'> & Pick<DimensionsAndLoad, 'bikeLength' | 'bikeWeight' | 'bikeHeight' | 'bikeWidth' | 'boxHeight' | 'boxLength' | 'boxWidth' | 'hasCoverBox' | 'lockable' | 'maxWeightBox' | 'maxWeightLuggageRack' | 'maxWeightTotal'>
@ -699,16 +918,18 @@ export type CargoBikeFragmentFragment = (
) } ) }
); );
export const CargoBikeFragmentFragmentDoc = gql` export const CargoBikeFieldsFragmentDoc = gql`
fragment CargoBikeFragment on CargoBike { fragment CargoBikeFields on CargoBike {
id id
group group
name name
events { bikeEvents {
date date
id
} }
insuranceData { insuranceData {
billing billing
hasFixedRate
} }
dimensionsAndLoad { dimensionsAndLoad {
bikeLength bikeLength
@ -751,10 +972,10 @@ export const CargoBikeFragmentFragmentDoc = gql`
export const GetCargoBikeByIdDocument = gql` export const GetCargoBikeByIdDocument = gql`
query GetCargoBikeById($id: ID!) { query GetCargoBikeById($id: ID!) {
cargoBikeById(id: $id) { cargoBikeById(id: $id) {
...CargoBikeFragment ...CargoBikeFields
} }
} }
${CargoBikeFragmentFragmentDoc}`; ${CargoBikeFieldsFragmentDoc}`;
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
@ -762,17 +983,35 @@ export const GetCargoBikeByIdDocument = gql`
export class GetCargoBikeByIdGQL extends Apollo.Query<GetCargoBikeByIdQuery, GetCargoBikeByIdQueryVariables> { export class GetCargoBikeByIdGQL extends Apollo.Query<GetCargoBikeByIdQuery, GetCargoBikeByIdQueryVariables> {
document = GetCargoBikeByIdDocument; document = GetCargoBikeByIdDocument;
constructor(apollo: Apollo.Apollo) {
super(apollo);
}
}
export const UpdateCargoBikeDocument = gql`
mutation UpdateCargoBike($bike: CargoBikeUpdateInput!) {
updateCargoBike(cargoBike: $bike) {
...CargoBikeFields
}
}
${CargoBikeFieldsFragmentDoc}`;
@Injectable({
providedIn: 'root'
})
export class UpdateCargoBikeGQL extends Apollo.Mutation<UpdateCargoBikeMutation, UpdateCargoBikeMutationVariables> {
document = UpdateCargoBikeDocument;
constructor(apollo: Apollo.Apollo) { constructor(apollo: Apollo.Apollo) {
super(apollo); super(apollo);
} }
} }
export const GetCargoBikesDocument = gql` export const GetCargoBikesDocument = gql`
query GetCargoBikes { query GetCargoBikes {
cargoBikes { cargoBikes(limit: 100, offset: 0) {
...CargoBikeFragment ...CargoBikeFields
} }
} }
${CargoBikeFragmentFragmentDoc}`; ${CargoBikeFieldsFragmentDoc}`;
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'

@ -9,7 +9,7 @@
"experimentalDecorators": true, "experimentalDecorators": true,
"moduleResolution": "node", "moduleResolution": "node",
"importHelpers": true, "importHelpers": true,
"target": "es2016", "target": "es2015",
"module": "es2020", "module": "es2020",
"lib": [ "lib": [
"es2018", "es2018",

Loading…
Cancel
Save