-
Notifications
You must be signed in to change notification settings - Fork 7
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
Conversation
const countries = await this.entityConnection.fetchCountries(); | ||
const { accessPolicy } = await this.req.session; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This await
was unneeded
8ee43ef
to
ea2e6b7
Compare
There was a problem hiding this 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); |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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 👍
0a66c04
to
a4a40a4
Compare
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 ofpsss-server
I left the<Service>Connection
classes, since they provided a nice abstraction on top of the base service.