fix getLocationByEntity to use original_value

Signed-off-by: Jamie Tang <jamie.tang@autodesk.com>
This commit is contained in:
Jamie Tang
2025-07-09 14:18:05 -07:00
parent 09eeb97ac0
commit fa6fa60445
2 changed files with 8 additions and 3 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-backend': patch
---
Fixed getLocationByEntity to use `original_value` instead of `value` when querying search table
@@ -137,15 +137,15 @@ export class DefaultLocationStore implements LocationStore, EntityProvider {
entity_id: entityRow.entity_id,
key: `metadata.annotations.${ANNOTATION_ORIGIN_LOCATION}`,
})
.select('value')
.select('original_value')
.limit(1);
if (!searchRow?.value) {
if (!searchRow?.original_value) {
throw new NotFoundError(
`found no origin annotation for ref ${entityRefString}`,
);
}
const { type, target } = parseLocationRef(searchRow.value);
const { type, target } = parseLocationRef(searchRow.original_value);
const [locationRow] = await this.db<DbLocationsRow>('locations')
.where({ type, target })
.select()