| import { Controller, Get, Param, Query, UseGuards, Request } from '@nestjs/common'; |
| import { ProjectsService } from './projects.service'; |
| import { MatchingService } from './matching.service'; |
| import { JwtAuthGuard } from '@common/guards/jwt-auth.guard'; |
| import { RolesGuard } from '@common/guards/roles.guard'; |
| import { Roles } from '@common/decorators/roles.decorator'; |
| import { ApiBearerAuth, ApiQuery, ApiTags } from '@nestjs/swagger'; |
|
|
| @ApiTags('Matching') |
| @Controller('matching') |
| @UseGuards(JwtAuthGuard, RolesGuard) |
| export class MatchingController { |
| constructor( |
| private readonly projectsService: ProjectsService, |
| private readonly matchingService: MatchingService, |
| ) {} |
|
|
| |
| |
| |
| |
| |
| |
| @Get(':projectId/shortlist') |
| @Roles('CLIENT') |
| @ApiBearerAuth('JWT') |
| @ApiQuery({ |
| name: 'refresh', |
| required: false, |
| type: Boolean, |
| description: 'Set true to force re-score matching against all current experts.', |
| }) |
| async getShortlist( |
| @Param('projectId') projectId: string, |
| @Query('refresh') refresh: string, |
| @Request() req: any, |
| ) { |
| if (refresh === 'true') { |
| await this.matchingService.forceRefresh(projectId); |
| } |
| return this.projectsService.getMatchingShortlist(projectId, req.user.id); |
| } |
| } |