Skip to content
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 user update endpoint #1011

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Add user update endpoint #1011

wants to merge 9 commits into from

Conversation

cikzh
Copy link
Contributor

@cikzh cikzh commented Feb 10, 2025

Closes #873

Adds endpoint to update a user. Also adds the needs_password_change flag and sets it to true when the user is newly created, or when a temporary password is set. The handling of the flag is out of scope for this PR.

Best merged after #1018, so it generates the correct TS type

Copy link

codecov bot commented Feb 10, 2025

Codecov Report

Attention: Patch coverage is 88.09524% with 10 lines in your changes missing coverage. Please review.

Project coverage is 89.72%. Comparing base (5575746) to head (4ed153c).
Report is 2 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
backend/src/authentication/user.rs 81.81% 9 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1011      +/-   ##
==========================================
- Coverage   89.77%   89.72%   -0.05%     
==========================================
  Files         248      248              
  Lines       12995    13078      +83     
  Branches     1318     1320       +2     
==========================================
+ Hits        11666    11734      +68     
- Misses       1235     1249      +14     
- Partials       94       95       +1     

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

Copy link

github-actions bot commented Feb 10, 2025

Sigrid maintainability feedback

✅ You wrote maintainable code and achieved your objective of 3.5 stars

Show details

Sigrid compared your code against the baseline of 2025-02-11.

👍 What went well?

You fixed or improved 0 refactoring candidates.

👎 What could be better?

Unfortunately, 12 refactoring candidates were introduced or got worse.

Risk System property Location
🔴 Duplication
(Introduced)
backend/src/authentication/user.rs (lines 263-275)
backend/src/authentication/user.rs (lines 288-300)
🔴 Duplication
(Introduced)
backend/src/authentication/user.rs (lines 160-170)
backend/src/authentication/user.rs (lines 201-211)
🔴 Duplication
(Introduced)
backend/src/authentication/user.rs (lines 161-169)
backend/src/authentication/user.rs (lines 202-210)
backend/src/authentication/user.rs (lines 315-323)
🔴 Unit Size
(Worsened)
backend/src/lib.rs
router(SqlitePool)
🟠 Unit Interfacing
(Introduced)
backend/src/authentication/api.rs
user_update(any,any,any,any,any,any)
🟡 Unit Size
(Worsened)
backend/src/authentication/user.rs
Users.get_by_username(str)
🟡 Unit Size
(Introduced)
backend/src/authentication/user.rs
Users.update(u32,Option,Option)
🟡 Unit Size
(Worsened)
backend/src/authentication/user.rs
Users.get_by_id(u32)
⚫️ + 4 more

📚 Remaining technical debt

3 refactoring candidates didn't get better or worse, but are still present in the code you touched.

View this system in Sigrid** to explore your technical debt

⭐️ Sigrid ratings

System property System on 2025-02-11 Before changes New/changed code
Volume 5.2 N/A N/A
Duplication 4.3 4.0 3.6
Unit Size 2.4 2.1 2.2
Unit Complexity 3.4 5.5 5.5
Unit Interfacing 3.0 1.9 1.4
Module Coupling 4.0 5.5 5.5
Component Independence 2.8 N/A N/A
Component Entanglement 3.7 N/A N/A
Maintainability 3.6 4.2 4.1

💬 Did you find this feedback helpful?

We would like to know your thoughts to make Sigrid better.
Your username will remain confidential throughout the process.


View this system in Sigrid

@cikzh cikzh marked this pull request as ready for review February 11, 2025 15:53
@cikzh cikzh requested a review from a team as a code owner February 11, 2025 15:53
@cikzh cikzh added the backend Issues or pull requests that relate to the backend label Feb 11, 2025
@cikzh cikzh requested review from Lionqueen94 and oliver3 February 11, 2025 15:53
Copy link
Contributor

@lkleuver lkleuver left a comment

Choose a reason for hiding this comment

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

soft approval

fullname TEXT ,
role TEXT NOT NULL,
password_hash TEXT NOT NULL,
needs_password_change BOOLEAN NOT NULL DEFAULT TRUE,
Copy link
Contributor

Choose a reason for hiding this comment

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

needs_password_change could be a DATETIME?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What would be the reason for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Issues or pull requests that relate to the backend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update user in backend
2 participants