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

refactor(users): Separate signup and signin #2921

Merged
merged 15 commits into from
Dec 4, 2023
Merged

Conversation

ThisIsMani
Copy link
Contributor

@ThisIsMani ThisIsMani commented Nov 20, 2023

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

Separate signup and signin apis.

Additional Changes

  • This PR modifies the API contract
  • This PR modifies the database schema
  • This PR modifies application configuration/environment variables

Motivation and Context

How did you test it?

Postman.

  • Signup - Email should be a non-registered one. (This can't be tested in sandbox)
curl --location 'http://localhost:8080/user/signup' \
--header 'Content-Type: application/json' \
--data-raw '{
    "email": "email",
    "password": "password"
}'

If the request is correct, you will get the following response

{
    "token": "JWT Token",
    "merchant_id": "merchant_id",
    "name": "username",
    "email": "email",
    "verification_days_left": null,
    "user_role": "org_admin"
}
  • Signin - Email should be a registered one.
curl --location 'http://localhost:8080/user/signin' \
--header 'Content-Type: application/json' \
--data-raw '{
    "email": "email",
    "password": "password"
}'

If the request is correct, you will get the following response

{
    "token": "JWT Token",
    "merchant_id": "merchant_id",
    "name": "username",
    "email": "email",
    "verification_days_left": null,
    "user_role": "org_admin"
}
  • Connect Account - Email can be registered or not,
curl --location 'http://localhost:8080/user/connect_account' \
--header 'Content-Type: application/json' \
--data-raw '{
    "email": "email"
}'

If the request is correct, you will get the following response

{
    "is_email_sent": true
}
  • Signup with merchant id - Email should be non-registered,
curl --location 'http://localhost:8080/user/signup_with_merchant_id' \
--header 'Content-Type: application/json' \
--data-raw '{
    "email": "email",
    "password": "password",
    "name": "name",
    "company_name": "Hyperswitch"
}'

If the request is correct, you will get the following response

{
    "is_email_sent": true
}

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code
  • I added unit tests for my changes where possible
  • I added a CHANGELOG entry if applicable

@ThisIsMani ThisIsMani added S-waiting-on-review Status: This PR has been implemented and needs to be reviewed C-refactor Category: Refactor A-users Area: Users labels Nov 20, 2023
@ThisIsMani ThisIsMani added this to the November 2023 Release milestone Nov 20, 2023
@ThisIsMani ThisIsMani self-assigned this Nov 20, 2023
@ThisIsMani ThisIsMani requested review from a team as code owners November 20, 2023 06:35
apoorvdixit88
apoorvdixit88 previously approved these changes Nov 20, 2023
lsampras
lsampras previously approved these changes Nov 20, 2023
Comment on lines +20 to +22
let user_from_db = new_user
.insert_user_and_merchant_in_db(state.clone())
.await?;
Copy link
Contributor

Choose a reason for hiding this comment

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

combine with above

Copy link
Contributor Author

@ThisIsMani ThisIsMani Dec 4, 2023

Choose a reason for hiding this comment

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

This can't be combined because the above function doesn't return UserFromStorage.

@ThisIsMani ThisIsMani dismissed stale reviews from lsampras and apoorvdixit88 via cd43bfe November 20, 2023 13:33
@likhinbopanna likhinbopanna requested review from a team and removed request for a team December 4, 2023 11:20
@likhinbopanna likhinbopanna added this pull request to the merge queue Dec 4, 2023
Merged via the queue into main with commit 80efeb7 Dec 4, 2023
10 of 12 checks passed
@likhinbopanna likhinbopanna deleted the signup-signin branch December 4, 2023 11:47
@SanchithHegde SanchithHegde removed the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-users Area: Users C-refactor Category: Refactor
Projects
No open projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

8 participants