Skip to content

Conversation

@prakash100198
Copy link
Contributor

@prakash100198 prakash100198 commented Jan 2, 2026

…revent duplicates.

Description

When using API-Token while hitting any devtron api, internally we were saving each entry in user_audit table but this pr fixes that if for a user id an entry is already there it should only update and not insert everytime an api is hit
Fixes https://github.com/devtron-labs/sprint-tasks/issues/2765

Checklist:

  • The title of the PR states what changed and the related issues number (used for the release note).
  • Does this PR requires documentation updates?
  • I've updated documentation as required by this PR.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have tested it for all user roles.
  • I have added all the required unit/api test cases.

Does this PR introduce a user-facing change?


Summary by Bito

  • This pull request modifies the user audit functionality by changing the method used to handle user audit entries, now updating existing entries instead of saving new ones.
  • This change prevents the user_audit table from being filled with duplicates for API token users, enhancing the efficiency and integrity of the user audit records.
  • Overall, this update touches the user audit functionality and modifies how entries are handled, improving data integrity.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 2, 2026

@prakash100198 prakash100198 merged commit 17c5b99 into main Jan 2, 2026
14 checks passed
@prakash100198 prakash100198 deleted the update-user-audit-for-api-token branch January 2, 2026 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants