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

Fix enabled query param #343

Merged
merged 1 commit into from
Apr 3, 2020
Merged

Fix enabled query param #343

merged 1 commit into from
Apr 3, 2020

Conversation

zhouzhuojie
Copy link
Collaborator

Description

Fix #342

Motivation and Context

How Has This Been Tested?

Tested locally.

  • /api/v1/flags returns all
  • /api/v1/flags?enabled=true returns enabled ones
  • /api/v1/flags?enabled=false returns disabled ones

I think the boolean parameter binding from go-swagger also allows ?enabled=t or ?enabled=f.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@@ -75,7 +75,7 @@ func (c *crud) FindFlags(params flag.FindFlagsParams) middleware.Responder {
q := entity.Flag{}

if params.Enabled != nil {
q.Enabled = *params.Enabled
tx = tx.Where("enabled = ?", *params.Enabled)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@zhouzhuojie zhouzhuojie merged commit a3b7a52 into master Apr 3, 2020
@zhouzhuojie zhouzhuojie deleted the zz/fix-enabled-query-param branch April 3, 2020 21:00
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.

Find Flags enabled=false returning Enabled Flags
2 participants