Merge branch 'main' into feat/new_wifi_tables
This commit is contained in:
@ -7,6 +7,8 @@ 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
|
||||
@ -21,7 +23,7 @@ const router = express.Router();
|
||||
|
||||
router.post(
|
||||
"/webhook",
|
||||
validateData(ttnMessageValidator),
|
||||
[authenticateHeader, validateData(ttnMessageValidator)],
|
||||
async (req: Request, res: Response) => {
|
||||
try {
|
||||
const message = req.body as TtnMessage;
|
||||
@ -92,17 +94,17 @@ router.post(
|
||||
gnss:
|
||||
gnnsLocation.latitude && gnnsLocation.longitude
|
||||
? {
|
||||
latitude: gnnsLocation.latitude,
|
||||
longitude: gnnsLocation.longitude,
|
||||
}
|
||||
latitude: gnnsLocation.latitude,
|
||||
longitude: gnnsLocation.longitude,
|
||||
}
|
||||
: undefined,
|
||||
});
|
||||
};
|
||||
createDatabaseEntries().then();
|
||||
res.status(200);
|
||||
res.status(StatusCodes.OK).send();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
res.status(500).json({ error: "Error creating uplink" });
|
||||
res.status(StatusCodes.INTERNAL_SERVER_ERROR).json({ error: "Error creating uplink" });
|
||||
}
|
||||
}
|
||||
);
|
||||
|
Reference in New Issue
Block a user