Skip to content

Commit

Permalink
descendant search for material and origin plot geojsons
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeh committed Mar 21, 2024
1 parent 112aa63 commit 889ef43
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions api/src/modules/eudr-alerts/eudr.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,16 @@ export class EudrController {
async getGeoFeatureList(
@Query(ValidationPipe) dto: GetEUDRFeaturesGeoJSONDto,
): Promise<GeoFeatureResponse[]> {
if (dto.originIds) {
dto.originIds = await this.adminRegionsService.getAdminRegionDescendants(
dto.originIds,
);
}
if (dto.materialIds) {
dto.materialIds = await this.materialsService.getMaterialsDescendants(
dto.materialIds,
);
}
return this.geoRegionsService.getGeoJson({ ...dto, eudr: true });
}

Expand All @@ -238,6 +248,16 @@ export class EudrController {
async getGeoFeatureCollection(
@Query(ValidationPipe) dto: GetEUDRFeaturesGeoJSONDto,
): Promise<GeoFeatureCollectionResponse> {
if (dto.originIds) {
dto.originIds = await this.adminRegionsService.getAdminRegionDescendants(
dto.originIds,
);
}
if (dto.materialIds) {
dto.materialIds = await this.materialsService.getMaterialsDescendants(
dto.materialIds,
);
}
return this.geoRegionsService.getGeoJson({
...dto,
eudr: true,
Expand Down

0 comments on commit 889ef43

Please sign in to comment.