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

Refactoring - Remove unused endpoints and use Apollo Client 2.0 #45

Merged
merged 16 commits into from
Jun 10, 2018

Conversation

kexin-zhang
Copy link
Member

@kexin-zhang kexin-zhang commented Mar 6, 2018

Changes:

  • Switch to using Apollo Client for ALL client side GraphQL queries, including subscriptions. Before, we were using qwest for some of the GraphQL requests and Apollo Client for GraphQL subscriptions, and it was kind of hacky.
  • Use generated types for client side GraphQL responses.
  • Delete unused REST endpoints. Endpoints for getting data and checking attendees in/out have been replaced with GraphQL mutations.
  • Delete the add attendees panel, since all attendees are loaded from GraphQL now. This feature will be implemented later (see Add ability to add attendees seperately #47), but it doesn't make sense to show this in the web app now since we don't actually have functionality for storing attendees that were not in registration's GraphQL response.
  • Added a tsconfig file in the test folder, so that the tests get compiled to JS.
  • Deleted tests that used the deleted REST endpoints. I will write new, updated tests later (see Write tests for graphql queries and mutations #46 )

@hackgbot
Copy link

hackgbot commented Mar 6, 2018

Hey y'all! A deployment of this PR can be found here:
https://checkin2-apollo-client2.pr.hack.gt

@ruyimarone ruyimarone requested review from RSLi and removed request for RSLi March 6, 2018 08:00
@kexin-zhang kexin-zhang changed the title [NOT DONE YET] Refactor checkin to use Apollo Client 2.0 Refactoring - Remove unused endpoints and use Apollo Client 2.0 Mar 7, 2018
Copy link
Member

@petschekr petschekr left a comment

Choose a reason for hiding this comment

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

Finally got around to this. Overall looks 👍

button.disabled = false;
});
}

function attachUserDeleteHandlers () {
Copy link
Member

@petschekr petschekr May 14, 2018

Choose a reason for hiding this comment

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

Why is this admin account deletion functionality being removed?

Copy link
Member Author

Choose a reason for hiding this comment

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

Honestly, I think I just did this by accident while moving things around. Thanks for pointing this out!

// Escape possible HTML in username
if (by === null) {
Copy link
Member

Choose a reason for hiding this comment

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

Any reason to do this instead of an optional argument?

Copy link
Member Author

Choose a reason for hiding this comment

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

I originally did this because the type of checked_in_by in the GraphQL Tag object is string | null. But GraphQL queries should always return a string for checked_in_by (see https://github.com/HackGT/checkin2/blob/master/server/graphql.ts#L129), so I just went ahead and made this a non-null type.


// Get checked question options
let checked: string[] = [];
let checked = [];
Copy link
Member

Choose a reason for hiding this comment

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

This list will be implicitly typed as any if you remove this annotation

@@ -645,44 +515,8 @@ document.getElementById("confirmation-branches-filter")!.addEventListener("chang
loadAttendees();
});

attachUserDeleteHandlers();
Copy link
Member

Choose a reason for hiding this comment

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

See above comment about user management

server/app.ts Outdated
fs.createReadStream(request.file.path).pipe(parser);
});

apiRouter.route("/data/export").get(authenticateWithReject, async (request, response) => {
Copy link
Member

Choose a reason for hiding this comment

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

Is CSV data export something worth keeping around? Related to #48

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, this is a good point. Let's keep CSV export, but I do think we should get around to #48 at some point, since the CSV export exports data in checkin's mongo collection, which is only a subset of all the data that checkin GraphQL can provide.

@kexin-zhang
Copy link
Member Author

@petschekr thanks for taking a look! Made some changes based on your comments.

Copy link
Member

@petschekr petschekr left a comment

Choose a reason for hiding this comment

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

Looks good to me with those changes. This includes a lot of breaking changes so we should increment the version to 2.0.0 when you're ready to merge.

@kexin-zhang kexin-zhang merged commit 8cc6108 into master Jun 10, 2018
@evan10s evan10s deleted the apollo-client2 branch April 6, 2019 00:45
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.

3 participants