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

Event API integration complete #145

Merged
merged 8 commits into from
Sep 5, 2020
Merged

Event API integration complete #145

merged 8 commits into from
Sep 5, 2020

Conversation

thai-truong
Copy link
Collaborator

Still event edit page left, probably the trickiest one of them all.
Other than that not sure if there is anything else that uses event
services (if there are then we can refactor with the new event api
functions).

Just set up the user api functions file, have not done any integration
for user api.

Still event edit page left, probably the trickiest one of them all.
Other than that not sure if there is anything else that uses event
services (if there are then we can refactor with the new event api
functions).

Just set up the user api functions file, have not done any integration
for user api.
@thai-truong thai-truong added enhancement New feature or request feature Build in something new labels Sep 1, 2020
@thai-truong thai-truong requested a review from a team September 1, 2020 17:55
@thai-truong thai-truong self-assigned this Sep 1, 2020
@netlify
Copy link

netlify bot commented Sep 1, 2020

Deploy preview for hkn-ucsd-portal-dev ready!

Built with commit f514af9

https://deploy-preview-145--hkn-ucsd-portal-dev.netlify.app

};

const eventHosts = hosts.map(host => host.id);
const eventType = type || 'Event';
Copy link
Collaborator

Choose a reason for hiding this comment

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

probably better here to just type || null then handle null in tags

display: 'flex',
flexDirection: 'column',
alignItems: 'center',
width: '536px',
Copy link
Collaborator

Choose a reason for hiding this comment

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

uh oh

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll see what I can do with that. For now I'll worry about all the logic and functionality stuff first, then I'll move on to making it look relatively nicer once I'm done with that

@netlify
Copy link

netlify bot commented Sep 1, 2020

Deploy preview for hknucsd-portal-dev ready!

Built with commit 6567769

https://deploy-preview-145--hknucsd-portal-dev.netlify.app

@godwinpang
Copy link
Collaborator

godwinpang commented Sep 1, 2020 via email

@@ -48,7 +49,7 @@
"build": "react-app-rewired build",
"test": "react-app-rewired test --passWithNoTests",
"cypress": "npx cypress run",
"lint": "eslint --fix './src/**/*.{js,ts,tsx}'",
"lint": "eslint --fix ./src/**/*.{js,ts,tsx}",
Copy link
Collaborator

Choose a reason for hiding this comment

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

why'd you remove the '? afaik the glob pattern wasn't working without it

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

npm run lint didn't run for me with the ' on : (

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I had to remove the ' for the command to work

Copy link
Collaborator

Choose a reason for hiding this comment

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

i had to add ' for the command to work -_______________________-

Copy link
Collaborator

Choose a reason for hiding this comment

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

@thaigillespie can you retest this with wsl? ' should work

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah I'll test it again later. ' didn't work in windows but should work in wsl.

Copy link
Collaborator

Choose a reason for hiding this comment

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

sounds good - thanks!

Copy link
Collaborator

@godwinpang godwinpang left a comment

Choose a reason for hiding this comment

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

looks great! just some small things

return userApi.userControllerGetMultipleUsers(queryParams);
}

export function processMultipleUsers(
Copy link
Collaborator

Choose a reason for hiding this comment

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

not sure what this function does, could you explain why we need this? maybe I'm just not following the code

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Honestly since getMultipleUsers returns a Promise with a union type, I had to make it so that the returned array is only of one of the two types from the union type, or else I couldn't use .map(). Of course, that was before changes made to what we receive as a response if we wanted to have officer names. I will have to either rewrite this in another PR. As of now, think of it as a function that extracts the users array from the returned response of type MultipleAppUserResponse.

Copy link
Collaborator

Choose a reason for hiding this comment

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

ok - can you call it either getUsernames from response or add a TODO? ideally having an issue would be nice too :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah getUsernames is fine. I'll be making minor fixes/changes to backend tonight as well so this function hopefully will be cleaned up by tonight or tmr.

@@ -0,0 +1,97 @@
import {
Copy link
Collaborator

Choose a reason for hiding this comment

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

thoughts on just calling this a User service or AppUser service? that way naming lines up with backend

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We use user in the frontend but appuser in the backend so I'm not sure if UserService or AppUserService is better...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll change it to UserService (and ApiEvents to EventService) for now

Copy link
Collaborator

Choose a reason for hiding this comment

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

makes sense yeah - naming is hard

const { users } = multipleUserResponse;
const userKeys = Object.keys(users[0]);

if (users.length === 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

i think if users.length == 0 then it'll have crashed on line 46 already

@@ -1,40 +0,0 @@
import React from 'react';
Copy link
Collaborator

Choose a reason for hiding this comment

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

i think there's value in keeping form_chip..._input.js files around for historical purposes - they'd look pretty nice in our storybook as well :) what do you think?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That's fine. I just removed them bc I thought we weren't gonna use them anymore but hey no harm in keeping them. I didn't use them in my integration code but maybe someone else in the future will have a need for it.

COMPLETE: 'complete',
};

export default EVENT_STATUS;
Copy link
Collaborator

Choose a reason for hiding this comment

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

i think for these enums we'd be able to leverage code gen

see this for an example

godwinpang
godwinpang previously approved these changes Sep 5, 2020
@thai-truong thai-truong changed the title Got a lot of event api integration done, but not all (WIP) Event API integration complete Sep 5, 2020
@thai-truong thai-truong merged commit bac6f32 into dev Sep 5, 2020
@godwinpang godwinpang deleted the frontendIntegration branch September 5, 2020 21:45
godwinpang pushed a commit that referenced this pull request Sep 20, 2020
* Got a lot of event api integration done, but not all.

Still event edit page left, probably the trickiest one of them all.
Other than that not sure if there is anything else that uses event
services (if there are then we can refactor with the new event api
functions).

Just set up the user api functions file, have not done any integration
for user api.

* Added autocompletion component

* Finished with integration for event edit page.

* Added changes to address review of PR #145.

* Removed duplicate config to turn off import/prefer-default-export.

* Just for deploy preview.
thai-truong added a commit that referenced this pull request Oct 3, 2020
* Got a lot of event api integration done, but not all.

Still event edit page left, probably the trickiest one of them all.
Other than that not sure if there is anything else that uses event
services (if there are then we can refactor with the new event api
functions).

Just set up the user api functions file, have not done any integration
for user api.

* Added autocompletion component

* Finished with integration for event edit page.

* Added changes to address review of PR #145.

* Removed duplicate config to turn off import/prefer-default-export.

* Just for deploy preview.

Rebase modal_factor's commits onto master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature Build in something new
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Frontend openapi integration to start using backend API w/o fetch API
2 participants