inspection extend fixes

This commit is contained in:
Julian Krauser 2025-06-13 18:05:55 +02:00
parent b8b2186c58
commit d5646753f1
4 changed files with 19 additions and 3 deletions

View file

@ -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",
}),
],
});

View file

@ -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" },

View file

@ -68,7 +68,7 @@ export default abstract class DamageReportService {
}
return await query
.orderBy("reportedAt", "ASC")
.orderBy("damageReport.reportedAt", "ASC")
.getManyAndCount()
.then((res) => {
return res;

View file

@ -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;