Skip to content

Commit 02eb878

Browse files
authored
Fixed api mapping sort options (#878)
1 parent da13d3a commit 02eb878

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

packages/network/src/api/inspection/mappers.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -696,10 +696,11 @@ export function mapApiInspectionsUrlParamsGet(options: GetInspectionsOptions): s
696696
params.append(key, value.toString());
697697
});
698698
}
699-
if (options.sort) {
700-
Object.entries(options.sort).forEach(([key, value]) => {
701-
params.append(key, value.toString());
702-
});
699+
if (options.sort?.sortByProperty) {
700+
params.append('sort_by_property', options.sort.sortByProperty);
701+
}
702+
if (options.sort?.sortOrder) {
703+
params.append('sort_order', options.sort.sortOrder.toString());
703704
}
704705
return `${url}${params.toString()}`;
705706
}

packages/network/src/api/models/inspection.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ interface ApiPaginationParams {
4646
}
4747

4848
interface ApiCursors {
49-
before?: Pick<ApiPaginationParams, 'before'>;
50-
after?: Pick<ApiPaginationParams, 'after'>;
49+
before?: string;
50+
after?: string;
5151
next?: ApiPaginationParams;
5252
previous?: ApiPaginationParams;
5353
}
@@ -76,3 +76,8 @@ export interface ApiInspectionPost {
7676
vehicle?: ApiVehiclePostPatch;
7777
damage_severity?: ApiDamageSeverity;
7878
}
79+
80+
export interface ApiInspectionsSortRequest {
81+
sort_by_property?: string;
82+
sort_drder?: SortOrder;
83+
}

0 commit comments

Comments
 (0)