Skip to content

Commit

Permalink
feat: check ability
Browse files Browse the repository at this point in the history
  • Loading branch information
whiitex committed May 30, 2024
1 parent 1afe269 commit c9c30fb
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions api/src/timeslots/timeslots.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -14,6 +16,7 @@ export class TimeSlotsController {
constructor(private readonly timeSlotsService: TimeSlotsService) {}

@ApiUnauthorizedResponse()
@CheckPolicies((ability) => ability.can(Action.Read, 'TimeSlot'))
@Get()
async findAvailableTimeSlots(): Promise<TimeSlot[]> {
return await this.timeSlotsService.findAvailableTimeSlots();
Expand Down

0 comments on commit c9c30fb

Please sign in to comment.