count instances to type
This commit is contained in:
parent
705297ba50
commit
c42a41d895
12 changed files with 24 additions and 3 deletions
|
@ -18,4 +18,6 @@ export class equipmentType {
|
||||||
|
|
||||||
@OneToMany(() => inspectionPlan, (ip) => ip.equipmentType)
|
@OneToMany(() => inspectionPlan, (ip) => ip.equipmentType)
|
||||||
inspectionPlans: inspectionPlan[];
|
inspectionPlans: inspectionPlan[];
|
||||||
|
|
||||||
|
equipmentCount: number;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,4 +18,6 @@ export class vehicleType {
|
||||||
|
|
||||||
@OneToMany(() => inspectionPlan, (ip) => ip.vehicleType)
|
@OneToMany(() => inspectionPlan, (ip) => ip.vehicleType)
|
||||||
inspectionPlans: inspectionPlan[];
|
inspectionPlans: inspectionPlan[];
|
||||||
|
|
||||||
|
vehicleCount: number;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,4 +18,6 @@ export class wearableType {
|
||||||
|
|
||||||
@OneToMany(() => inspectionPlan, (ip) => ip.wearableType)
|
@OneToMany(() => inspectionPlan, (ip) => ip.wearableType)
|
||||||
inspectionPlans: inspectionPlan[];
|
inspectionPlans: inspectionPlan[];
|
||||||
|
|
||||||
|
wearableCount: number;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ export default abstract class EquipmentTypeFactory {
|
||||||
id: record.id,
|
id: record.id,
|
||||||
type: record.type,
|
type: record.type,
|
||||||
description: record.description,
|
description: record.description,
|
||||||
|
equipmentCount: record.equipmentCount,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ export default abstract class VehicleTypeFactory {
|
||||||
id: record.id,
|
id: record.id,
|
||||||
type: record.type,
|
type: record.type,
|
||||||
description: record.description,
|
description: record.description,
|
||||||
|
vehicleCount: record.vehicleCount,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ export default abstract class WearableTypeFactory {
|
||||||
id: record.id,
|
id: record.id,
|
||||||
type: record.type,
|
type: record.type,
|
||||||
description: record.description,
|
description: record.description,
|
||||||
|
wearableCount: record.wearableCount,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,10 @@ export default abstract class EquipmentTypeService {
|
||||||
search?: string;
|
search?: string;
|
||||||
noLimit?: boolean;
|
noLimit?: boolean;
|
||||||
}): Promise<[Array<equipmentType>, number]> {
|
}): Promise<[Array<equipmentType>, number]> {
|
||||||
let query = dataSource.getRepository(equipmentType).createQueryBuilder("equipmentType");
|
let query = dataSource
|
||||||
|
.getRepository(equipmentType)
|
||||||
|
.createQueryBuilder("equipmentType")
|
||||||
|
.loadRelationCountAndMap("equipmentType.equipmentCount", "equipmentType.equipment");
|
||||||
|
|
||||||
if (search != "") {
|
if (search != "") {
|
||||||
query = query.where({
|
query = query.where({
|
||||||
|
|
|
@ -19,7 +19,10 @@ export default abstract class VehicleTypeService {
|
||||||
search?: string;
|
search?: string;
|
||||||
noLimit?: boolean;
|
noLimit?: boolean;
|
||||||
}): Promise<[Array<vehicleType>, number]> {
|
}): Promise<[Array<vehicleType>, number]> {
|
||||||
let query = dataSource.getRepository(vehicleType).createQueryBuilder("vehicleType");
|
let query = dataSource
|
||||||
|
.getRepository(vehicleType)
|
||||||
|
.createQueryBuilder("vehicleType")
|
||||||
|
.loadRelationCountAndMap("vehicleType.vehicleCount", "vehicleType.vehicle");
|
||||||
|
|
||||||
if (search != "") {
|
if (search != "") {
|
||||||
query = query.where({
|
query = query.where({
|
||||||
|
|
|
@ -19,7 +19,10 @@ export default abstract class WearableTypeService {
|
||||||
search?: string;
|
search?: string;
|
||||||
noLimit?: boolean;
|
noLimit?: boolean;
|
||||||
}): Promise<[Array<wearableType>, number]> {
|
}): Promise<[Array<wearableType>, number]> {
|
||||||
let query = dataSource.getRepository(wearableType).createQueryBuilder("wearableType");
|
let query = dataSource
|
||||||
|
.getRepository(wearableType)
|
||||||
|
.createQueryBuilder("wearableType")
|
||||||
|
.loadRelationCountAndMap("wearableType.wearableCount", "wearableType.wearable");
|
||||||
|
|
||||||
if (search != "") {
|
if (search != "") {
|
||||||
query = query.where({
|
query = query.where({
|
||||||
|
|
|
@ -2,4 +2,5 @@ export interface EquipmentTypeViewModel {
|
||||||
id: string;
|
id: string;
|
||||||
type: string;
|
type: string;
|
||||||
description: string;
|
description: string;
|
||||||
|
equipmentCount: number;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,4 +2,5 @@ export interface VehicleTypeViewModel {
|
||||||
id: string;
|
id: string;
|
||||||
type: string;
|
type: string;
|
||||||
description: string;
|
description: string;
|
||||||
|
vehicleCount: number;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,4 +2,5 @@ export interface WearableTypeViewModel {
|
||||||
id: string;
|
id: string;
|
||||||
type: string;
|
type: string;
|
||||||
description: string;
|
description: string;
|
||||||
|
wearableCount: number;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue