src/model/*: finished rough design of entities
parent
c06bb1d1f1
commit
7bcf3c3c46
@ -0,0 +1,11 @@
|
|||||||
|
import { PrimaryGeneratedColumn, Column, Entity } from 'typeorm';
|
||||||
|
import { Bike } from './BikeFeatures';
|
||||||
|
|
||||||
|
@Entity()
|
||||||
|
export class BikeModel extends Bike {
|
||||||
|
@PrimaryGeneratedColumn()
|
||||||
|
id: number;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
name: string;
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
import { Entity, PrimaryGeneratedColumn, Column, OneToMany } from 'typeorm';
|
||||||
|
import { CargoBike } from './CargoBike';
|
||||||
|
|
||||||
|
@Entity()
|
||||||
|
export class Equipment {
|
||||||
|
@PrimaryGeneratedColumn()
|
||||||
|
id: number;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
serialNo: string;
|
||||||
|
|
||||||
|
@OneToMany(type => CargoBike, cargoBike => cargoBike.equipment, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
cargoBike: CargoBike;
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
import { Entity, PrimaryGeneratedColumn, Column, ManyToMany, JoinTable, OneToMany, ManyToOne } from 'typeorm';
|
||||||
|
import { ContactInformation } from './ContactInformation';
|
||||||
|
import { LoanPeriod } from './LoanPeriod';
|
||||||
|
import { CargoBike } from './CargoBike';
|
||||||
|
import { Organization } from './Organization';
|
||||||
|
|
||||||
|
@Entity()
|
||||||
|
export class LendingStation {
|
||||||
|
@PrimaryGeneratedColumn()
|
||||||
|
id: number;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
@ManyToMany(type => ContactInformation)
|
||||||
|
@JoinTable()
|
||||||
|
contactInformation: ContactInformation[];
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
addressStreet: string;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
addressStreetNo: string;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
addressZip: string;
|
||||||
|
|
||||||
|
@OneToMany(type => LoanPeriod, loanPeriod => loanPeriod.lendingStation)
|
||||||
|
loanPeriods: LoanPeriod[];
|
||||||
|
|
||||||
|
@OneToMany(type => CargoBike, cargoBike => cargoBike.lendingStation)
|
||||||
|
cargoBikes: CargoBike[];
|
||||||
|
|
||||||
|
@ManyToOne(type => Organization, organization => organization.lendingStations)
|
||||||
|
organization: Organization;
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
import { Entity, PrimaryGeneratedColumn, Column, ManyToOne } from 'typeorm';
|
||||||
|
import { LendingStation } from './LendingStation';
|
||||||
|
import { CargoBike } from './CargoBike';
|
||||||
|
|
||||||
|
@Entity()
|
||||||
|
export class LoanPeriod {
|
||||||
|
@PrimaryGeneratedColumn()
|
||||||
|
id: number;
|
||||||
|
|
||||||
|
// I have to find out how typorm will map the datetange data type.
|
||||||
|
@Column({
|
||||||
|
type: 'daterange'
|
||||||
|
})
|
||||||
|
dateRange: Date[];
|
||||||
|
|
||||||
|
@ManyToOne(type => LendingStation, lendingStation => lendingStation.loanPeriods)
|
||||||
|
lendingStation: LendingStation;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
note: string;
|
||||||
|
|
||||||
|
@ManyToOne(type => CargoBike, cargoBike => cargoBike.loanPeriods)
|
||||||
|
cargoBike: CargoBike;
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
import { PrimaryGeneratedColumn, OneToOne, OneToMany, Column } from 'typeorm';
|
||||||
|
import { LendingStation } from './LendingStation';
|
||||||
|
import { Provider } from './Provider';
|
||||||
|
|
||||||
|
export class Organization {
|
||||||
|
@PrimaryGeneratedColumn()
|
||||||
|
id: number;
|
||||||
|
|
||||||
|
@OneToMany(type => LendingStation, lendingStation => lendingStation.organization)
|
||||||
|
lendingStations: LendingStation[];
|
||||||
|
|
||||||
|
@OneToOne(type => Provider, provider => provider.organization, {
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
provider: Provider;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
registerdAt: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
registerNo: string;
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
/* eslint no-unused-vars: "off" */
|
||||||
|
import { Column } from 'typeorm';
|
||||||
|
|
||||||
|
export enum OrganizationArea {
|
||||||
|
IB,
|
||||||
|
ZB
|
||||||
|
}
|
||||||
|
export class Taxes {
|
||||||
|
@Column()
|
||||||
|
costCenter: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
type: 'enum',
|
||||||
|
enum: OrganizationArea,
|
||||||
|
nullable: true
|
||||||
|
})
|
||||||
|
organizationArea: OrganizationArea;
|
||||||
|
}
|
Loading…
Reference in New Issue