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

add override #331

Merged
merged 11 commits into from
Jun 26, 2024
Merged

add override #331

merged 11 commits into from
Jun 26, 2024

Conversation

k3llymariee
Copy link
Contributor

@k3llymariee k3llymariee commented Jun 25, 2024

image

panic("implement me")
store := model.StoreFromContext(ctx)
err := store.DeleteOverride(ctx, request.ProjectKey, request.FlagKey)
return DeleteDevProjectsProjectKeyOverridesFlagKey200JSONResponse{}, err
Copy link
Contributor Author

Choose a reason for hiding this comment

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

not filling out this response body - it'll just default to false/null anyway which feels ok?

Copy link

Choose a reason for hiding this comment

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

Maybe a 204 would be better if you're expecting an empty response?

Copy link
Contributor

Choose a reason for hiding this comment

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

We should either 204 or keep it 200 & return like {Override: false, Value:...}.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated to 204

@@ -162,13 +162,13 @@ func NewAddProjectCmd(client dev_server.LocalClient) *cobra.Command {
//}

type postBody struct {
sourceEnvironmentKey string
SourceEnvironmentKey string `json:"sourceEnvironmentKey"`
Copy link
Contributor Author

Choose a reason for hiding this comment

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

smol fix

@k3llymariee k3llymariee requested a review from ld-kyee June 25, 2024 23:17
@@ -2,3 +2,4 @@
dist/
*.log
node_modules/
devserver.db
Copy link
Contributor

Choose a reason for hiding this comment

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

🙌🏻


func (s Sqlite) DeleteOverride(ctx context.Context, projectKey, flagKey string) error {
_, err := s.database.Exec(`
UPDATE overrides set active = false where project_key = ? and flag_key = ?
Copy link
Contributor

Choose a reason for hiding this comment

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

This should also increment the version. This is needed so that the sdk will pick up the change (it ignores changes if the version number isn't bigger).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh duh my b!

Copy link

@ld-kyee ld-kyee left a comment

Choose a reason for hiding this comment

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

When upserting we probably want to check the flag exists in the flagState for the project if not there will just be bogus entries if someone mistypes a flag name.

Also a bonus would be to make sure the types of the flag values match but I know that's kinda a lot of work so maybe this can be done if we have time.

I'm not clear on how we are going to override values for boolean flags. I tried setting the body to { "enable-deployment-link": "false"} but it stored this entire thing in the value column which I don't think we want. That said, I'm sure this is just me not understanding what the api expects.

This seems fine enough to merge for now and build off of if you'd rather add the validation check in a separate pr.

@k3llymariee k3llymariee marked this pull request as ready for review June 26, 2024 00:22
@k3llymariee k3llymariee merged commit c06f381 into moonshot-ld-dev-server Jun 26, 2024
1 check failed
@k3llymariee k3llymariee deleted the moonshot-dev-server-routes branch June 26, 2024 00:22
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.

None yet

3 participants