forked from wrenn/wrenn
Fix API key cleanup on user deactivation and build archive race condition
Delete all API keys created by a user when their account is disabled, deleted, or soft-deleted. Store build archives before enqueuing to Redis so workers never dequeue a build with missing files.
This commit is contained in:
@ -25,6 +25,15 @@ func (q *Queries) DeleteAPIKey(ctx context.Context, arg DeleteAPIKeyParams) erro
|
||||
return err
|
||||
}
|
||||
|
||||
const deleteAPIKeysByCreator = `-- name: DeleteAPIKeysByCreator :exec
|
||||
DELETE FROM team_api_keys WHERE created_by = $1
|
||||
`
|
||||
|
||||
func (q *Queries) DeleteAPIKeysByCreator(ctx context.Context, createdBy pgtype.UUID) error {
|
||||
_, err := q.db.Exec(ctx, deleteAPIKeysByCreator, createdBy)
|
||||
return err
|
||||
}
|
||||
|
||||
const deleteAPIKeysByTeam = `-- name: DeleteAPIKeysByTeam :exec
|
||||
DELETE FROM team_api_keys WHERE team_id = $1
|
||||
`
|
||||
|
||||
Reference in New Issue
Block a user