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

refactor: Converted lesmis-server and psss-server to using the @tupaia/api-client #5681

Merged
merged 3 commits into from
May 28, 2024

Conversation

rohan-bes
Copy link
Collaborator

Have been meaning to do this refactor for a long time, finally getting around to it since it blocks fixing RN-1321

Involves removing the deprecated ApiConnection classes, and relying on pulling the @tupaia/api-client instead. In the case of psss-server I left the <Service>Connection classes, since they provided a nice abstraction on top of the base service.

const countries = await this.entityConnection.fetchCountries();
const { accessPolicy } = await this.req.session;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This await was unneeded

@rohan-bes rohan-bes force-pushed the refactor-lesmis-psss-api-client branch from 8ee43ef to ea2e6b7 Compare May 27, 2024 21:35
Copy link
Contributor

@alexd-bes alexd-bes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So much nicer, thanks!

const { session } = this.req;
const { entity: entityApi, central: centralApi, report: reportApi } = this.req.ctx.services;
this.entityConnection = new EntityConnection(entityApi);
this.centralConnection = new CentralConnection(centralApi, session.email);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a stupid question, but just making sure if there is no session found this won't throw an error trying to access email from undefined?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should always be defined in this case, since PSSS doesn't support public users, but I'll make it session?.email just in case 👍

@rohan-bes rohan-bes force-pushed the refactor-lesmis-psss-api-client branch from 0a66c04 to a4a40a4 Compare May 28, 2024 01:10
@rohan-bes rohan-bes merged commit 35b1d6c into dev May 28, 2024
44 checks passed
@rohan-bes rohan-bes deleted the refactor-lesmis-psss-api-client branch May 28, 2024 01:18
@rohan-bes rohan-bes mentioned this pull request May 28, 2024
@alexd-bes alexd-bes mentioned this pull request Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants