[ADMINAPI-1447] - Include rows in adminapi.DbInstances on the sync endpoints.#390
Draft
DavidJGapCR wants to merge 8 commits into
Draft
[ADMINAPI-1447] - Include rows in adminapi.DbInstances on the sync endpoints.#390DavidJGapCR wants to merge 8 commits into
DavidJGapCR wants to merge 8 commits into
Conversation
- Add Status, DatabaseTemplate, DatabaseName nullable fields to TenantOdsInstanceModel - TenantService enriches OdsInstances with linked DbInstance data; defaults Status to DbInstanceStatus.Created for OdsInstances with no matching DbInstance - Unlinked DbInstances (OdsInstanceId == null) appended with successive negative IDs - ReadTenants endpoint injects and forwards IGetDbInstancesQuery - Updated unit tests (ReadTenantsTest, TenantServiceTests) with new parameter and four new merging-logic tests - Added DB integration tests (GetTenantEdOrgsByInstancesTests) - Updated Bruno E2E schema to include status, databaseTemplate, databaseName fields Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
Test Results 15 files 15 suites 53s ⏱️ Results for commit c9daf7e. ♻️ This comment has been updated with latest results. |
- TenantDataStoreModel: Added Status?, DatabaseTemplate?, DatabaseName? fields - TenantMapper.cs: Added ToUnlinkedDbDataStoreModel() for unlinked DbInstance entries - TenantService.cs (V3): Updated interface + implementation to accept IGetDbDataStoresQuery; merging logic adds linked DbDataStore fields and appends unlinked entries with negative IDs; OdsInstances with no matching DbDataStore default to Status=Created - ReadTenants.cs (V3): Added IGetDbDataStoresQuery parameter, forwarded to service - ReadTenantsTest.cs (V3): Added _getDbDataStoresQuery fake; updated all call sites - TenantServiceTests.cs (V3): Updated existing tests; added 4 new merging scenario tests - GetTenantEdOrgsByDataStoresTests.cs: New DB integration test file with 5 tests Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds DbInstance/DbDataStore details into the tenant “edOrgs by instances/dataStores” sync responses so callers can see provisioning state and database metadata alongside ODS instance entries, including representing unlinked DbInstances as synthetic entries.
Changes:
- Extend tenant response models (V2 OdsInstances, V3 DataStores) with
status,databaseTemplate, anddatabaseName. - Update tenant services/endpoints (V2 + V3) to merge DbInstance-backed fields and append unlinked rows with negative IDs.
- Update unit tests, DB tests, and Bruno E2E schemas to cover/validate the enriched response shape.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/superpowers/plans/2026-06-26-merge-dbinstances-into-readtenants.md | Implementation plan for merging DbInstances into tenant read endpoints. |
| Application/EdFi.Ods.AdminApi/Infrastructure/Services/Tenants/TenantService.cs | Merges DbInstance fields into TenantDetailModel.OdsInstances and appends unlinked DbInstances. |
| Application/EdFi.Ods.AdminApi/Features/Tenants/TenantMapper.cs | Adds mapping helper to project an unlinked DbInstance into a tenant OdsInstance model. |
| Application/EdFi.Ods.AdminApi/Features/Tenants/TenantDetailModel.cs | Adds Status, DatabaseTemplate, DatabaseName to TenantOdsInstanceModel. |
| Application/EdFi.Ods.AdminApi/Features/Tenants/ReadTenants.cs | Injects IGetDbInstancesQuery and forwards it into the tenant service call. |
| Application/EdFi.Ods.AdminApi/E2E Tests/V2/Bruno Admin API E2E 2.0 refactor/v2/Tenants/GET - Tenants EdOrgs by Tenant Name - Singletenant.bru | Updates AJV schema to allow the new nullable fields on each odsInstances item. |
| Application/EdFi.Ods.AdminApi/E2E Tests/V2/Bruno Admin API E2E 2.0 refactor/v2/Tenants/GET - Tenants EdOrgs by Tenant Name - Multitenant.bru | Updates AJV schema to allow the new nullable fields on each odsInstances item. |
| Application/EdFi.Ods.AdminApi.V3/Infrastructure/Services/Tenants/TenantService.cs | V3 equivalent merge/appending logic for TenantDetailModel.DataStores. |
| Application/EdFi.Ods.AdminApi.V3/Features/Tenants/TenantMapper.cs | Adds mapping helper to project an unlinked DbInstance into a tenant DataStore model. |
| Application/EdFi.Ods.AdminApi.V3/Features/Tenants/TenantDetailModel.cs | Adds Status, DatabaseTemplate, DatabaseName to TenantDataStoreModel. |
| Application/EdFi.Ods.AdminApi.V3/Features/Tenants/ReadTenants.cs | Injects IGetDbDataStoresQuery and forwards it into the tenant service call. |
| Application/EdFi.Ods.AdminApi.V3.UnitTests/Infrastructure/Services/Tenants/TenantServiceTests.cs | Extends V3 tenant service unit tests to cover merge behavior and unlinked negative IDs. |
| Application/EdFi.Ods.AdminApi.V3.UnitTests/Features/Tenants/ReadTenantsTest.cs | Updates V3 endpoint unit tests for new query dependency injection. |
| Application/EdFi.Ods.AdminApi.V3.DBTests/Database/QueryTests/GetTenantEdOrgsByDataStoresTests.cs | Adds V3 DB tests validating DbInstance query results used by merge logic. |
| Application/EdFi.Ods.AdminApi.UnitTests/Infrastructure/Services/Tenants/TenantServiceTests.cs | Extends V2 tenant service unit tests to cover merge behavior and unlinked negative IDs. |
| Application/EdFi.Ods.AdminApi.UnitTests/Features/Tenants/ReadTenantsTest.cs | Updates V2 endpoint unit tests for new query dependency injection. |
| Application/EdFi.Ods.AdminApi.DBTests/Database/QueryTests/GetTenantEdOrgsByInstancesTests.cs | Adds V2 DB tests validating DbInstance query results used by merge logic. |
Comment on lines
+142
to
+146
| var allDbInstances = getDbInstancesQuery.Execute(new CommonQueryParams(0, null), null, null); | ||
|
|
||
| var linkedDbInstancesByOdsId = allDbInstances | ||
| .Where(d => d.OdsInstanceId is not null) | ||
| .ToDictionary(d => d.OdsInstanceId!.Value); |
Comment on lines
+142
to
+146
| var allDbDataStores = getDbDataStoresQuery.Execute(new CommonQueryParams(0, null), null, null); | ||
|
|
||
| var linkedDbDataStoresByDataStoreId = allDbDataStores | ||
| .Where(d => d.OdsInstanceId is not null) | ||
| .ToDictionary(d => d.OdsInstanceId!.Value); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.