Skip to content
This repository has been archived by the owner on Aug 9, 2021. It is now read-only.

Commit

Permalink
Fix logic error in file processing completed, where recording doesn't…
Browse files Browse the repository at this point in the history
… exist.
  • Loading branch information
hardiesoft committed Jun 16, 2021
1 parent 42c2cfb commit 2938f46
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
7 changes: 6 additions & 1 deletion api/fileProcessing/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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")) {
Expand Down
5 changes: 1 addition & 4 deletions models/Recording.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down

0 comments on commit 2938f46

Please sign in to comment.