mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-08 17:08:18 +00:00
feat: ( audit ) resolve the actor from the session and audit all backoffice mutations
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
import { Body, Controller, Get, Param, Post, Query, UseGuards, Delete, Patch, SetMetadata } from '@nestjs/common';
|
||||
import { Body, Controller, Get, Param, Post, Query, Req, UseGuards, Delete, Patch, SetMetadata } from '@nestjs/common';
|
||||
import { ApiTags, ApiOperation, ApiBearerAuth, ApiBody, ApiQuery } from '@nestjs/swagger';
|
||||
import { TicketsService } from './tickets.service';
|
||||
import { PassengerStaff, PassengerAdmin } from '../../common/passenger-guards';
|
||||
import { PASSENGER_PERMS } from '../../seed/passenger-permissions.registry';
|
||||
import { resolveActingUser } from '../../common/acting-user';
|
||||
|
||||
@ApiTags('Tickets')
|
||||
@Controller('tickets')
|
||||
@@ -135,10 +136,13 @@ export class TicketsController {
|
||||
})
|
||||
scanAndBoard(
|
||||
@Param('qrCodeOrRef') qrCodeOrRef: string,
|
||||
@Req() req: any,
|
||||
@Body('validatorId') validatorId: string,
|
||||
@Body('gateId') gateId?: string,
|
||||
) {
|
||||
return this.service.scanAndBoard(qrCodeOrRef, validatorId, gateId);
|
||||
// `validatorId` still labels the gate/agent on the gate log; who is accountable for the
|
||||
// boarding comes from the JWT, which the body cannot influence.
|
||||
return this.service.scanAndBoard(qrCodeOrRef, validatorId, gateId, resolveActingUser(req));
|
||||
}
|
||||
|
||||
@Post(':bookingRef/validate')
|
||||
@@ -165,11 +169,12 @@ export class TicketsController {
|
||||
})
|
||||
validate(
|
||||
@Param('bookingRef') ref: string,
|
||||
@Req() req: any,
|
||||
@Body('validatorId') validatorId: string,
|
||||
@Body('gateId') gateId?: string,
|
||||
@Body('leg') leg?: string,
|
||||
) {
|
||||
return this.service.validate(ref, validatorId, gateId, leg);
|
||||
return this.service.validate(ref, validatorId, gateId, leg, resolveActingUser(req));
|
||||
}
|
||||
|
||||
@Get(':ticketId/validation-logs')
|
||||
@@ -216,8 +221,8 @@ export class TicketsController {
|
||||
},
|
||||
},
|
||||
})
|
||||
validateOfflineBatch(@Body() body: { validations: any[] }) {
|
||||
return this.service.validateOfflineBatch(body.validations);
|
||||
validateOfflineBatch(@Body() body: { validations: any[] }, @Req() req: any) {
|
||||
return this.service.validateOfflineBatch(body.validations, resolveActingUser(req));
|
||||
}
|
||||
|
||||
@Delete(':id')
|
||||
|
||||
Reference in New Issue
Block a user