37 lines
1.1 KiB
TypeScript
37 lines
1.1 KiB
TypeScript
import { Body, Controller, Post } from '@nestjs/common';
|
|
import { IsISO8601, IsString } from 'class-validator';
|
|
import { Type } from 'class-transformer';
|
|
import { Public } from '../auth/decorators/public.decorator';
|
|
import { LogsBiometry } from '../auth/decorators/logs-biometry.decorator';
|
|
import { RecognitionService } from './recognition.service';
|
|
|
|
class ProbeDto {
|
|
@IsString()
|
|
frame!: string;
|
|
|
|
@IsString()
|
|
cameraId!: string;
|
|
|
|
@IsISO8601()
|
|
@Type(() => String)
|
|
occurredAt!: string;
|
|
}
|
|
|
|
@Controller('recognition')
|
|
export class RecognitionController {
|
|
constructor(private readonly recognition: RecognitionService) {}
|
|
|
|
// Public (нет JWT), но логируется как биометрический доступ.
|
|
// В будущем заменим на внутренний service-to-service token.
|
|
@Public()
|
|
@LogsBiometry('recognition_probe')
|
|
@Post('probe')
|
|
probe(@Body() dto: ProbeDto) {
|
|
return this.recognition.probe({
|
|
frameBase64: dto.frame,
|
|
cameraId: dto.cameraId,
|
|
occurredAt: new Date(dto.occurredAt),
|
|
});
|
|
}
|
|
}
|