Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PIMS-1981: Update @typescript-eslint/parser and @typescript-eslint/eslint-plugin from version 7.18.0 to 8.1.0 in express-api #2634

Merged
merged 9 commits into from
Aug 21, 2024
4 changes: 2 additions & 2 deletions express-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@
"@types/nunjucks": "3.2.6",
"@types/supertest": "6.0.2",
"@types/swagger-ui-express": "4.1.6",
"@typescript-eslint/eslint-plugin": "7.18.0",
"@typescript-eslint/parser": "7.18.0",
"@typescript-eslint/eslint-plugin": "8.1.0",
"@typescript-eslint/parser": "8.1.0",
"cross-env": "7.0.3",
"eslint": "8.57.0",
"eslint-config-prettier": "9.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Request, Response } from 'express';
import { DisposalNotificationFilterSchema } from './notificationsSchema';
import { isAdmin, isAuditor } from '@/utilities/authorizationChecks';
import projectServices from '@/services/projects/projectsServices';
import logger from '@/utilities/winstonLogger';

/**
* @description Get all notifications for a specific project.
Expand Down Expand Up @@ -46,6 +47,7 @@ export const getNotificationsByProjectId = async (req: Request, res: Response) =

return res.status(200).send(notificationsResult);
} catch (error) {
logger.error('Error fetching notifications:', error);
return res.status(500).send({ message: 'Error fetching notifications' });
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const DisposalNotificationFilterSchema = z.object({

export type DisposalNotificationFilter = z.infer<typeof DisposalNotificationFilterSchema>;

const NotificationQueueFilterSchema = z.object({
export const NotificationQueueFilterSchema = z.object({
page: z.number(),
quantity: z.number(),
sort: z.array(z.string()),
Expand Down
4 changes: 3 additions & 1 deletion express-api/src/middleware/keycloak/keycloakOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ export const SSO_OPTIONS: SSOOptions = {
try {
await KeycloakService.syncKeycloakUser(user.preferred_username);
} catch (e) {
logger.warn(`Could not sync roles for user ${user.preferred_username}.`);
logger.warn(
`Could not sync roles for user ${user.preferred_username}. Error: ${(e as Error).message}`,
);
}
}
},
Expand Down
5 changes: 4 additions & 1 deletion express-api/src/services/keycloak/keycloakService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ const getKeycloakRoles = async () => {
// Return the list of roles
return keycloakRoles.data;
} catch (e) {
throw new ErrorWithCode('Something went wrong getting Keycloak roles.');
throw new ErrorWithCode(
`Failed to update user's Keycloak roles. ${(e as IKeycloakErrorResponse).message}`,
500,
);
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,9 @@ const cancelProjectNotifications = async (
).length,
};
} catch (e) {
logger.error(`Error: Something went wrong when trying to cancel project notifications.`);
logger.error(
`Something went wrong when trying to cancel project notifications. Error: ${e.message}`,
);
return {
succeeded: 0,
failed: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ describe('UNIT - SSO Options', () => {
const user = produceSSO();
const { afterUserLogin, afterUserLogout } = SSO_OPTIONS;

beforeEach(() => {
jest.clearAllMocks;
});
beforeEach(() => jest.clearAllMocks());

const loggerSpy = jest.spyOn(logger, 'info');
it('should log when a user logs in', async () => {
Expand Down
Loading