Skip to content

Commit e67e517

Browse files
pr changes
1 parent 5ab0240 commit e67e517

File tree

2 files changed

+7
-17
lines changed

2 files changed

+7
-17
lines changed

src/entities/dto/list-all-entities.dto.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,6 @@ export class ListAllEntitiesDto {
4242
| "devices"
4343
| "dataTargets"
4444
| "organizationName"
45-
| "commentOnLocation";
45+
| "commentOnLocation"
46+
| "statusCheck";
4647
}

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

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -679,25 +679,14 @@ export class ApplicationService {
679679
private getSortingForApplications(query: ListAllEntitiesDto): Record<string, "ASC" | "DESC"> {
680680
const sorting: Record<string, "ASC" | "DESC"> = {};
681681

682-
if (query.orderOn) {
683-
const validFields = new Set([
684-
"id",
685-
"name",
686-
"updatedAt",
687-
"startDate",
688-
"endDate",
689-
"owner",
690-
"contactPerson",
691-
"personalData",
692-
]);
682+
if (query.orderOn === "statusCheck") {
683+
return sorting;
684+
}
693685

686+
if (query.orderOn) {
694687
const sortOrder = query.sort.toUpperCase() === "DESC" ? "DESC" : "ASC";
695688

696-
if (query.orderOn === "status") {
697-
sorting["status"] = sortOrder;
698-
} else if (validFields.has(query.orderOn)) {
699-
sorting[`app.${query.orderOn}`] = sortOrder;
700-
}
689+
sorting[`app.${query.orderOn}`] = sortOrder;
701690
}
702691

703692
if (Object.keys(sorting).length === 0) {

0 commit comments

Comments
 (0)