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

PER-9866 [back-end] Endpoint for admins to update environment configu… #139

Merged
merged 1 commit into from
Oct 30, 2024

Conversation

iulianvsp
Copy link
Contributor

…ration

New endpoint to update a feature-flag. There are validations on the globallyEnabled and description fields

Unit and functional tests are covering all scenarios

@iulianvsp iulianvsp force-pushed the PER-9866 branch 2 times, most recently from d11149e to 285d3f2 Compare October 25, 2024 13:03
packages/api/src/feature_flag/service/update.ts Outdated Show resolved Hide resolved
const validation = Joi.object()
.keys({
...fieldsFromAdminAuthentication,
description: Joi.string(),
Copy link
Member

Choose a reason for hiding this comment

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

description should be required here too, per the specification

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, it seemed a bit odd not to be required on creation but required on update. I thought it's a documentation mistake.

Copy link
Member

Choose a reason for hiding this comment

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

Oh, you're actually right, description can't be required because this endpoint needs to be able to set description to NULL by not sending it. Could you correct the error in the documentation so it matches the endpoint?

@@ -283,3 +287,182 @@ describe("POST /feature-flag", () => {
expect(logger.error).toHaveBeenCalled();
});
});

describe("PUT /feature-flag/1bdf2da6-026b-4e8e-9b57-a86b1817be5d", () => {
Copy link
Member

Choose a reason for hiding this comment

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

Nit: the URL param should be given as :featureFlagId here, rather than using a specific value

description: 1,
globallyEnabled: true,
})
.expect(400);
Copy link
Member

Choose a reason for hiding this comment

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

Should the error code here be 404?

Copy link
Member

Choose a reason for hiding this comment

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

(I think the test is passing because it's not actually reaching the 404 error, it's getting a 400 because the ID in the URL params is not a UUID)

@liam-lloyd liam-lloyd self-requested a review October 28, 2024 18:39
Copy link
Member

@liam-lloyd liam-lloyd left a comment

Choose a reason for hiding this comment

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

(I clicked the wrong button, meant to comment rather than approve)

@liam-lloyd liam-lloyd self-requested a review October 28, 2024 18:41
Copy link
Member

@liam-lloyd liam-lloyd left a comment

Choose a reason for hiding this comment

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

(Submitting a "Request changes" to reverse my previous accidental approval)

…ration

New endpoint to update a feature-flag. There are validations on the globallyEnabled and description fields

Unit and functional tests are covering all scenarios
Copy link

codecov bot commented Oct 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.52%. Comparing base (961f791) to head (1d086a1).
Report is 12 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #139      +/-   ##
==========================================
+ Coverage   91.08%   94.52%   +3.43%     
==========================================
  Files          75       81       +6     
  Lines        1358     1497     +139     
  Branches      210      226      +16     
==========================================
+ Hits         1237     1415     +178     
+ Misses        110       75      -35     
+ Partials       11        7       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@iulianvsp iulianvsp merged commit 5ad4afa into main Oct 30, 2024
4 checks passed
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.

2 participants