Issue:
Bug: Point v2 to v1 dashboard_metadata table



Point v2 to v1 dashboard_metadata table
Move dashboard_metadata into accounts_schema.

Pull request description:
## Type of Change
<!-- Put an `x` in the boxes that apply -->

- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [x] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD

## Description
<!-- Describe your changes in detail -->
This PR moves the dashboard_metadata table to `accounts_schema` and points v2 to the v1 public schema -  dashboard_metadata table.



### Additional Changes

- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables

<!--
Provide links to the files with corresponding changes.

Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->


## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.

If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
To store all the data regarding dashboard_metadata in a common table irrespective of v1 and v2.

## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Tested by deploying this branch on v2 integ-router and hitting the following 2 API's. The entries from the POST API populated the integ v1 public schema - dashboard metadata table.

<img width="1728" alt="image" src="https://github.com/user-attachments/assets/2b73d3ff-2055-438c-a7d6-f1d865b57403" />
The highlighted entry in the v1 public schema dashboard_metadata table is the entry populated by hitting the v2 API, given by the curl below.

Hit the following curl:
- The entry for ProdIntent should be created in v1 public schema - dashboard_metadata table.

```bash
curl --location 'http://localhost:8080/v2/user/data' \
--header 'accept: */*' \
--header 'accept-language: en-US,en;q=0.9' \
--header 'api-key: hyperswitch' \
--header 'content-type: application/json' \
--header 'origin: https://app.hyperswitch.io' \
--header 'priority: u=1, i' \
--header 'referer: https://app.hyperswitch.io/dashboard/home' \
--header 'sec-ch-ua: "Google Chrome";v="131", "Chromium";v="131", "Not_A Brand";v="24"' \
--header 'sec-ch-ua-mobile: ?0' \
--header 'sec-ch-ua-platform: "macOS"' \
--header 'sec-fetch-dest: empty' \
--header 'sec-fetch-mode: cors' \
--header 'sec-fetch-site: same-origin' \
--header 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36' \
--header 'x-merchant-id: merchant_1715600622' \
--header 'x-profile-id: pro_CqAdpUQBUUam1n0g56mB' \
--header 'cookie: login_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiNjY2YzZlYWQtMWUzZi00ZTY4LWI5NjQtMGNiZTdkMWQ0OTk4IiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzQ0MjkzMzU5Iiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTc0NDQ2NjE2Niwib3JnX2lkIjoib3JnX0hzNWNLM0RlSDByRTJGcTMwSmp5IiwicHJvZmlsZV9pZCI6InByb190Nml0cjE3TkR3cWJOdHV5OG44diIsInRlbmFudF9pZCI6InB1YmxpYyJ9.sckbBxvWK6MtuAAoi4rZaeOwfU2AibyLz8GR7ZcF0pc' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiNjY2YzZlYWQtMWUzZi00ZTY4LWI5NjQtMGNiZTdkMWQ0OTk4IiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzQ0MjkzMzU5Iiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTc0NDQ2NjE2Niwib3JnX2lkIjoib3JnX0hzNWNLM0RlSDByRTJGcTMwSmp5IiwicHJvZmlsZV9pZCI6InByb190Nml0cjE3TkR3cWJOdHV5OG44diIsInRlbmFudF9pZCI6InB1YmxpYyJ9.sckbBxvWK6MtuAAoi4rZaeOwfU2AibyLz8GR7ZcF0pc' \
--data-raw '{
    "ProdIntent": {
        "poc_email": "berry@gmail.com",
        "is_completed": true,
        "legal_business_name": "blueberry",
        "business_location": "IN",
        "business_website": "https://google.com",
        "poc_name": "berry",
        "comments": "tx123",
        "product_type": "vault"
    }
}'
```

Expected Response:

200 OK, no body in the response


The following curl is supposed to read data from v1 public schema dashboard_metadata table and return the entry whether or not a prod_intent has been raised for a particular merchant_account.

```bash
curl --location 'http://localhost:8080/v2/user/data?keys=ProdIntent' \
--header 'X-Merchant-Id: ddcd_oBuAVsHl0XMLag9JsHCV' \
--header 'authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiM2RlMDFhYWYtOWVkMi00YTY5LTg3YWItNWU1YmI2ZWFiNGQ5IiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzQyMjEyMzQxIiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTc0Mjk4MDgyOCwib3JnX2lkIjoib3JnX3pMQmRNTnpLaDZrNmhiT2tockdJIiwicHJvZmlsZV9pZCI6InByb19LWnhHZ21rUHFkMldQdXBFa2psWCIsInRlbmFudF9pZCI6InB1YmxpYyJ9.aD185AZEOcIjHnLnZZ9GJ2ujSHIdRPbPtrYhzNo0V4M' \
--header 'sec-ch-ua-platform: "macOS"' \
--header 'Referer: https://integ.hyperswitch.io/dashboard/v2/recon' \
--header 'sec-ch-ua: "Not(A:Brand";v="99", "Google Chrome";v="133", "Chromium";v="133"' \
--header 'X-Profile-Id: pro_UaxaxwTw4A0a9D0QNBrf' \
--header 'sec-ch-ua-mobile: ?0' \
--header 'api-key: hyperswitch' \
--header 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36' \
--header 'Content-Type: application/json'
```

Expected Response:
```json
[
    {
        "ProdIntent": {
            "legal_business_name": "blueberry",
            "business_label": null,
            "business_location": "IN",
            "display_name": null,
            "poc_email": "sandeep@gmail.com",
            "business_type": null,
            "business_identifier": null,
            "business_website": "https://google.com",
            "poc_name": "berry",
            "poc_contact": null,
            "comments": "tx123",
            "is_completed": true,
            "product_type": "vault"
        }
    }
]
```

## Checklist
<!-- Put an `x` in the boxes that apply -->

- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible


Testing:

Tested by deploying this branch on v2 integ-router and hitting the following 2 API's. The entries from the POST API populated the integ v1 public schema - dashboard metadata table.

<img width="1728" alt="image" src="https://github.com/user-attachments/assets/2b73d3ff-2055-438c-a7d6-f1d865b57403" />
The highlighted entry in the v1 public schema dashboard_metadata table is the entry populated by hitting the v2 API, given by the curl below.

Hit the following curl:
- The entry for ProdIntent should be created in v1 public schema - dashboard_metadata table.

```bash
curl --location 'http://localhost:8080/v2/user/data' \
--header 'accept: */*' \
--header 'accept-language: en-US,en;q=0.9' \
--header 'api-key: hyperswitch' \
--header 'content-type: application/json' \
--header 'origin: https://app.hyperswitch.io' \
--header 'priority: u=1, i' \
--header 'referer: https://app.hyperswitch.io/dashboard/home' \
--header 'sec-ch-ua: "Google Chrome";v="131", "Chromium";v="131", "Not_A Brand";v="24"' \
--header 'sec-ch-ua-mobile: ?0' \
--header 'sec-ch-ua-platform: "macOS"' \
--header 'sec-fetch-dest: empty' \
--header 'sec-fetch-mode: cors' \
--header 'sec-fetch-site: same-origin' \
--header 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36' \
--header 'x-merchant-id: merchant_1715600622' \
--header 'x-profile-id: pro_CqAdpUQBUUam1n0g56mB' \
--header 'cookie: login_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiNjY2YzZlYWQtMWUzZi00ZTY4LWI5NjQtMGNiZTdkMWQ0OTk4IiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzQ0MjkzMzU5Iiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTc0NDQ2NjE2Niwib3JnX2lkIjoib3JnX0hzNWNLM0RlSDByRTJGcTMwSmp5IiwicHJvZmlsZV9pZCI6InByb190Nml0cjE3TkR3cWJOdHV5OG44diIsInRlbmFudF9pZCI6InB1YmxpYyJ9.sckbBxvWK6MtuAAoi4rZaeOwfU2AibyLz8GR7ZcF0pc' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiNjY2YzZlYWQtMWUzZi00ZTY4LWI5NjQtMGNiZTdkMWQ0OTk4IiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzQ0MjkzMzU5Iiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTc0NDQ2NjE2Niwib3JnX2lkIjoib3JnX0hzNWNLM0RlSDByRTJGcTMwSmp5IiwicHJvZmlsZV9pZCI6InByb190Nml0cjE3TkR3cWJOdHV5OG44diIsInRlbmFudF9pZCI6InB1YmxpYyJ9.sckbBxvWK6MtuAAoi4rZaeOwfU2AibyLz8GR7ZcF0pc' \
--data-raw '{
    "ProdIntent": {
        "poc_email": "berry@gmail.com",
        "is_completed": true,
        "legal_business_name": "blueberry",
        "business_location": "IN",
        "business_website": "https://google.com",
        "poc_name": "berry",
        "comments": "tx123",
        "product_type": "vault"
    }
}'
```

Expected Response:

200 OK, no body in the response


The following curl is supposed to read data from v1 public schema dashboard_metadata table and return the entry whether or not a prod_intent has been raised for a particular merchant_account.

```bash
curl --location 'http://localhost:8080/v2/user/data?keys=ProdIntent' \
--header 'X-Merchant-Id: ddcd_oBuAVsHl0XMLag9JsHCV' \
--header 'authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiM2RlMDFhYWYtOWVkMi00YTY5LTg3YWItNWU1YmI2ZWFiNGQ5IiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzQyMjEyMzQxIiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTc0Mjk4MDgyOCwib3JnX2lkIjoib3JnX3pMQmRNTnpLaDZrNmhiT2tockdJIiwicHJvZmlsZV9pZCI6InByb19LWnhHZ21rUHFkMldQdXBFa2psWCIsInRlbmFudF9pZCI6InB1YmxpYyJ9.aD185AZEOcIjHnLnZZ9GJ2ujSHIdRPbPtrYhzNo0V4M' \
--header 'sec-ch-ua-platform: "macOS"' \
--header 'Referer: https://integ.hyperswitch.io/dashboard/v2/recon' \
--header 'sec-ch-ua: "Not(A:Brand";v="99", "Google Chrome";v="133", "Chromium";v="133"' \
--header 'X-Profile-Id: pro_UaxaxwTw4A0a9D0QNBrf' \
--header 'sec-ch-ua-mobile: ?0' \
--header 'api-key: hyperswitch' \
--header 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36' \
--header 'Content-Type: application/json'
```

Expected Response:
```json
[
    {
        "ProdIntent": {
            "legal_business_name": "blueberry",
            "business_label": null,
            "business_location": "IN",
            "display_name": null,
            "poc_email": "sandeep@gmail.com",
            "business_type": null,
            "business_identifier": null,
            "business_website": "https://google.com",
            "poc_name": "berry",
            "poc_contact": null,
            "comments": "tx123",
            "is_completed": true,
            "product_type": "vault"
        }
    }
]
```

Patch:
diff --git a/crates/router/src/db.rs b/crates/router/src/db.rs
index d98f834e7b5..34e9fb4530b 100644
--- a/crates/router/src/db.rs
+++ b/crates/router/src/db.rs
@@ -169,6 +169,7 @@ pub trait AccountsStorageInterface:
     + business_profile::ProfileInterface
     + merchant_connector_account::MerchantConnectorAccountInterface
     + merchant_key_store::MerchantKeyStoreInterface
+    + dashboard_metadata::DashboardMetadataInterface
     + 'static
 {
 }
diff --git a/crates/router/src/db/dashboard_metadata.rs b/crates/router/src/db/dashboard_metadata.rs
index 4f1624f3457..1b6b7417ded 100644
--- a/crates/router/src/db/dashboard_metadata.rs
+++ b/crates/router/src/db/dashboard_metadata.rs
@@ -62,7 +62,7 @@ impl DashboardMetadataInterface for Store {
         &self,
         metadata: storage::DashboardMetadataNew,
     ) -> CustomResult<storage::DashboardMetadata, errors::StorageError> {
-        let conn = connection::pg_connection_write(self).await?;
+        let conn = connection::pg_accounts_connection_write(self).await?;
         metadata
             .insert(&conn)
             .await
@@ -78,7 +78,7 @@ impl DashboardMetadataInterface for Store {
         data_key: enums::DashboardMetadata,
         dashboard_metadata_update: storage::DashboardMetadataUpdate,
     ) -> CustomResult<storage::DashboardMetadata, errors::StorageError> {
-        let conn = connection::pg_connection_write(self).await?;
+        let conn = connection::pg_accounts_connection_write(self).await?;
         storage::DashboardMetadata::update(
             &conn,
             user_id,
@@ -99,7 +99,7 @@ impl DashboardMetadataInterface for Store {
         org_id: &id_type::OrganizationId,
         data_keys: Vec<enums::DashboardMetadata>,
     ) -> CustomResult<Vec<storage::DashboardMetadata>, errors::StorageError> {
-        let conn = connection::pg_connection_read(self).await?;
+        let conn = connection::pg_accounts_connection_read(self).await?;
         storage::DashboardMetadata::find_user_scoped_dashboard_metadata(
             &conn,
             user_id.to_owned(),
@@ -118,7 +118,7 @@ impl DashboardMetadataInterface for Store {
         org_id: &id_type::OrganizationId,
         data_keys: Vec<enums::DashboardMetadata>,
     ) -> CustomResult<Vec<storage::DashboardMetadata>, errors::StorageError> {
-        let conn = connection::pg_connection_read(self).await?;
+        let conn = connection::pg_accounts_connection_read(self).await?;
         storage::DashboardMetadata::find_merchant_scoped_dashboard_metadata(
             &conn,
             merchant_id.to_owned(),
@@ -135,7 +135,7 @@ impl DashboardMetadataInterface for Store {
         user_id: &str,
         merchant_id: &id_type::MerchantId,
     ) -> CustomResult<bool, errors::StorageError> {
-        let conn = connection::pg_connection_write(self).await?;
+        let conn = connection::pg_accounts_connection_write(self).await?;
         storage::DashboardMetadata::delete_all_user_scoped_dashboard_metadata_by_merchant_id(
             &conn,
             user_id.to_owned(),
@@ -152,7 +152,7 @@ impl DashboardMetadataInterface for Store {
         merchant_id: &id_type::MerchantId,
         data_key: enums::DashboardMetadata,
     ) -> CustomResult<storage::DashboardMetadata, errors::StorageError> {
-        let conn = connection::pg_connection_write(self).await?;
+        let conn = connection::pg_accounts_connection_write(self).await?;
         storage::DashboardMetadata::delete_user_scoped_dashboard_metadata_by_merchant_id_data_key(
             &conn,
             user_id.to_owned(),