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

feat(#17): register_user, Storage redesigned to struct #61

Merged
merged 10 commits into from
Jul 11, 2024
Merged

Conversation

h1alexbel
Copy link
Owner

@h1alexbel h1alexbel commented Jul 10, 2024

@l3r8yJ take a look, please

closes #17


PR-Codex overview

Focus: Add user registration functionality and improve XML storage handling.

Detailed summary

  • Added register_user module for user registration.
  • Improved XML storage initialization and handling.
  • Updated dependencies and added hamcrest.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Copy link

codecov bot commented Jul 10, 2024

Codecov Report

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

Project coverage is 52.17%. Comparing base (57dfdf2) to head (77b8765).
Report is 11 commits behind head on master.

Files Patch % Lines
server/src/xml/storage.rs 66.66% 4 Missing ⚠️
server/src/objects/user.rs 50.00% 1 Missing ⚠️
server/src/routes/register_user.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #61      +/-   ##
==========================================
- Coverage   58.82%   52.17%   -6.65%     
==========================================
  Files           5        7       +2     
  Lines          17       23       +6     
==========================================
+ Hits           10       12       +2     
- Misses          7       11       +4     

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

@h1alexbel h1alexbel requested a review from l3r8yJ July 10, 2024 16:31
Copy link
Collaborator

@l3r8yJ l3r8yJ left a comment

Choose a reason for hiding this comment

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

@h1alexbel take a look at my comments below, please

fn returns_username() -> Result<()> {
let expected = "jeff";
let jeff = User::new(String::from(expected));
assert_eq!(
Copy link
Collaborator

Choose a reason for hiding this comment

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

@h1alexbel might be we should add hamcrest to project?

Copy link
Owner Author

Choose a reason for hiding this comment

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

@l3r8yJ good idea. Let's try it

Comment on lines 45 to 47
"<root>\
<github><users/></github>\
</root>"
Copy link
Collaborator

Choose a reason for hiding this comment

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

@h1alexbel i think we can move it to some constant

@h1alexbel h1alexbel requested a review from l3r8yJ July 11, 2024 07:19
@h1alexbel
Copy link
Owner Author

@l3r8yJ take a look again, please

Copy link
Collaborator

@l3r8yJ l3r8yJ left a comment

Choose a reason for hiding this comment

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

@h1alexbel take a look, please

Comment on lines +37 to +39
#[allow(unused_imports)]
#[macro_use]
extern crate hamcrest;
Copy link
Collaborator

Choose a reason for hiding this comment

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

better to move it to mod tests

Copy link
Owner Author

Choose a reason for hiding this comment

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

@l3r8yJ for some reason I can't move it to the tests, it's only allowed in lib.rs or main.rs

impl User {
pub async fn save(self) -> Result<()> {
info!("registering user @{}", self.username);
let xml = to_string(&self).unwrap();
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's avoid such #unwrap calls, can you set clippy or create puzzle for it?

Copy link
Owner Author

Choose a reason for hiding this comment

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

@l3r8yJ I will create one

pub(crate) path: String,
}

const INIT_XML: &str = "<root>\
Copy link
Collaborator

Choose a reason for hiding this comment

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

better to use multiline string

@h1alexbel
Copy link
Owner Author

@l3r8yJ updated

@h1alexbel h1alexbel requested a review from l3r8yJ July 11, 2024 08:40
Copy link
Collaborator

@l3r8yJ l3r8yJ left a comment

Choose a reason for hiding this comment

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

@h1alexbel looks good to me!

@h1alexbel h1alexbel merged commit 31636e6 into master Jul 11, 2024
13 of 15 checks passed
@h1alexbel h1alexbel deleted the 17 branch July 11, 2024 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

internal endpoint for user account creation
2 participants