hrhub / api /src /app.controller.ts
Roger Surf
feat: NestJS API with matching service - dashboard working (WIP)
5e7da44
raw
history blame contribute delete
654 Bytes
import { Controller, Get, Render } from '@nestjs/common';
import { MatchingService } from './matching/matching.service';
@Controller()
export class AppController {
constructor(private readonly matchingService: MatchingService) {}
@Get()
@Render('dashboard')
getDashboard() {
const candidate = this.matchingService.getCandidateData(0);
const matches = this.matchingService.findTopMatches(10);
return {
candidate,
matches,
totalMatches: matches.length,
avgScore: (matches.reduce((sum, m) => sum + m.score, 0) / matches.length).toFixed(3),
bestScore: matches[0]?.score.toFixed(3) || '0',
};
}
}