-
Notifications
You must be signed in to change notification settings - Fork 1
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
add override #331
Conversation
k3llymariee
commented
Jun 25, 2024
•
edited
Loading
edited
internal/dev_server/api/server.go
Outdated
panic("implement me") | ||
store := model.StoreFromContext(ctx) | ||
err := store.DeleteOverride(ctx, request.ProjectKey, request.FlagKey) | ||
return DeleteDevProjectsProjectKeyOverridesFlagKey200JSONResponse{}, err |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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:...}
.
There was a problem hiding this comment.
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"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
smol fix
@@ -2,3 +2,4 @@ | |||
dist/ | |||
*.log | |||
node_modules/ | |||
devserver.db |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙌🏻
internal/dev_server/db/sqlite.go
Outdated
|
||
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 = ? |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh duh my b!
There was a problem hiding this 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.