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

Simplifying gateways' return values #7863

Merged
merged 10 commits into from
Nov 26, 2024
Merged

Simplifying gateways' return values #7863

merged 10 commits into from
Nov 26, 2024

Conversation

noah-brunate
Copy link
Collaborator

Simplified the return values for the gateways' resolver functions.

Copy link

Oops! Looks like you forgot to update the changelog. When updating CHANGELOG.md, please consider the following:

  • Changelog is read by country implementors who might not always be familiar with all technical details of OpenCRVS. Keep language high-level, user friendly and avoid technical references to internals.
  • Answer "What's new?", "Why was the change made?" and "Why should I care?" for each change.
  • If it's a breaking change, include a migration guide answering "What do I need to do to upgrade?".

@ocrvs-bot
Copy link
Collaborator

Your environment is deployed to https://ocrvs-2520.opencrvs.dev

@@ -637,7 +596,7 @@ export const resolvers: GQLResolver = {
return taskEntry.resource.id
},
async confirmRegistration(_, { id }, { headers: authHeader }) {
if (!inScope(authHeader, ['record.confirm-registration'])) {
if (!inScope(authHeader, ['record.confirm-registration'] as unknown as Scope[])) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

@noah-brunate

confirmRegistration: 'record.confirm-registration'
The scope should actually be there so no casting as unknown as Scope[] should be needed

@@ -16,7 +16,7 @@ export const AVATAR_API =

export const NATIVE_LANGUAGE = (() => {
const languages = env.LANGUAGES.split(',')
return languages.find((language) => language !== 'en')
return languages.find((language: string) => language !== 'en')
Copy link
Collaborator

Choose a reason for hiding this comment

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

image
This is an unnecessary assertion: the compiler seems to already know it's a string.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

the parameter "language" was being implicitly given an any type which was causing an error when i ran the tests

Copy link
Collaborator

@naftis naftis left a comment

Choose a reason for hiding this comment

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

Good stuff simplifying the endpoints. Small comments to assess

@rikukissa
Copy link
Member

rikukissa commented Nov 21, 2024

@noah-brunate tests seem to be failing to unused variable but otherwise this looks like it's ready to go 👍 Great work

)
}
return true
Copy link
Collaborator

Choose a reason for hiding this comment

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

@noah-brunate removing this line here might break things as people could be expecting a boolean return value from the API.
This change is also the reason why you had to change the expectations in the test file. Let's bring this back please

@Zangetsu101 Zangetsu101 linked an issue Nov 26, 2024 that may be closed by this pull request
@Zangetsu101 Zangetsu101 disabled auto-merge November 26, 2024 09:24
@Zangetsu101 Zangetsu101 merged commit 0e8f301 into develop Nov 26, 2024
31 of 32 checks passed
@Zangetsu101 Zangetsu101 deleted the ocrvs-2520 branch November 26, 2024 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Simplify gateway's return values
5 participants