@@ -26,7 +26,9 @@ export function getPagingParams({
2626
2727export const getNotificationsSummary = async ( {
2828 pageIndex,
29- pageSize
29+ pageSize,
30+ sortBy,
31+ sortOrder
3032} : NotificationQueryFilterOptions ) => {
3133 const pagingParams = getPagingParams ( { pageIndex, pageSize } ) ;
3234
@@ -37,9 +39,13 @@ export const getNotificationsSummary = async ({
3739 `created_by(${ AVATAR_INFO } )`
3840 ] . join ( "," ) ;
3941
42+ const sortParams = sortBy
43+ ? `&order=${ sortBy } .${ sortOrder } `
44+ : "&order=created_at.desc" ;
45+
4046 return resolvePostGrestRequestWithPagination (
4147 IncidentCommander . get < NotificationRules [ ] | null > (
42- `/notifications_summary?select=${ selectColumns } &order=created_at.desc ${ pagingParams } ` ,
48+ `/notifications_summary?select=${ selectColumns } ${ sortParams } ${ pagingParams } ` ,
4349 {
4450 headers : {
4551 Prefer : "count=exact"
@@ -131,11 +137,15 @@ export const getNotificationSendHistoryById = async (id: string) => {
131137export type NotificationQueryFilterOptions = {
132138 pageIndex : number ;
133139 pageSize : number ;
140+ sortBy ?: string ;
141+ sortOrder ?: "asc" | "desc" ;
134142} ;
135143
136144export const getNotificationSilences = async ( {
137145 pageIndex,
138- pageSize
146+ pageSize,
147+ sortBy,
148+ sortOrder
139149} : NotificationQueryFilterOptions ) => {
140150 const pagingParams = getPagingParams ( { pageIndex, pageSize } ) ;
141151
@@ -147,9 +157,11 @@ export const getNotificationSilences = async ({
147157 `createdBy:created_by(${ AVATAR_INFO } )`
148158 ] . join ( "," ) ;
149159
160+ const sortParams = sortBy ? `&order=${ sortBy } .${ sortOrder } ` : "" ;
161+
150162 return resolvePostGrestRequestWithPagination (
151163 IncidentCommander . get < NotificationSilenceItemApiResponse [ ] | null > (
152- `/notification_silences?select=${ selectColumns } &order=created_at.desc${ pagingParams } &deleted_at=is.null` ,
164+ `/notification_silences?select=${ selectColumns } &order=created_at.desc${ pagingParams } &deleted_at=is.null& ${ sortParams } ` ,
153165 {
154166 headers : {
155167 Prefer : "count=exact"
0 commit comments