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(users): Incorporate themes in user APIs #6772

Merged
merged 22 commits into from
Dec 16, 2024
Merged

Conversation

ThisIsMani
Copy link
Contributor

@ThisIsMani ThisIsMani commented Dec 6, 2024

Type of Change

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

Description

  • This PR will introduce theme context in user APIs and email related APIs.
    • The User APIs which are affected are
      1. User Info
      2. Invite
      3. Resend Invite
      4. Reset Password
      5. Connect Account
      6. Signup with merchant id
    • Non User flows
      1. Request for Recon
      2. Recon merchant update
      3. API Key expiry reminder

Additional Changes

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

Motivation and Context

Closes #6780

How did you test it?

  1. User Info API will send theme_id in the response if a theme exists in your lineage.
    curl --location 'http://localhost:8080/user' \
    --header 'Cookie: login_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiMzAwMjAwN2UtZWE3NC00NzVlLWJmNWQtMzYxNzIwNTk4YzA3IiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzMzNDkyMzU3Iiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTczMzY2NTMzOSwib3JnX2lkIjoib3JnX3Z5VDVDb3BEdnpPT3g5V211TTdMIiwicHJvZmlsZV9pZCI6InByb180cHE4ZVVFREJDc1YyaDN5Mk9iSSIsInRlbmFudF9pZCI6InB1YmxpYyJ9.YsKkaY8aFDWz_1CLrZEZWNxmO2rSCk-yTe77OmHP_ZE'
    
    {
        "merchant_id": "merchant_1733492357",
        "name": "name",
        "email": "email",
        "verification_days_left": null,
        "role_id": "org_admin",
        "org_id": "org_vyT5CopDvzOOx9WmuM7L",
        "is_two_factor_auth_setup": false,
        "recovery_codes_left": null,
        "profile_id": "pro_4pq8eUEDBCsV2h3y2ObI",
        "entity_type": "organization",
        "theme_id": "7792a4e5-bd7c-498d-8478-c4e0a9a0a984"
    }
  2. All the other user specific APIs mentioned above will have theme_id in the return URL and also accept theme_id in the request.
  3. Other flows will reflect the email themes once the email templates are changed to use the theme data.

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

@ThisIsMani ThisIsMani added C-feature Category: Feature request or enhancement A-users Area: Users labels Dec 6, 2024
@ThisIsMani ThisIsMani self-assigned this Dec 6, 2024
Copy link

semanticdiff-com bot commented Dec 6, 2024

Review changes with  SemanticDiff

Changed Files
File Status
  crates/router/src/routes/user.rs  63% smaller
  crates/api_models/src/user/theme.rs  58% smaller
  crates/diesel_models/src/user/theme.rs  28% smaller
  crates/router/src/configs/settings.rs  27% smaller
  crates/router/src/core/user/dashboard_metadata.rs  24% smaller
  crates/router/src/services/email/types.rs  22% smaller
  crates/router/src/core/user.rs  18% smaller
  crates/router/src/core/recon.rs  9% smaller
  crates/router/src/utils/user/theme.rs  6% smaller
  crates/common_utils/src/types/theme.rs  3% smaller
  crates/diesel_models/src/query/user/theme.rs  1% smaller
  crates/router/src/workflows/api_key_expiry.rs  1% smaller
  config/config.example.toml Unsupported file format
  config/deployments/env_specific.toml Unsupported file format
  config/development.toml Unsupported file format
  config/docker_compose.toml Unsupported file format
  crates/api_models/src/user.rs  0% smaller
  crates/diesel_models/src/schema.rs  0% smaller
  crates/diesel_models/src/schema_v2.rs  0% smaller
  crates/router/src/configs/secrets_transformers.rs  0% smaller
  crates/router/src/core/errors/user.rs  0% smaller
  crates/router/src/core/user/theme.rs  0% smaller
  crates/router/src/db/kafka_store.rs  0% smaller
  crates/router/src/db/user/theme.rs  0% smaller
  crates/router/src/routes/app.rs  0% smaller
  migrations/2024-12-05-131123_add-email-theme-data-in-themes/down.sql Unsupported file format
  migrations/2024-12-05-131123_add-email-theme-data-in-themes/up.sql Unsupported file format

@hyperswitch-bot hyperswitch-bot bot added the M-database-changes Metadata: This PR involves database schema changes label Dec 6, 2024
@ThisIsMani ThisIsMani added the M-configuration-changes Metadata: This PR involves configuration changes label Dec 9, 2024
@ThisIsMani ThisIsMani marked this pull request as ready for review December 9, 2024 10:50
@ThisIsMani ThisIsMani requested review from a team as code owners December 9, 2024 10:50
@@ -545,6 +545,6 @@ pub(crate) async fn fetch_raw_secrets(
.network_tokenization_supported_card_networks,
network_tokenization_service,
network_tokenization_supported_connectors: conf.network_tokenization_supported_connectors,
theme_storage: conf.theme_storage,
theme: conf.theme,
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it a backward compatible change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I kept the old configs as well.

crates/router/src/core/user.rs Outdated Show resolved Hide resolved
apoorvdixit88
apoorvdixit88 previously approved these changes Dec 9, 2024
SanchithHegde
SanchithHegde previously approved these changes Dec 10, 2024
apoorvdixit88
apoorvdixit88 previously approved these changes Dec 10, 2024
jarnura
jarnura previously approved these changes Dec 10, 2024
@likhinbopanna likhinbopanna added this pull request to the merge queue Dec 16, 2024
Merged via the queue into main with commit 4b989fe Dec 16, 2024
17 of 18 checks passed
@likhinbopanna likhinbopanna deleted the theme-user-changes branch December 16, 2024 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-users Area: Users C-feature Category: Feature request or enhancement M-configuration-changes Metadata: This PR involves configuration changes M-database-changes Metadata: This PR involves database schema changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat(users): Introduce themes in user APIs
5 participants