Skip to content

Commit

Permalink
feat(projects): include custom protected areas
Browse files Browse the repository at this point in the history
  • Loading branch information
kgajowy committed Sep 16, 2021
1 parent 8839290 commit 6638de6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions api/apps/api/src/modules/projects/projects-crud.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,17 @@ export class ProjectsCrudService extends AppBaseService<
entity.planningAreaId = idAndName.planningAreaId;
entity.planningAreaName = idAndName.planningAreaName;
}

const customProtectedAreas = await this.protectedAreas.find({
where: {
projectId: entity.id,
},
});
entity.customProtectedAreas = customProtectedAreas.map((area) => ({
name: area.fullName ?? undefined,
id: area.id,
}));

return entity;
}

Expand Down
1 change: 1 addition & 0 deletions api/apps/api/test/project/projects.fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export const getFixtures = async () => {
countryId: null,
description: null,
createdAt: expect.any(String),
customProtectedAreas: [],
lastModifiedAt: expect.any(String),
name: expect.any(String),
planningUnitAreakm2: expect.any(Number),
Expand Down

0 comments on commit 6638de6

Please sign in to comment.