diff --git a/api/fileProcessing/index.ts b/api/fileProcessing/index.ts index f9a803f0..8d21e3d4 100644 --- a/api/fileProcessing/index.ts +++ b/api/fileProcessing/index.ts @@ -41,7 +41,7 @@ export default function (app: Application) { * @apiGroup FileProcessing * * @apiParam {Integer} id ID of the recording. - * @apiParam {String} jobKey Key given when reqesting the job. + * @apiParam {String} jobKey Key given when requesting the job. * @apiParam {Boolean} success If the job was finished successfully. * @apiParam {JSON} [result] Result of the file processing * @apiParam {Boolean} complete true if the processing is complete, or false if file will be processed further. @@ -81,6 +81,11 @@ export default function (app: Application) { } const recording = await models.Recording.findOne({ where: { id: id } }); + if (!recording) { + return response.status(400).json({ + messages: [`Recording ${id} not found for jobKey ${jobKey}`] + }); + } // Check that jobKey is correct. if (jobKey != recording.get("jobKey")) { diff --git a/models/Recording.ts b/models/Recording.ts index d8072734..59a86b2d 100644 --- a/models/Recording.ts +++ b/models/Recording.ts @@ -39,11 +39,8 @@ import { GroupId as GroupIdAlias } from "./Group"; import { Track, TrackId } from "./Track"; import jsonwebtoken from "jsonwebtoken"; import { TrackTag } from "./TrackTag"; -import { CreateStationData, Station, StationId } from "./Station"; +import { Station, StationId } from "./Station"; import { - latLngApproxDistance, - MAX_DISTANCE_FROM_STATION_FOR_RECORDING, - MIN_STATION_SEPARATION_METERS, tryToMatchRecordingToStation } from "../api/V1/recordingUtil";