Merge pull request #24 from fLotte-meets-HWR-DB/dev

Dev
pull/26/head
leonnicolas 4 years ago committed by GitHub
commit eae48349c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -179,7 +179,7 @@ export class ParticipantAPI extends DataSource {
.values([participant])
.returning('*')
.execute();
await entityManager.getRepository(Participant)
participant.workshopIds && await entityManager.getRepository(Participant)
.createQueryBuilder('w')
.relation(Participant, 'workshopIds')
.of(participant.id)
@ -211,8 +211,8 @@ export class ParticipantAPI extends DataSource {
.update()
.set({ ...participant })
.where('id = :id', { id: participant.id })
.execute().then(value => { if (value.affected !== 1) { throw new GraphQLError('ID not found'); } });
await entityManager.getRepository(Participant)
.execute().then(value => { if (value.affected !== 1) { throw new UserInputError('ID not found'); } });
workshops && await entityManager.getRepository(Participant)
.createQueryBuilder('w')
.relation(Participant, 'workshopIds')
.of(participant.id)

@ -65,7 +65,9 @@ export interface Lockable {
}
export class Security {
@Column()
@Column({
nullable: true
})
frameNumber: string;
@Column({
@ -190,9 +192,6 @@ export class CargoBike implements Lockable {
@PrimaryGeneratedColumn()
id: number;
@DeleteDateColumn()
deleteDate: Date;
@Column({
type: 'enum',
enum: Group
@ -268,19 +267,32 @@ export class CargoBike implements Lockable {
})
description: string;
@Column()
@Column({
nullable: true
})
modelName: string;
@Column()
@Column({
nullable: true
})
numberOfWheels: number;
@Column()
@Column({
type: 'boolean',
nullable: true
})
forCargo: boolean;
@Column()
@Column({
type: 'boolean',
nullable: true
})
forChildren: boolean;
@Column()
@Column({
type: 'int',
nullable: true
})
numberOfChildren: number;
@Column(type => TechnicalEquipment)
@ -290,6 +302,7 @@ export class CargoBike implements Lockable {
dimensionsAndLoad: DimensionsAndLoad;
@Column({
type: 'int',
nullable: true
})
lockedBy: number;

@ -113,13 +113,6 @@ export default {
return new GraphQLError('Insufficient Permissions');
}
},
from (parent: any) {
return (parent.dateRange as string).split(',')[0].replace('[', '');
},
to (parent: any) {
const str = (parent.dateRange as string).split(',')[1].replace(')', '');
return (str.length > 0) ? str : null;
},
isLockedByMe: (parent: any, __: any, { req }: { req: any }) => isLockedByMe(parent, { req }),
isLocked: (parent: any, __: any, { req }: { req: any }) => isLocked(parent, { req })
},

@ -45,12 +45,12 @@ export default gql`
numberOfWheels: Int
forCargo: Boolean
forChildren: Boolean
numberOfChildren: Int!
numberOfChildren: Int
"""
Safety is a custom type, that stores information about security features.
TODO: Should this be called Security?
"""
security: Security!
security: Security
"""
Does not refer to an extra table in the database.
"""
@ -102,15 +102,15 @@ export default gql`
group: Group!
name: String!
state: BikeState
modelName: String!
numberOfWheels: Int!
forCargo: Boolean!
forChildren: Boolean!
numberOfChildren: Int!
modelName: String
numberOfWheels: Int
forCargo: Boolean
forChildren: Boolean
numberOfChildren: Int
"""
Safety is a custom type, that stores information about security features.
"""
security: SecurityCreateInput!
security: SecurityCreateInput
"""
Does not refer to an extra table in the database.
"""
@ -360,7 +360,7 @@ export default gql`
So no id needed for mutation. One Mutation for the CargoBike will be enough.
"""
type Security {
frameNumber: String!
frameNumber: String
keyNumberFrameLock: String
keyNumberAXAChain: String
policeCoding: String
@ -368,7 +368,7 @@ export default gql`
}
input SecurityCreateInput {
frameNumber: String!
frameNumber: String
keyNumberFrameLock: String
keyNumberAXAChain: String
policeCoding: String
@ -550,8 +550,7 @@ export default gql`
type Engagement {
id: ID!
engagementType: EngagementType!
from: Date!
to: Date
dateRange: DateRange!
participant: Participant!
cargoBike: CargoBike!
isLocked: Boolean!
@ -563,18 +562,14 @@ export default gql`
input EngagementCreateInput {
engagementTypeId: ID!
"will use CURRENT_DATE if not set"
from: Date
"will use infinit if not set"
to: Date
dateRange: DateRangeInput
participantId: ID!
cargoBikeId: ID!
}
input EngagementUpdateInput {
id: ID!
engagementTypeId: ID
from: Date
to: Date
dateRange: DateRangeInput
participantId: ID
cargoBikeId: ID
keepLock: Boolean

Loading…
Cancel
Save