fix: use camelCase for createdAfter in the Notifications URL
Instead of the former created_after. Signed-off-by: Marek Libra <marek.libra@gmail.com>
This commit is contained in:
@@ -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
|
||||
@@ -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');
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}),
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user