-
Notifications
You must be signed in to change notification settings - Fork 73
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
Upgrade Apollo server to v4 #8036
Conversation
Oops! Looks like you forgot to update the changelog. When updating CHANGELOG.md, please consider the following:
|
d193747
to
1ce14c8
Compare
} | ||
|
||
getPatient(id: string) { | ||
const inBundle = getResourceFromBundleById(this.context.record, id) | ||
const inBundle = getResourceFromBundleById(this.context.record!, id) |
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.
if we are trying to get the resource, then shouldn't it be findResource...
?
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 don't think this is even used anywhere 😄 This would throw an error if there isn't a patient which to me seems logical given the method is named getPatient
. So will give you a patient with you know their id or else throw an error
class RateLimitError extends GraphQLError { | ||
constructor(message = 'You are being rate limited') { | ||
super(message, { | ||
extensions: { | ||
code: 'DAILY_QUOTA_EXCEEDED', | ||
http: { | ||
status: 429 | ||
} | ||
} | ||
}) |
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.
nice! This should make the graphql requests actually fail by responding with something other than 200 right?
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 there is potential for that but I need to test how it works 👍
getUser: async (_, { userId }, { dataSources }) => { | ||
const user = await dataSources.usersAPI.getUserById(userId!) | ||
return user | ||
}, |
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.
Are we intentionally removing the rate limit from this endpoint?
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.
No, good catch! I removed it while debugging something
@@ -39,11 +34,11 @@ export class UsersAPI extends RESTDataSource { | |||
} | |||
|
|||
try { | |||
const response = this.post('getUser', { email }) | |||
const response = await this.post('getUser', { body: { 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.
You probably don't want to await
here as that would just break the caching functionality. We want to cache the Promise in this case and not the Resolved value so that when multiple requests are made, we can just return the cached Promise that we created on the first request
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.
Same goes for the other requests in this file
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.
Cool yea, I was wondering about that.. Makes sense!
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.
Looks good! Comments are mostly stylistic, check the code suggestion whether it is needed at least.
this.baseURL = `${FHIR_URL}/DocumentReference` | ||
} | ||
const fhirPath = parse(FHIR_URL).path || '' | ||
export default class DocumentsAPI extends OpenCRVSRestDataSource { |
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.
Since we capitalise CRVS, API and others, maybe rest could be also capitalised.
} | ||
|
||
getPatient(id: string) { | ||
const inBundle = getResourceFromBundleById(this.context.record, id) | ||
const inBundle = getResourceFromBundleById(this.context.record!, id) |
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.
could assertion be managed by types?
Your environment is deployed to https://upgrade-apollo-to-4.opencrvs.dev |
0ddb03a
to
70e82f2
Compare
5b4417a
to
9c8b4b3
Compare
…re into upgrade-apollo-to-4
Our previous version had lost support. I also want to upgrade so that we can use API federation for new events APIs :)