model clean and consistent naming
This commit is contained in:
parent
3ff44f7370
commit
0d8499b828
11 changed files with 59 additions and 64 deletions
|
@ -1,11 +1,11 @@
|
|||
import { Column, ColumnType, Entity, ManyToOne, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
||||
import { getTypeByORM } from "../../../migrations/ormHelper";
|
||||
import { WearableType } from "./wearableType";
|
||||
import { DamageReport } from "../damageReport";
|
||||
import { wearableType } from "./wearableType";
|
||||
import { damageReport } from "../damageReport";
|
||||
import { member } from "../../club/member/member";
|
||||
|
||||
@Entity()
|
||||
export class Wearable {
|
||||
export class wearable {
|
||||
@PrimaryGeneratedColumn("uuid")
|
||||
id: string;
|
||||
|
||||
|
@ -25,17 +25,17 @@ export class Wearable {
|
|||
decommissioned?: Date;
|
||||
|
||||
@Column()
|
||||
equipmentTypeId: string;
|
||||
wearableTypeId: string;
|
||||
|
||||
@Column()
|
||||
wearerId: string;
|
||||
|
||||
@ManyToOne(() => WearableType, {
|
||||
@ManyToOne(() => wearableType, {
|
||||
nullable: false,
|
||||
onDelete: "RESTRICT",
|
||||
onUpdate: "RESTRICT",
|
||||
})
|
||||
wearableType: WearableType;
|
||||
wearableType: wearableType;
|
||||
|
||||
@ManyToOne(() => member, {
|
||||
nullable: false,
|
||||
|
@ -44,6 +44,6 @@ export class Wearable {
|
|||
})
|
||||
wearer: member;
|
||||
|
||||
@OneToMany(() => DamageReport, (d) => d.wearable, { cascade: ["insert"] })
|
||||
reports: DamageReport[];
|
||||
@OneToMany(() => damageReport, (d) => d.wearable, { cascade: ["insert"] })
|
||||
reports: damageReport[];
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
||||
import { Wearable } from "./wearable";
|
||||
import { wearable as wearable } from "./wearable";
|
||||
|
||||
@Entity()
|
||||
export class WearableType {
|
||||
export class wearableType {
|
||||
@PrimaryGeneratedColumn("uuid")
|
||||
id: string;
|
||||
|
||||
|
@ -12,6 +12,6 @@ export class WearableType {
|
|||
@Column({ type: "text", nullable: true })
|
||||
description: string;
|
||||
|
||||
@OneToMany(() => Wearable, (e) => e.wearableType, { cascade: ["insert"] })
|
||||
equipment: Wearable[];
|
||||
@OneToMany(() => wearable, (e) => e.wearableType, { cascade: ["insert"] })
|
||||
wearable: wearable[];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue