feat(timesheets): implement role guards for timesheets
This commit is contained in:
parent
f1f765b350
commit
7ee87d8409
|
|
@ -16,8 +16,7 @@ export class ExpenseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Patch('update')
|
@Patch('update')
|
||||||
update(
|
update(@Body() body: { update :{ id: number; dto: updateExpenseDto }}): Promise<UpdateExpenseResult>{
|
||||||
@Body() body: { update :{ id: number; dto: updateExpenseDto }}): Promise<UpdateExpenseResult>{
|
|
||||||
return this.upsert_service.updateExpense(body.update);
|
return this.upsert_service.updateExpense(body.update);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,16 +14,7 @@ export class LeaveRequestController {
|
||||||
async upsertLeaveRequest(@Body() dto: UpsertLeaveRequestDto) {
|
async upsertLeaveRequest(@Body() dto: UpsertLeaveRequestDto) {
|
||||||
const { action, leave_requests } = await this.leave_service.handle(dto);
|
const { action, leave_requests } = await this.leave_service.handle(dto);
|
||||||
return { action, leave_requests };
|
return { action, leave_requests };
|
||||||
}q
|
}
|
||||||
|
|
||||||
//TODO:
|
|
||||||
/*
|
|
||||||
@Get('archive')
|
|
||||||
findAllArchived(){...}
|
|
||||||
|
|
||||||
@Get('archive/:id')
|
|
||||||
findOneArchived(id){...}
|
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,15 @@
|
||||||
import { Controller, Get, ParseIntPipe, Query, Req, UnauthorizedException} from "@nestjs/common";
|
import { Controller, Get, ParseIntPipe, Query, Req, UnauthorizedException} from "@nestjs/common";
|
||||||
|
import { RolesAllowed } from "src/common/decorators/roles.decorators";
|
||||||
import { GetTimesheetsOverviewService } from "src/time-and-attendance/time-tracker/timesheets/services/timesheet-get-overview.service";
|
import { GetTimesheetsOverviewService } from "src/time-and-attendance/time-tracker/timesheets/services/timesheet-get-overview.service";
|
||||||
|
import { Roles as RoleEnum } from '.prisma/client';
|
||||||
|
|
||||||
|
|
||||||
@Controller('timesheets')
|
@Controller('timesheets')
|
||||||
export class TimesheetController {
|
export class TimesheetController {
|
||||||
constructor( private readonly timesheetOverview: GetTimesheetsOverviewService ){}
|
constructor( private readonly timesheetOverview: GetTimesheetsOverviewService ){}
|
||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
|
@RolesAllowed(RoleEnum.SUPERVISOR, RoleEnum.HR, RoleEnum.ACCOUNTING, RoleEnum.ADMIN)
|
||||||
async getTimesheetByIds(
|
async getTimesheetByIds(
|
||||||
@Req() req,
|
@Req() req,
|
||||||
@Query('year', ParseIntPipe) year: number,
|
@Query('year', ParseIntPipe) year: number,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user