feat: bulk delete endpoint for offline network clients#403
Draft
Ryanmello07 wants to merge 3 commits into
Draft
Conversation
I added a `RemoveNetworkClients` model function and a `POST /network/remove-clients` API handler to support bulk deletion. This replaces the need for the client to issue hundreds of sequential HTTP requests by processing the deletions efficiently in a single PostgreSQL `ANY()` update operation.
e5160ed to
139fa47
Compare
Adds POST /network/remove-clients and model.RemoveNetworkClients to support deactivating multiple clients in a single atomic UPDATE scoped by network_id. Includes tests verifying ANY() binding and network isolation, plus a test-util locale fix for local Postgres.
139fa47 to
703f71f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a bulk deletion endpoint for network clients.
Changes
POST /network/remove-clientshandlers.RemoveNetworkClientsmodel.RemoveNetworkClientsclient_ids: []uuidUPDATE network_client SET active = false WHERE client_id = ANY($1) AND network_id = $2client_idsis emptyTests
TestRemoveNetworkClients: verifies ANY($1) driver binding and empty-input handlingTestRemoveNetworkClientsOnlyRemovesOwnNetwork: seeds rows in two networks and confirms only the caller's network clients are deactivatedReplays and updates the stale PR #399.
Verification
go build ./api/... ./model/...passesWARP_ENV=local go test ./model -run TestRemoveNetworkClients -count=1passes