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

Added Organization commands #11

Merged
merged 4 commits into from May 18, 2021
Merged

Added Organization commands #11

merged 4 commits into from May 18, 2021

Conversation

EricStG
Copy link
Collaborator

@EricStG EricStG commented May 15, 2021

Added commands for organization management

Closes #7

Also:
- Created an utility function to do null checks
- Stubbed the future organization functions
package utils

// CoalesceString returns empty string on null, otherwise returns the value
func CoalesceString(value *string) 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.

I added this little func to help me avoid splattering the code with if/else. Let me know what you think

Copy link
Member

Choose a reason for hiding this comment

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

It's fine

Copy link
Member

@alvintangz alvintangz left a comment

Choose a reason for hiding this comment

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

It's easy as you say it is. Haven't tested it but looks good.

At this pace, I'm wondering if you can spend some time thinking about how to optimize the code instead. Maybe create a function for each CRUD operation take takes in the client func, response type, body (if applicable), etc... because there's a lot of copying and pasting going around here. Maybe take a closer look at api/client.gen.go as it has more functions that take in more abstract things.

cmd/organization.go Show resolved Hide resolved
internal/cmdrun/organization/list/list.go Outdated Show resolved Hide resolved
package utils

// CoalesceString returns empty string on null, otherwise returns the value
func CoalesceString(value *string) string {
Copy link
Member

Choose a reason for hiding this comment

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

It's fine

@EricStG
Copy link
Collaborator Author

EricStG commented May 15, 2021

I can look at reducing boilerplate code, but all I can think off right now isn't supported in golang 😭
I'll see what I can come up with

Also generated the doc and fixed some typos
@EricStG EricStG marked this pull request as ready for review May 17, 2021 20:48
@EricStG EricStG changed the title Added Organization get and list Added Organization commands May 17, 2021
Copy link
Member

@alvintangz alvintangz 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! Cheers! 🍻

@alvintangz alvintangz merged commit 8579cac into Vaccine-Hunters-Canada:main May 18, 2021
@EricStG EricStG deleted the organization branch May 19, 2021 02:08
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.

Commands: Organization
2 participants