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:
@@ -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 { ReserveComponentsService } from './reserve-components.service';
|
||||
|
||||
@ApiTags('reserve-components')
|
||||
@Controller('reserve-components')
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(JwtAuthGuard)
|
||||
export class ReserveComponentsController {
|
||||
constructor(private service: ReserveComponentsService) {}
|
||||
|
||||
@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); }
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { ReserveComponentsController } from './reserve-components.controller';
|
||||
import { ReserveComponentsService } from './reserve-components.service';
|
||||
|
||||
@Module({
|
||||
controllers: [ReserveComponentsController],
|
||||
providers: [ReserveComponentsService],
|
||||
exports: [ReserveComponentsService],
|
||||
})
|
||||
export class ReserveComponentsModule {}
|
||||
@@ -0,0 +1,47 @@
|
||||
import { Injectable, NotFoundException } from '@nestjs/common';
|
||||
import { TenantService } from '../../database/tenant.service';
|
||||
|
||||
@Injectable()
|
||||
export class ReserveComponentsService {
|
||||
constructor(private tenant: TenantService) {}
|
||||
|
||||
async findAll() {
|
||||
return this.tenant.query('SELECT * FROM reserve_components ORDER BY name');
|
||||
}
|
||||
|
||||
async findOne(id: string) {
|
||||
const rows = await this.tenant.query('SELECT * FROM reserve_components WHERE id = $1', [id]);
|
||||
if (!rows.length) throw new NotFoundException('Reserve component not found');
|
||||
return rows[0];
|
||||
}
|
||||
|
||||
async create(dto: any) {
|
||||
const rows = await this.tenant.query(
|
||||
`INSERT INTO reserve_components (name, category, description, useful_life_years, remaining_life_years,
|
||||
replacement_cost, current_fund_balance, annual_contribution, condition_rating,
|
||||
last_replacement_date, next_replacement_date)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11) RETURNING *`,
|
||||
[dto.name, dto.category, dto.description, dto.useful_life_years, dto.remaining_life_years || 0,
|
||||
dto.replacement_cost, dto.current_fund_balance || 0, dto.annual_contribution || 0,
|
||||
dto.condition_rating || 5, dto.last_replacement_date || null, dto.next_replacement_date || null],
|
||||
);
|
||||
return rows[0];
|
||||
}
|
||||
|
||||
async update(id: string, dto: any) {
|
||||
await this.findOne(id);
|
||||
const rows = await this.tenant.query(
|
||||
`UPDATE reserve_components SET name = COALESCE($2, name), category = COALESCE($3, category),
|
||||
description = COALESCE($4, description), useful_life_years = COALESCE($5, useful_life_years),
|
||||
remaining_life_years = COALESCE($6, remaining_life_years), replacement_cost = COALESCE($7, replacement_cost),
|
||||
current_fund_balance = COALESCE($8, current_fund_balance), annual_contribution = COALESCE($9, annual_contribution),
|
||||
condition_rating = COALESCE($10, condition_rating), last_replacement_date = COALESCE($11, last_replacement_date),
|
||||
next_replacement_date = COALESCE($12, next_replacement_date), updated_at = NOW()
|
||||
WHERE id = $1 RETURNING *`,
|
||||
[id, dto.name, dto.category, dto.description, dto.useful_life_years, dto.remaining_life_years,
|
||||
dto.replacement_cost, dto.current_fund_balance, dto.annual_contribution, dto.condition_rating,
|
||||
dto.last_replacement_date, dto.next_replacement_date],
|
||||
);
|
||||
return rows[0];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user