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

Replace organization query with whoami query #6109

Merged
merged 10 commits into from
Jul 11, 2023

Conversation

BobanL
Copy link
Contributor

@BobanL BobanL commented Jul 10, 2023

BACKEND PULL REQUEST

Related Issue

Changes Proposed

  • Replace deprecated organization query with whoami
  • Moved graphql query and mutation into operations.graphql

Additional Information

  • The next PR will change the functionality of the organization query to make it fetch by id rather than user context

Testing

  • Test Manage Facility and Manage Organization for regression

phone
email
deviceTypes {
whoami {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The organization is now nested in whoami, no fields were actually changed.

@BobanL BobanL temporarily deployed to Dev3 July 10, 2023 21:48 — with GitHub Actions Inactive
@BobanL BobanL marked this pull request as ready for review July 11, 2023 12:17
@@ -150,3 +150,8 @@ type OrganizationType =
| "camp"
| "lab"
| "other";

Copy link
Contributor

Choose a reason for hiding this comment

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

Could we move this type declaration out of the global import and put it in a named .ts file? The Typescript team discourages this pattern since there might be compilation issues without a corresponding JS file.

Copy link
Contributor

Choose a reason for hiding this comment

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

I didn't know that the d.ts use was discouraged in typescript because the context of the type can be messed up. Sounds like these files are more like a result of typescript being compile into JS.

Copy link
Contributor

@fzhao99 fzhao99 Jul 11, 2023

Choose a reason for hiding this comment

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

Yeah so based on the reading I did, the .d.ts files are there for libraries where typescript and javascript files are sitting side by side. In cases where JS files are necessary, adding the .d.ts files allows you to still have access to the relevant types while not requiring those files to be typescript files.

Based on what I found this pattern isn't as big an issue for applications since the main antipattern is global access when libraries are imported (which would make those variables available at the global namespace even outside the library) but I think it's still worth it to make it explicit where these new types are coming from just so there isn't any confusion / to avoid possible namespace collision issues.

Copy link
Contributor

@fzhao99 fzhao99 left a comment

Choose a reason for hiding this comment

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

lgtm overall! left one suggestion

Copy link
Contributor

@johanna-skylight johanna-skylight left a comment

Choose a reason for hiding this comment

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

Tested in dev and worked as expected. I just left two comments. Thanks! 💯

frontend/src/app/Settings/ManageOrganization.tsx Outdated Show resolved Hide resolved
frontend/src/app/Settings/ManageOrganizationContainer.tsx Outdated Show resolved Hide resolved
@@ -150,3 +150,8 @@ type OrganizationType =
| "camp"
| "lab"
| "other";

Copy link
Contributor

Choose a reason for hiding this comment

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

I didn't know that the d.ts use was discouraged in typescript because the context of the type can be messed up. Sounds like these files are more like a result of typescript being compile into JS.

@sonarcloud
Copy link

sonarcloud bot commented Jul 11, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@BobanL BobanL temporarily deployed to Dev3 July 11, 2023 16:06 — with GitHub Actions Inactive
Copy link
Contributor

@johanna-skylight johanna-skylight left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@fzhao99 fzhao99 left a comment

Choose a reason for hiding this comment

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

lgtm! thanks for switching the file type around :)

Copy link
Collaborator

@emyl3 emyl3 left a comment

Choose a reason for hiding this comment

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

changes on dev3 looked good!

@BobanL BobanL merged commit 502e23c into main Jul 11, 2023
@BobanL BobanL deleted the boban/6061-remove-deprecated-organization-query branch July 11, 2023 16:47
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.

4 participants