Skip to content

Commit 66b2653

Browse files
Fix application fetch for global admin with no org query
1 parent bd0ead6 commit 66b2653

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/services/device-management/application.service.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,11 @@ export class ApplicationService {
171171
.leftJoinAndSelect("app.belongsTo", "organization")
172172
.leftJoinAndSelect("device.latestReceivedMessage", "latestMessage")
173173
.leftJoinAndSelect("app.dataTargets", "dataTargets")
174-
.leftJoinAndSelect("app.controlledProperties", "controlledProperties")
175-
.andWhere("app.belongsToId = :organizationId", { organizationId: query.organizationId });
174+
.leftJoinAndSelect("app.controlledProperties", "controlledProperties");
175+
176+
if (query.organizationId) {
177+
queryBuilder.andWhere("app.belongsToId = :organizationId", { organizationId: query.organizationId });
178+
}
176179

177180
if (whitelist && whitelist.length > 0) {
178181
queryBuilder.andWhere("app.id IN (:...whitelist)", { whitelist });

0 commit comments

Comments
 (0)