Skip to content

Cost and default value crud endpoints#365

Open
lyannne wants to merge 9 commits intomainfrom
cost-and-default-value-crud-endpoints
Open

Cost and default value crud endpoints#365
lyannne wants to merge 9 commits intomainfrom
cost-and-default-value-crud-endpoints

Conversation

@lyannne
Copy link
Collaborator

@lyannne lyannne commented Mar 19, 2026

ℹ️ Issue

Closes #360

📝 Description

Write a short summary of what you added. Why is it important? Any member of C4C should be able to read this and understand your contribution -- not just your team members.

Briefly list the changes made to the code:

  1. Added get and update routes for default values, since those should not be createable or deleteable
  2. Added:
  • getAllCosts (for displaying all the costs)
  • getCostByName (for getting a specific cost)
  • getCostsByType (for if the user wants to see all costs in a certain category, like Personal Salaries. Verification that it is a valid )
  • createCost (for when the user wants to create a new cost. This includes verification that the cost is a positive number!)
  • updateCost (for when the user wants to update the name, amount, or type of a cost. Can have 1 or all 3 updated)
  • deleteCost (for when the user wants to remove a cost if it's not relevant anymore)
  1. Added tests for both!

✔️ Verification

What steps did you take to verify your changes work? These should be clear enough for someone to be able to clone the branch and follow the steps themselves.

Provide screenshots of any new components, styling changes, or pages.

Verified with Swagger!

Test Changes

If your new feature required some test to be changed or added to fit the new functionality or changes please document these changes here.

N/A

🏕️ (Optional) Future Work / Notes

Did you notice anything ugly during the course of this ticket? Any bugs, design challenges, or unexpected behavior? Write it down so we can clean it up in a future ticket!

  • I kind of took some creative liberties with what backend routes i thought would be needed; lmk if any are unnecessary or there needs to be any more!
  • Copilot suggested a GSI in this table for CostType potentially, for filtering by CostType. Thoughts?

@lyannne lyannne linked an issue Mar 19, 2026 that may be closed by this pull request
Copilot AI review requested due to automatic review settings March 19, 2026 23:56
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds new NestJS API surface for Cashflow “costs” and “default values” backed by DynamoDB, wiring the new modules into the backend app and introducing service-level unit tests.

Changes:

  • Added cost module with service + controller for cost CRUD (by name/type) and DynamoDB persistence.
  • Added default-values module with service + controller for fetching and updating fixed default-value keys.
  • Added Vitest unit tests for both new services and minor type cleanup in CashflowCost.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
middle-layer/types/CashflowCost.ts Normalizes interface formatting/order.
backend/src/default-values/types/default-values.types.ts Introduces request/response types for default values endpoints.
backend/src/default-values/default-values.service.ts Implements DynamoDB-backed read + update logic for default values.
backend/src/default-values/default-values.controller.ts Adds GET/PATCH endpoints and Swagger metadata for default values.
backend/src/default-values/default-values.module.ts Registers default-values controller/service with Nest module system.
backend/src/default-values/test/default-values.service.spec.ts Adds unit tests for default-values service.
backend/src/cost/cost.service.ts Implements DynamoDB-backed cost CRUD + validation logic.
backend/src/cost/cost.controller.ts Adds REST endpoints and Swagger metadata for cost operations.
backend/src/cost/cost.module.ts Registers cost controller/service with Nest module system.
backend/src/cost/test/cost.service.spec.ts Adds unit tests for cost service.
backend/src/app.module.ts Wires new CostModule and DefaultValuesModule into the application.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

DEV - Cost and Default Value CRUD endpoints

2 participants