From 037cd066518663949f815cc2046913b458e31de2 Mon Sep 17 00:00:00 2001 From: leonnicolas Date: Sun, 27 Sep 2020 02:55:39 +0200 Subject: [PATCH] src/model/*: applied more changes from flotte --- src/index.ts | 2 - src/model/BikeFeatures.ts | 109 -------------------------------------- src/model/BikeModel.ts | 11 ---- src/model/CargoBike.ts | 108 ++++++++++++++++++++++++++++++++++++- 4 files changed, 106 insertions(+), 124 deletions(-) delete mode 100644 src/model/BikeFeatures.ts delete mode 100644 src/model/BikeModel.ts diff --git a/src/index.ts b/src/index.ts index b2084b6..19b41a1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -9,7 +9,6 @@ import express from 'express'; import { requiredPermissions } from './datasources/userserver/permission'; import { CargoBike } from './model/CargoBike'; import { BikeEvent } from './model/BikeEvent'; -import { BikeModel } from './model/BikeModel'; import { ContactInformation } from './model/ContactInformation'; import { Equipment } from './model/Equipment'; import { LendingStation } from './model/LendingStation'; @@ -69,7 +68,6 @@ createConnection({ CargoBike, BikeEvent, BikeEventType, - BikeModel, ContactInformation, Equipment, EquipmentType, diff --git a/src/model/BikeFeatures.ts b/src/model/BikeFeatures.ts deleted file mode 100644 index 7231d9a..0000000 --- a/src/model/BikeFeatures.ts +++ /dev/null @@ -1,109 +0,0 @@ -import { Column } from 'typeorm'; - -export class TechnicalEquipment { - @Column() - bicycleShift: string; - - @Column() - isEBike: boolean; - - @Column() - hasLightSystem: boolean; - - @Column({ - nullable: true - }) - specialFeatures: string; -} - -export class DimensionsAndLoad { - @Column() - hasCoverBox: boolean; - - @Column() - lockable:boolean; - - @Column({ - type: 'decimal' - }) - boxLength: number; - - @Column({ - type: 'decimal' - }) - boxWidth: number; - - @Column({ - type: 'decimal' - }) - boxHeight: number; - - @Column({ - type: 'decimal' - }) - maxWeightBox: number; - - @Column({ - type: 'decimal' - }) - maxWeightLuggageRack: number; - - @Column({ - type: 'decimal' - }) - maxWeightTotal: number; - - @Column({ - type: 'decimal' - }) - bikeLength: number; - - @Column({ - nullable: true, - type: 'decimal' - - }) - bikeWidth: number; - - @Column({ - nullable: true, - type: 'decimal' - - }) - bikeHeight: number; - - @Column({ - nullable: true, - type: 'decimal' - - }) - bikeWeight: number; -} - -export abstract class Bike { - @Column({ - nullable: true - }) - description: string; - - @Column() - modelName: string; - - @Column() - numberOfWheels: number; - - @Column() - forCargo: boolean; - - @Column() - forChildren: boolean; - - @Column() - numberOfChildren: number; - - @Column(type => TechnicalEquipment) - technicalEquipment: TechnicalEquipment; - - @Column(type => DimensionsAndLoad) - dimensionsAndLoad: DimensionsAndLoad; -} diff --git a/src/model/BikeModel.ts b/src/model/BikeModel.ts deleted file mode 100644 index c1efd90..0000000 --- a/src/model/BikeModel.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { PrimaryGeneratedColumn, Column, Entity } from 'typeorm'; -import { Bike } from './BikeFeatures'; - -@Entity() -export class BikeModel extends Bike { - @PrimaryGeneratedColumn() - id: number; - - @Column() - name: string; -} diff --git a/src/model/CargoBike.ts b/src/model/CargoBike.ts index 35ab3f3..48cf0f0 100644 --- a/src/model/CargoBike.ts +++ b/src/model/CargoBike.ts @@ -1,6 +1,5 @@ /* eslint no-unused-vars: "off" */ import { Entity, Column, PrimaryGeneratedColumn, OneToMany, ManyToOne, JoinColumn, ManyToMany } from 'typeorm'; -import { Bike } from './BikeFeatures'; import { Provider } from './Provider'; import { Participant } from './Participant'; import { InsuranceData } from './InsuranceData'; @@ -61,9 +60,88 @@ export class Security { }) adfcCoding: string; } +export class TechnicalEquipment { + @Column() + bicycleShift: string; + + @Column() + isEBike: boolean; + + @Column() + hasLightSystem: boolean; + + @Column({ + nullable: true + }) + specialFeatures: string; +} + +export class DimensionsAndLoad { + @Column() + hasCoverBox: boolean; + + @Column() + lockable:boolean; + + @Column({ + type: 'decimal' + }) + boxLength: number; + + @Column({ + type: 'decimal' + }) + boxWidth: number; + + @Column({ + type: 'decimal' + }) + boxHeight: number; + + @Column({ + type: 'decimal' + }) + maxWeightBox: number; + + @Column({ + type: 'decimal' + }) + maxWeightLuggageRack: number; + + @Column({ + type: 'decimal' + }) + maxWeightTotal: number; + + @Column({ + type: 'decimal' + }) + bikeLength: number; + + @Column({ + nullable: true, + type: 'decimal' + + }) + bikeWidth: number; + + @Column({ + nullable: true, + type: 'decimal' + + }) + bikeHeight: number; + + @Column({ + nullable: true, + type: 'decimal' + + }) + bikeWeight: number; +} @Entity() -export class CargoBike extends Bike implements Lockable { +export class CargoBike implements Lockable { @PrimaryGeneratedColumn() id: number; @@ -133,6 +211,32 @@ export class CargoBike extends Bike implements Lockable { @Column(type => Taxes) taxes: Taxes; + @Column({ + nullable: true + }) + description: string; + + @Column() + modelName: string; + + @Column() + numberOfWheels: number; + + @Column() + forCargo: boolean; + + @Column() + forChildren: boolean; + + @Column() + numberOfChildren: number; + + @Column(type => TechnicalEquipment) + technicalEquipment: TechnicalEquipment; + + @Column(type => DimensionsAndLoad) + dimensionsAndLoad: DimensionsAndLoad; + @Column({ nullable: true })