Skip to content

System user #837

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

Merged
merged 3 commits into from
Feb 17, 2025
Merged

System user #837

merged 3 commits into from
Feb 17, 2025

Conversation

rowanseymour
Copy link
Member

No description provided.

// gets the system user to use for contact audit fields
func getSystemUserID(ctx context.Context, db *sqlx.DB) (UserID, error) {
var id UserID
err := db.GetContext(ctx, &id, "SELECT id FROM users_user WHERE username = 'system'")
Copy link
Contributor

Choose a reason for hiding this comment

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

we need to filter the is_system field too not just the username?

Copy link
Member Author

Choose a reason for hiding this comment

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

username is unique (globally) so there's only ever going to be one user with that username

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok

Copy link
Contributor

@norkans7 norkans7 left a comment

Choose a reason for hiding this comment

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

use User.is_system field to get the system user ID

Copy link

codecov bot commented Feb 17, 2025

Codecov Report

Attention: Patch coverage is 57.14286% with 6 lines in your changes missing coverage. Please review.

Project coverage is 74.73%. Comparing base (f36604f) to head (be1aa5f).

Files with missing lines Patch % Lines
backends/rapidpro/backend.go 40.00% 2 Missing and 1 partial ⚠️
backends/rapidpro/user.go 57.14% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #837      +/-   ##
==========================================
- Coverage   74.75%   74.73%   -0.03%     
==========================================
  Files         112      113       +1     
  Lines       13282    13295      +13     
==========================================
+ Hits         9929     9936       +7     
- Misses       2640     2644       +4     
- Partials      713      715       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rowanseymour rowanseymour merged commit b45ae30 into main Feb 17, 2025
5 of 7 checks passed
@rowanseymour rowanseymour deleted the system_user branch February 17, 2025 16:55
@github-actions github-actions bot locked and limited conversation to collaborators Feb 17, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants