From c9c30fbd83e2bb018da3dd6c6919f8ad1217d029 Mon Sep 17 00:00:00 2001 From: white Date: Thu, 30 May 2024 11:29:30 +0200 Subject: [PATCH] feat: check ability --- api/src/timeslots/timeslots.controller.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/api/src/timeslots/timeslots.controller.ts b/api/src/timeslots/timeslots.controller.ts index 90c5b84..6a3af4a 100644 --- a/api/src/timeslots/timeslots.controller.ts +++ b/api/src/timeslots/timeslots.controller.ts @@ -6,6 +6,8 @@ import { ApiUnauthorizedResponse, } from '@nestjs/swagger'; import { TimeSlot } from './timeslot.entity'; +import { CheckPolicies } from 'src/authorization/check-policies.decorator'; +import { Action } from '@hkrecruitment/shared'; @ApiBearerAuth() @ApiTags('timeslots') @@ -14,6 +16,7 @@ export class TimeSlotsController { constructor(private readonly timeSlotsService: TimeSlotsService) {} @ApiUnauthorizedResponse() + @CheckPolicies((ability) => ability.can(Action.Read, 'TimeSlot')) @Get() async findAvailableTimeSlots(): Promise { return await this.timeSlotsService.findAvailableTimeSlots();