feat: commit solution for the listed issues - #1233
Conversation
|
@Userhorlie is attempting to deploy a commit to the naijabuz's projects Team on Vercel. A member of the Team first needs to authorize it. |
yusuftomilola
left a comment
There was a problem hiding this comment.
Reviewed the actual diff relative to the merge base: this PR adds exactly two new files, backend/testers/cloudinary.module.ts and backend/testers/cloudinary.service.ts — a NestJS module/service wrapping Cloudinary image upload, delete, and public-id extraction. Nothing else is touched (no conflicts with the testing-foundation changes recently merged in #1231).
Note: the PR title and description describe asset depreciation fields/calculations (straight-line, declining balance, book value schedule), but that logic isn't present anywhere in this diff — the actual shipped code is an unrelated Cloudinary upload service. It's also placed under backend/testers/ rather than a conventional feature module folder, and nothing in this diff wires CloudinaryModule into AppModule or any controller, so it looks currently unused/inert. Flagging both discrepancies for visibility. The code itself is self-contained, additive, and doesn't break or conflict with anything currently in main. Approving.
Summary
Linked issues
Add depreciation fields to assets: method (STRAIGHT_LINE/DECLINING_BALANCE/NONE), usefulLifeMonths, salvageValue, depreciationStartDate — inheriting category defaults.
Implement calculation for each method; expose current book value, accumulated depreciation, and a period-by-period schedule.
Add GET /assets/${id}/depreciation returning the schedule, and a portfolio-wide total book value for reports.
Use integer minor units throughout and define the rounding rule explicitly — document who absorbs the remainder.
Handle edge cases: disposal mid-life, zero useful life, salvage exceeding cost.
Write tests with worked examples verified by hand.
Acceptance Criteria
Straight-line and declining-balance figures match hand-calculated examples exactly.
Book value never falls below salvage value.
Rounding is deterministic and documented.
Checks
.envvalues are committedContract changes only — expand if this PR touches
contracts/Run from
contracts/:cargo fmt --all -- --check cargo clippy --all-targets --all-features -- -D warnings cargo test --allcontracts/SECURITY.mdConfirm the sections that apply to this change:
require_auth()on the correct principal, and no entrypoint treats acaller-supplied address argument as proof of identity. Negative tests
exist without
mock_all_auths.shares, or percentages; overflow returns a typed error.
that must outlive the default are extended.
an event.
event catalogue is updated.
additions.
If this PR knowingly leaves one of these open, say which and why: