You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.1 KiB
36 lines
1.1 KiB
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), |
|
}); |
|
} |
|
}
|
|
|