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)
|
||||
inspectionPlans: inspectionPlan[];
|
||||
|
||||
equipmentCount: number;
|
||||
}
|
||||
|
|
|
@ -18,4 +18,6 @@ export class vehicleType {
|
|||
|
||||
@OneToMany(() => inspectionPlan, (ip) => ip.vehicleType)
|
||||
inspectionPlans: inspectionPlan[];
|
||||
|
||||
vehicleCount: number;
|
||||
}
|
||||
|
|
|
@ -18,4 +18,6 @@ export class wearableType {
|
|||
|
||||
@OneToMany(() => inspectionPlan, (ip) => ip.wearableType)
|
||||
inspectionPlans: inspectionPlan[];
|
||||
|
||||
wearableCount: number;
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ export default abstract class EquipmentTypeFactory {
|
|||
id: record.id,
|
||||
type: record.type,
|
||||
description: record.description,
|
||||
equipmentCount: record.equipmentCount,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ export default abstract class VehicleTypeFactory {
|
|||
id: record.id,
|
||||
type: record.type,
|
||||
description: record.description,
|
||||
vehicleCount: record.vehicleCount,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ export default abstract class WearableTypeFactory {
|
|||
id: record.id,
|
||||
type: record.type,
|
||||
description: record.description,
|
||||
wearableCount: record.wearableCount,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,10 @@ export default abstract class EquipmentTypeService {
|
|||
search?: string;
|
||||
noLimit?: boolean;
|
||||
}): 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 != "") {
|
||||
query = query.where({
|
||||
|
|
|
@ -19,7 +19,10 @@ export default abstract class VehicleTypeService {
|
|||
search?: string;
|
||||
noLimit?: boolean;
|
||||
}): 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 != "") {
|
||||
query = query.where({
|
||||
|
|
|
@ -19,7 +19,10 @@ export default abstract class WearableTypeService {
|
|||
search?: string;
|
||||
noLimit?: boolean;
|
||||
}): 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 != "") {
|
||||
query = query.where({
|
||||
|
|
|
@ -2,4 +2,5 @@ export interface EquipmentTypeViewModel {
|
|||
id: string;
|
||||
type: string;
|
||||
description: string;
|
||||
equipmentCount: number;
|
||||
}
|
||||
|
|
|
@ -2,4 +2,5 @@ export interface VehicleTypeViewModel {
|
|||
id: string;
|
||||
type: string;
|
||||
description: string;
|
||||
vehicleCount: number;
|
||||
}
|
||||
|
|
|
@ -2,4 +2,5 @@ export interface WearableTypeViewModel {
|
|||
id: string;
|
||||
type: string;
|
||||
description: string;
|
||||
wearableCount: number;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue