Skip to content

[ADMINAPI-1447] - Include rows in adminapi.DbInstances on the sync endpoints.#390

Draft
DavidJGapCR wants to merge 8 commits into
mainfrom
ADMINAPI-1447
Draft

[ADMINAPI-1447] - Include rows in adminapi.DbInstances on the sync endpoints.#390
DavidJGapCR wants to merge 8 commits into
mainfrom
ADMINAPI-1447

Conversation

@DavidJGapCR

Copy link
Copy Markdown
Contributor

No description provided.

DavidJGapCR and others added 7 commits May 25, 2026 11:18
- 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>
@github-actions

github-actions Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Test Results

   15 files     15 suites   53s ⏱️
1 255 tests 1 243 ✅ 12 💤 0 ❌
2 631 runs  2 599 ✅ 32 💤 0 ❌

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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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, and databaseName.
  • 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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants