Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TBCCT-275] fix(api): Remove ecosystem dependant assumptions for conservation activity type (Refactor to reduce technical debt needed) #252

Merged
merged 3 commits into from
Jan 28, 2025

Conversation

alepefe
Copy link
Collaborator

@alepefe alepefe commented Jan 26, 2025

This pull request focuses on updating the data transfer objects (DTOs) and related imports to use new schema-based DTOs instead of the previous class-validator-based DTOs. Here are the most important changes:

DTO Updates:

  • Replaced OverridableAssumptions with OverridableAssumptionsDto in assumptions.repository.ts, sequestration-rate.calculator.ts, and other related files. [1] [2] [3]
  • Replaced OverridableCostInputs with OverridableCostInputsDto in cost.calculator.ts, data.repository.ts, and other related files. [1] [2] [3]
  • Removed old DTOs project-assumptions.dto.ts, project-cost-inputs.dto.ts, create-custom-project-dto.ts, and conservation-project-params.dto.ts. [1] [2] [3] [4]
  • Added new schema-based DTOs in create-custom-project.dto.ts.

Repository and Service Updates:

  • Updated AssumptionsRepository to use the new DTOs and added a condition to return restoration rate only for restoration activities. [1] [2]
  • Updated CustomProjectsService and CustomProjectsController to use the new CreateCustomProjectDto. [1] [2]

Import Cleanups:

  • Removed unnecessary imports related to the old DTOs from various files. [1] [2] [3]

These changes ensure that the project now uses the new schema-based DTOs, which simplifies validation and improves consistency across the codebase.

Copy link

vercel bot commented Jan 26, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
tnc-blue-carbon-cost-tool-ghps ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 27, 2025 11:59am

Copy link
Collaborator

@alexeh alexeh left a comment

Choose a reason for hiding this comment

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

Nice one @alepefe LGTM. I just left some minor comments.

However, since this touches critical parts, we really need to thoroughly tests the implementation to make sure we do not introduce any regression.

Also, lots of zod schema changes are present, so I'd like @agnlez 's review and input as well. I'll add him as reviewer

@alexeh alexeh requested a review from agnlez January 27, 2025 06:27
@agnlez
Copy link
Member

agnlez commented Jan 27, 2025

Being checking project creation with both scenarios: conservation and restoration and, in both cases, the same restrictions apply as we had in the previous version. So I would say LGTM 👍🏻

@agnlez agnlez self-requested a review January 27, 2025 12:00
Copy link
Collaborator

@alexeh alexeh left a comment

Choose a reason for hiding this comment

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

This is very cool!!
image

Been testing it a bit, seems to work fine with some caveats I detected but they are already present in dev so not related to this branch.

HOWEVER, given the magnitude of the changes, let's wait for today's meeting before pushing this forward. I'll try to have someone testing this more in depth

@alexeh alexeh merged commit e4be0d3 into dev Jan 28, 2025
4 checks passed
@alexeh alexeh deleted the feat/TBCCT-275-WIP branch January 28, 2025 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants