feat: added controller for new services

This commit is contained in:
2025-01-11 12:13:34 +01:00
parent 5a5dcb6334
commit 7b9c6ae5b8
6 changed files with 86 additions and 36 deletions

View File

@ -1,5 +1,7 @@
import express, { Request, Response } from "express";
import { StatusCodes } from "http-status-codes";
import { container } from "tsyringe";
import { authenticateHeader } from "../middleware/authentificationMiddleware";
import { validateData } from "../middleware/validationMiddleware";
import { TtnMessage } from "../models/ttnMessage";
import { LocationService } from "../services/locationService";
@ -7,8 +9,6 @@ import { LpTtnEndDeviceUplinksService } from "../services/lpTtnEndDeviceUplinksS
import { TtnGatewayReceptionService } from "../services/ttnGatewayReceptionService";
import { WifiScanService } from "../services/wifiScanService";
import { ttnMessageValidator } from "../validation/ttn/ttnMessageValidation";
import { authenticateHeader } from "../middleware/authentificationMiddleware";
import { StatusCodes } from "http-status-codes";
const lpTtnEndDeviceUplinksService = container.resolve(
LpTtnEndDeviceUplinksService
@ -94,9 +94,9 @@ router.post(
gnss:
gnnsLocation.latitude && gnnsLocation.longitude
? {
latitude: gnnsLocation.latitude,
longitude: gnnsLocation.longitude,
}
latitude: gnnsLocation.latitude,
longitude: gnnsLocation.longitude,
}
: undefined,
});
};
@ -104,7 +104,9 @@ router.post(
res.status(StatusCodes.OK).send();
} catch (error) {
console.log(error);
res.status(StatusCodes.INTERNAL_SERVER_ERROR).json({ error: "Error creating uplink" });
res
.status(StatusCodes.INTERNAL_SERVER_ERROR)
.json({ error: "Error creating uplink" });
}
}
);