inspection extend fixes
This commit is contained in:
parent
b8b2186c58
commit
d5646753f1
4 changed files with 19 additions and 3 deletions
|
@ -11,6 +11,7 @@ export const inspection_plan_table = new Table({
|
||||||
{ name: "createdAt", ...getTypeByORM("datetime"), default: getDefaultByORM("currentTimestamp") },
|
{ name: "createdAt", ...getTypeByORM("datetime"), default: getDefaultByORM("currentTimestamp") },
|
||||||
{ name: "equipmentTypeId", ...getTypeByORM("uuid", true) },
|
{ name: "equipmentTypeId", ...getTypeByORM("uuid", true) },
|
||||||
{ name: "vehicleTypeId", ...getTypeByORM("uuid", true) },
|
{ name: "vehicleTypeId", ...getTypeByORM("uuid", true) },
|
||||||
|
{ name: "wearableTypeId", ...getTypeByORM("uuid", true) },
|
||||||
],
|
],
|
||||||
foreignKeys: [
|
foreignKeys: [
|
||||||
new TableForeignKey({
|
new TableForeignKey({
|
||||||
|
@ -27,6 +28,13 @@ export const inspection_plan_table = new Table({
|
||||||
onDelete: "CASCADE",
|
onDelete: "CASCADE",
|
||||||
onUpdate: "RESTRICT",
|
onUpdate: "RESTRICT",
|
||||||
}),
|
}),
|
||||||
|
new TableForeignKey({
|
||||||
|
columnNames: ["wearableTypeId"],
|
||||||
|
referencedColumnNames: ["id"],
|
||||||
|
referencedTableName: "wearable_type",
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
onUpdate: "RESTRICT",
|
||||||
|
}),
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -90,6 +98,7 @@ export const inspection_table = new Table({
|
||||||
{ name: "inspectionVersionedPlanId", ...getTypeByORM("uuid") },
|
{ name: "inspectionVersionedPlanId", ...getTypeByORM("uuid") },
|
||||||
{ name: "equipmentId", ...getTypeByORM("uuid", true) },
|
{ name: "equipmentId", ...getTypeByORM("uuid", true) },
|
||||||
{ name: "vehicleId", ...getTypeByORM("uuid", true) },
|
{ name: "vehicleId", ...getTypeByORM("uuid", true) },
|
||||||
|
{ name: "wearableId", ...getTypeByORM("uuid", true) },
|
||||||
],
|
],
|
||||||
foreignKeys: [
|
foreignKeys: [
|
||||||
new TableForeignKey({
|
new TableForeignKey({
|
||||||
|
@ -120,6 +129,13 @@ export const inspection_table = new Table({
|
||||||
onDelete: "CASCADE",
|
onDelete: "CASCADE",
|
||||||
onUpdate: "RESTRICT",
|
onUpdate: "RESTRICT",
|
||||||
}),
|
}),
|
||||||
|
new TableForeignKey({
|
||||||
|
columnNames: ["wearableId"],
|
||||||
|
referencedColumnNames: ["id"],
|
||||||
|
referencedTableName: "wearable",
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
onUpdate: "RESTRICT",
|
||||||
|
}),
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -274,7 +274,7 @@ router.use(
|
||||||
damageReport
|
damageReport
|
||||||
);
|
);
|
||||||
router.use(
|
router.use(
|
||||||
"/mainenance",
|
"/maintenance",
|
||||||
PermissionHelper.passCheckSomeMiddleware([
|
PermissionHelper.passCheckSomeMiddleware([
|
||||||
{ requiredPermission: "read", section: "unit", module: "maintenance" },
|
{ requiredPermission: "read", section: "unit", module: "maintenance" },
|
||||||
{ requiredPermission: "read", section: "unit", module: "equipment" },
|
{ requiredPermission: "read", section: "unit", module: "equipment" },
|
||||||
|
|
|
@ -68,7 +68,7 @@ export default abstract class DamageReportService {
|
||||||
}
|
}
|
||||||
|
|
||||||
return await query
|
return await query
|
||||||
.orderBy("reportedAt", "ASC")
|
.orderBy("damageReport.reportedAt", "ASC")
|
||||||
.getManyAndCount()
|
.getManyAndCount()
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
return res;
|
return res;
|
||||||
|
|
|
@ -34,7 +34,7 @@ export default abstract class MaintenanceService {
|
||||||
}
|
}
|
||||||
|
|
||||||
return await query
|
return await query
|
||||||
.orderBy("maintenance.type", "ASC")
|
.orderBy("maintenance.createdAt", "ASC")
|
||||||
.getManyAndCount()
|
.getManyAndCount()
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
return res;
|
return res;
|
||||||
|
|
Loading…
Add table
Reference in a new issue