add features

This commit is contained in:
Matthias Hochmeister
2026-02-27 20:33:43 +01:00
parent e2713e25ba
commit 46d3f5b351
9 changed files with 33 additions and 52 deletions

View File

@@ -74,7 +74,7 @@ class IncidentController {
// -------------------------------------------------------------------------
async getIncident(req: AuthenticatedRequest, res: Response): Promise<void> {
try {
const { id } = req.params;
const { id } = req.params as Record<string, string>;
const incident = await incidentService.getIncidentById(id);
if (!incident) {
@@ -147,7 +147,7 @@ class IncidentController {
return;
}
const { id } = req.params;
const { id } = req.params as Record<string, string>;
const parseResult = UpdateEinsatzSchema.safeParse(req.body);
if (!parseResult.success) {
res.status(400).json({
@@ -181,7 +181,7 @@ class IncidentController {
return;
}
const { id } = req.params;
const { id } = req.params as Record<string, string>;
await incidentService.deleteIncident(id, req.user.id);
res.status(200).json({ success: true, message: 'Einsatz archiviert' });
@@ -200,7 +200,7 @@ class IncidentController {
// -------------------------------------------------------------------------
async assignPersonnel(req: AuthenticatedRequest, res: Response): Promise<void> {
try {
const { id } = req.params;
const { id } = req.params as Record<string, string>;
const parseResult = AssignPersonnelSchema.safeParse(req.body);
if (!parseResult.success) {
@@ -226,7 +226,7 @@ class IncidentController {
// -------------------------------------------------------------------------
async removePersonnel(req: AuthenticatedRequest, res: Response): Promise<void> {
try {
const { id, userId } = req.params;
const { id, userId } = req.params as Record<string, string>;
await incidentService.removePersonnel(id, userId);
res.status(200).json({ success: true, message: 'Person entfernt' });
@@ -245,7 +245,7 @@ class IncidentController {
// -------------------------------------------------------------------------
async assignVehicle(req: AuthenticatedRequest, res: Response): Promise<void> {
try {
const { id } = req.params;
const { id } = req.params as Record<string, string>;
const parseResult = AssignVehicleSchema.safeParse(req.body);
if (!parseResult.success) {
@@ -271,7 +271,7 @@ class IncidentController {
// -------------------------------------------------------------------------
async removeVehicle(req: AuthenticatedRequest, res: Response): Promise<void> {
try {
const { id, fahrzeugId } = req.params;
const { id, fahrzeugId } = req.params as Record<string, string>;
await incidentService.removeVehicle(id, fahrzeugId);
res.status(200).json({ success: true, message: 'Fahrzeug entfernt' });