Initial commit: HOA Financial Intelligence Platform MVP

Multi-tenant financial management platform for homeowner associations featuring:
- NestJS backend with 16 modules (auth, accounts, transactions, budgets, units,
  invoices, payments, vendors, reserves, investments, capital projects, reports)
- React + Mantine frontend with dashboard, CRUD pages, and financial reports
- Schema-per-tenant PostgreSQL isolation with JWT-based tenant resolution
- Docker Compose infrastructure (nginx, backend, frontend, postgres, redis)
- Comprehensive seed data for Sunrise Valley HOA demo
- 39 API endpoints with Swagger documentation
- Double-entry bookkeeping with journal entries
- Budget vs actual reporting and Sankey cash flow visualization

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-17 19:58:04 -05:00
commit 243770cea5
118 changed files with 8569 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
import { Controller, Get, Post, Put, Body, Param, UseGuards } from '@nestjs/common';
import { ApiTags, ApiBearerAuth } from '@nestjs/swagger';
import { JwtAuthGuard } from '../auth/guards/jwt-auth.guard';
import { CapitalProjectsService } from './capital-projects.service';
@ApiTags('capital-projects')
@Controller('capital-projects')
@ApiBearerAuth()
@UseGuards(JwtAuthGuard)
export class CapitalProjectsController {
constructor(private service: CapitalProjectsService) {}
@Get()
findAll() { return this.service.findAll(); }
@Get(':id')
findOne(@Param('id') id: string) { return this.service.findOne(id); }
@Post()
create(@Body() dto: any) { return this.service.create(dto); }
@Put(':id')
update(@Param('id') id: string, @Body() dto: any) { return this.service.update(id, dto); }
}

View File

@@ -0,0 +1,10 @@
import { Module } from '@nestjs/common';
import { CapitalProjectsController } from './capital-projects.controller';
import { CapitalProjectsService } from './capital-projects.service';
@Module({
controllers: [CapitalProjectsController],
providers: [CapitalProjectsService],
exports: [CapitalProjectsService],
})
export class CapitalProjectsModule {}

View File

@@ -0,0 +1,50 @@
import { Injectable, NotFoundException } from '@nestjs/common';
import { TenantService } from '../../database/tenant.service';
@Injectable()
export class CapitalProjectsService {
constructor(private tenant: TenantService) {}
async findAll() {
return this.tenant.query(`
SELECT cp.*, rc.name as reserve_component_name
FROM capital_projects cp
LEFT JOIN reserve_components rc ON rc.id = cp.reserve_component_id
ORDER BY cp.target_year, cp.target_month NULLS LAST, cp.priority
`);
}
async findOne(id: string) {
const rows = await this.tenant.query('SELECT * FROM capital_projects WHERE id = $1', [id]);
if (!rows.length) throw new NotFoundException('Capital project not found');
return rows[0];
}
async create(dto: any) {
const rows = await this.tenant.query(
`INSERT INTO capital_projects (name, description, estimated_cost, actual_cost, target_year, target_month,
status, reserve_component_id, fund_source, priority, notes)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11) RETURNING *`,
[dto.name, dto.description, dto.estimated_cost, dto.actual_cost || null, dto.target_year,
dto.target_month || null, dto.status || 'planned', dto.reserve_component_id || null,
dto.fund_source || 'reserve', dto.priority || 3, dto.notes],
);
return rows[0];
}
async update(id: string, dto: any) {
await this.findOne(id);
const rows = await this.tenant.query(
`UPDATE capital_projects SET name = COALESCE($2, name), description = COALESCE($3, description),
estimated_cost = COALESCE($4, estimated_cost), actual_cost = COALESCE($5, actual_cost),
target_year = COALESCE($6, target_year), target_month = COALESCE($7, target_month),
status = COALESCE($8, status), reserve_component_id = COALESCE($9, reserve_component_id),
fund_source = COALESCE($10, fund_source), priority = COALESCE($11, priority),
notes = COALESCE($12, notes), updated_at = NOW()
WHERE id = $1 RETURNING *`,
[id, dto.name, dto.description, dto.estimated_cost, dto.actual_cost, dto.target_year,
dto.target_month, dto.status, dto.reserve_component_id, dto.fund_source, dto.priority, dto.notes],
);
return rows[0];
}
}