diff --git a/api/V1/Schedule.ts b/api/V1/Schedule.ts index 36661a0c..172c76ea 100644 --- a/api/V1/Schedule.ts +++ b/api/V1/Schedule.ts @@ -142,6 +142,10 @@ async function getSchedule(device: any, response: Response, user = null) { resData.devices = await models.Device.onlyUsersDevicesMatching(user, { ScheduleId: device.ScheduleId }); + } else if (user) { + resData.devices = await models.Device.onlyUsersDevicesMatching(user, { + id: device.id + }); } return responseUtil.send(response, resData); } diff --git a/models/DetailSnapshot.ts b/models/DetailSnapshot.ts index a5fef5bd..7e899b61 100644 --- a/models/DetailSnapshot.ts +++ b/models/DetailSnapshot.ts @@ -27,7 +27,7 @@ export interface DetailSnapShot ModelCommon { getFile: () => Promise; id: DetailSnapshotId; - type: "algorithm" | "throttle" | "audioBait"; + type: "algorithm" | "throttle" | "audioBait" | "systemError"; details: any; // JSON } @@ -79,7 +79,9 @@ export default function(sequelize, DataTypes): DetailSnapshotStatic { const existing = await this.findOne({ where: { type: searchType, - details: searchDetails + details: { + [Op.eq]: searchDetails, // Need to specify the equal operator as it's a JSONB + }, } });