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: "equipmentTypeId", ...getTypeByORM("uuid", true) },
|
||||
{ name: "vehicleTypeId", ...getTypeByORM("uuid", true) },
|
||||
{ name: "wearableTypeId", ...getTypeByORM("uuid", true) },
|
||||
],
|
||||
foreignKeys: [
|
||||
new TableForeignKey({
|
||||
|
@ -27,6 +28,13 @@ export const inspection_plan_table = new Table({
|
|||
onDelete: "CASCADE",
|
||||
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: "equipmentId", ...getTypeByORM("uuid", true) },
|
||||
{ name: "vehicleId", ...getTypeByORM("uuid", true) },
|
||||
{ name: "wearableId", ...getTypeByORM("uuid", true) },
|
||||
],
|
||||
foreignKeys: [
|
||||
new TableForeignKey({
|
||||
|
@ -120,6 +129,13 @@ export const inspection_table = new Table({
|
|||
onDelete: "CASCADE",
|
||||
onUpdate: "RESTRICT",
|
||||
}),
|
||||
new TableForeignKey({
|
||||
columnNames: ["wearableId"],
|
||||
referencedColumnNames: ["id"],
|
||||
referencedTableName: "wearable",
|
||||
onDelete: "CASCADE",
|
||||
onUpdate: "RESTRICT",
|
||||
}),
|
||||
],
|
||||
});
|
||||
|
||||
|
|
|
@ -274,7 +274,7 @@ router.use(
|
|||
damageReport
|
||||
);
|
||||
router.use(
|
||||
"/mainenance",
|
||||
"/maintenance",
|
||||
PermissionHelper.passCheckSomeMiddleware([
|
||||
{ requiredPermission: "read", section: "unit", module: "maintenance" },
|
||||
{ requiredPermission: "read", section: "unit", module: "equipment" },
|
||||
|
|
|
@ -68,7 +68,7 @@ export default abstract class DamageReportService {
|
|||
}
|
||||
|
||||
return await query
|
||||
.orderBy("reportedAt", "ASC")
|
||||
.orderBy("damageReport.reportedAt", "ASC")
|
||||
.getManyAndCount()
|
||||
.then((res) => {
|
||||
return res;
|
||||
|
|
|
@ -34,7 +34,7 @@ export default abstract class MaintenanceService {
|
|||
}
|
||||
|
||||
return await query
|
||||
.orderBy("maintenance.type", "ASC")
|
||||
.orderBy("maintenance.createdAt", "ASC")
|
||||
.getManyAndCount()
|
||||
.then((res) => {
|
||||
return res;
|
||||
|
|
Loading…
Add table
Reference in a new issue