Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat(user): add list org, merchant and profile api #5662

Merged
merged 9 commits into from
Aug 22, 2024
Merged

Conversation

racnan
Copy link
Contributor

@racnan racnan commented Aug 21, 2024

Type of Change

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

Description

New APIs list:

  • orgs for a user.
  • merchant accounts for a user in current organisation.
  • profile id for a user in current merchant account.

Additional Changes

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

Motivation and Context

Need new list apis for dashboard frontend.
This would allow user to see the list of all the orgs, merchant accounts (in select org) & profile ids (in select merchant account).

How did you test it?

List orgs

curl --location 'localhost:8080/user/list/org' \
--header 'Authorization: Bearer <JWT>' \

response example

[
    {
        "org_id": "org_t4ryeBxwt9RKu8jlsTWq",
        "org_name": "Juspay"
    },
     {
        "org_id": "org_t4ryeBxwt9RKu8jlsTWq2",
        "org_name": "Juspay2"
    }
]

List merchants

curl --location 'localhost:8080/user/list/merchant' \
--header 'Authorization: Bearer <JWT>' \

response example

[
    {
        "merchant_id": "juspay",
        "merchant_name": "Juspay"
    },
    {
        "merchant_id": "merchant_1724247367",
        "merchant_name": "Juspay"
    }
]

List profile

curl --location 'localhost:8080/user/list/profile' \
--header 'Authorization: Bearer <JWT>' \

response example

[
    {
        "profile_id": "pro_S2E1iXeSzluIrIqH7DNi",
        "profile_name": "default"
    },
    {
        "profile_id": "pro_S2E1iXeSzluIrIqH7DNi2",
        "profile_name": "profile2"
    }
]

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

@racnan racnan added C-feature Category: Feature request or enhancement S-waiting-on-review Status: This PR has been implemented and needs to be reviewed A-users Area: Users labels Aug 21, 2024
@racnan racnan self-assigned this Aug 21, 2024
@racnan racnan requested review from a team as code owners August 21, 2024 19:18
Copy link

semanticdiff-com bot commented Aug 21, 2024

Review changes with SemanticDiff.

Analyzed 9 of 9 files.

Overall, the semantic diff is 2% smaller than the GitHub diff.

Filename Status
✔️ crates/router_env/src/logger/types.rs Analyzed
✔️ crates/router/src/routes/app.rs Analyzed
✔️ crates/router/src/routes/lock_utils.rs Analyzed
✔️ crates/router/src/routes/user.rs Analyzed
✔️ crates/router/src/db/kafka_store.rs Analyzed
✔️ crates/router/src/db/user_role.rs Analyzed
✔️ crates/router/src/core/user.rs 0.21% smaller
✔️ crates/diesel_models/src/query/user_role.rs 9.38% smaller
✔️ crates/api_models/src/user.rs Analyzed

@racnan racnan linked an issue Aug 21, 2024 that may be closed by this pull request
@racnan racnan changed the title List user roles feat(user): add list org, merchant and profile api Aug 21, 2024
jarnura
jarnura previously approved these changes Aug 22, 2024
apoorvdixit88
apoorvdixit88 previously approved these changes Aug 22, 2024
Copy link
Contributor

@apoorvdixit88 apoorvdixit88 left a comment

Choose a reason for hiding this comment

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

LGTM ⭐

@racnan racnan dismissed stale reviews from apoorvdixit88 and jarnura via 9c2d8c8 August 22, 2024 07:48
@likhinbopanna likhinbopanna removed the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label Aug 22, 2024
@likhinbopanna likhinbopanna added this pull request to the merge queue Aug 22, 2024
Merged via the queue into main with commit 98cbf2e Aug 22, 2024
14 checks passed
@likhinbopanna likhinbopanna deleted the list-user-roles branch August 22, 2024 09:29
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-users Area: Users C-feature Category: Feature request or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat(user): list apis
4 participants