diff --git a/.changeset/poor-coats-boil.md b/.changeset/poor-coats-boil.md new file mode 100644 index 0000000000..b81843806b --- /dev/null +++ b/.changeset/poor-coats-boil.md @@ -0,0 +1,6 @@ +--- +'@backstage/plugin-notifications-backend': minor +'@backstage/plugin-notifications': minor +--- + +notifications-backend URL query parameters changed from sort/sortOrder to orderField and created_after to createdAfter to unify with other plugins diff --git a/plugins/notifications-backend/src/service/router.ts b/plugins/notifications-backend/src/service/router.ts index 959cd7e280..e72775f06f 100644 --- a/plugins/notifications-backend/src/service/router.ts +++ b/plugins/notifications-backend/src/service/router.ts @@ -206,8 +206,8 @@ export async function createRouter( opts.saved = false; // or keep undefined } - if (req.query.created_after) { - const sinceEpoch = Date.parse(String(req.query.created_after)); + if (req.query.createdAfter) { + const sinceEpoch = Date.parse(String(req.query.createdAfter)); if (isNaN(sinceEpoch)) { throw new InputError('Unexpected date format'); } diff --git a/plugins/notifications/src/api/NotificationsClient.test.ts b/plugins/notifications/src/api/NotificationsClient.test.ts index daf9e71232..e9acd04fc9 100644 --- a/plugins/notifications/src/api/NotificationsClient.test.ts +++ b/plugins/notifications/src/api/NotificationsClient.test.ts @@ -60,7 +60,7 @@ describe('NotificationsClient', () => { server.use( rest.get(`${mockBaseUrl}/`, (req, res, ctx) => { expect(req.url.search).toBe( - '?limit=10&offset=0&search=find+me&read=true&created_after=1970-01-01T00%3A00%3A00.005Z', + '?limit=10&offset=0&search=find+me&read=true&createdAfter=1970-01-01T00%3A00%3A00.005Z', ); return res(ctx.json(expectedResp)); }), diff --git a/plugins/notifications/src/api/NotificationsClient.ts b/plugins/notifications/src/api/NotificationsClient.ts index 047c594530..c4fffded9e 100644 --- a/plugins/notifications/src/api/NotificationsClient.ts +++ b/plugins/notifications/src/api/NotificationsClient.ts @@ -65,7 +65,7 @@ export class NotificationsClient implements NotificationsApi { queryString.append('saved', options.saved ? 'true' : 'false'); } if (options?.createdAfter !== undefined) { - queryString.append('created_after', options.createdAfter.toISOString()); + queryString.append('createdAfter', options.createdAfter.toISOString()); } if (options?.minimumSeverity !== undefined) { queryString.append('minimal_severity', options.minimumSeverity);