Skip to content

feat: depreciation engine, reservations, vendors directory, and purchase orders - #1358

Merged
yusuftomilola merged 1 commit into
DistinctCodes:mainfrom
RennyThompson:feature/depreciation-reservations-vendors-po
Aug 26, 2026
Merged

feat: depreciation engine, reservations, vendors directory, and purchase orders#1358
yusuftomilola merged 1 commit into
DistinctCodes:mainfrom
RennyThompson:feature/depreciation-reservations-vendors-po

Conversation

@RennyThompson

Copy link
Copy Markdown
Contributor

Summary

This PR implements four foundational features for the AssetsUp platform: a depreciation engine, asset reservations, a vendors directory, and purchase orders.

Changes

[BE-28] Depreciation Engine

  • Added depreciationMethod, usefulLifeMonths, salvageValue, and currentValue fields to the Asset entity
  • Created DepreciationModule with service supporting straight-line and declining-balance (200% DB) methods
  • GET /api/assets/:id/depreciation — full depreciation schedule with current book value
  • GET /api/reports/depreciation — org-wide totals (total book value, monthly expense, top categories)
  • Handles mid-month purchases with prorated first periods, salvage value floor, and fully-depreciated assets

[BE-29] Asset Reservations

  • Created ReservationsModule with Reservation entity (asset, reservedBy, time window, status)
  • Race-safe overlap detection using raw SQL transaction checks
  • POST /api/reservations — create with 409 on overlap
  • GET /api/reservations — filtered list (assetId, userId, from, to, status)
  • GET /api/assets/:id/availability — free/busy windows for calendar rendering
  • PATCH /api/reservations/:id/cancel — staff cancel own; managers cancel any
  • PATCH /api/reservations/:id/confirm — manager/admin only

[FE-06] Vendors Directory

  • /vendors page with searchable vendor table (name, contact, email/phone, asset count)
  • Create/edit modal with validation (email format, unique name/code)
  • API client, TanStack Query hooks, and query keys
  • Linked assets display on vendor detail

[FE-07] Purchase Orders

  • /purchase-orders page with PO table (number, vendor, items, total, status badge, expected date)
  • Create PO modal with vendor picker, dynamic line items, running total
  • Receive flow: mark items received with quantities, auto-creates assets
  • Status lifecycle: DRAFT → ORDERED → PARTIALLY_RECEIVED → RECEIVED, with cancel

Verification

  • Backend modules follow existing NestJS patterns (TypeORM, service/controller/module)
  • Frontend follows existing patterns (TanStack Query, React Hook Form + Zod, typed API clients)
  • Sidebar updated with new navigation entries

Closes #1087
Closes #1088
Closes #1094
Closes #1095

…urchase orders

- BE-28: Implement depreciation engine with straight-line and declining-balance
  schedules, org-wide depreciation reports, and asset depreciation endpoints
- BE-29: Implement asset reservations with race-safe conflict detection,
  availability endpoint, confirm/cancel workflows
- FE-06: Build vendors directory with CRUD, search, and linked assets
- FE-07: Build purchase orders page with PO lifecycle, line-item management,
  and receive-into-assets flow

Closes DistinctCodes#1087
Closes DistinctCodes#1088
Closes DistinctCodes#1094
Closes DistinctCodes#1095
@vercel

vercel Bot commented Aug 25, 2026

Copy link
Copy Markdown

@RennyThompson is attempting to deploy a commit to the naijabuz's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Aug 25, 2026

Copy link
Copy Markdown

@RennyThompson Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@yusuftomilola yusuftomilola left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed. Solid work:

  • Depreciation engine: straight-line and declining-balance methods, correctly proration on a partial first month, salvage-value floor respected, and both a per-asset and an org-wide category-grouped report.
  • Reservations: overlap-conflict detection on create (409 on a clashing time window), ownership + role gating on cancel (owner/ADMIN/MANAGER), ADMIN/MANAGER-only confirm, and an availability endpoint wired into the asset controller.
  • Purchase orders / vendors frontend: clean CRUD pages with search, receive/cancel modals, proper query hooks.

Approving.

@yusuftomilola
yusuftomilola merged commit 76a9404 into DistinctCodes:main Aug 26, 2026
6 of 11 checks passed
yusuftomilola added a commit to authenticeasy-sys/AssetsUp that referenced this pull request Aug 26, 2026
Resolve additive conflicts against DistinctCodes#1358 (DepreciationModule/
ReservationsModule) in app.module.ts and against DistinctCodes#1359 (theme
provider) in topbar.tsx - both sets of imports/JSX are needed side
by side, so combined them.
yusuftomilola added a commit that referenced this pull request Aug 26, 2026
…ration-and-table-views

Merging per repo maintainer review. Resolved additive conflicts in app.module.ts (against #1358) and topbar.tsx (against #1359). Pre-existing CI failures predate this PR.
yusuftomilola added a commit to BashMan11/AssetsUp that referenced this pull request Aug 26, 2026
Resolve duplicate lucide-react import conflict in sidebar.tsx: this
branch and DistinctCodes#1358 both added Store/FileText icon imports for the same
nav items (already merged), plus this PR's own Bell import for the
new notifications link. Deduplicated to a single import list.
yusuftomilola added a commit that referenced this pull request Aug 26, 2026
…ications

Merging per repo maintainer review. Resolved a duplicate icon-import conflict in sidebar.tsx against #1358. Pre-existing CI failures predate this PR.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants