Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 95 additions & 0 deletions apps/api/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@
"description": ""
}
},
"security": [
{
"bearer": []
}
],
"tags": ["employees"]
},
"post": {
Expand Down Expand Up @@ -172,6 +177,11 @@
"description": ""
}
},
"security": [
{
"bearer": []
}
],
"tags": ["employees"]
},
"put": {
Expand Down Expand Up @@ -1794,6 +1804,11 @@
"description": ""
}
},
"security": [
{
"bearer": []
}
],
"tags": ["requests"]
},
"post": {
Expand All @@ -1814,6 +1829,11 @@
"description": ""
}
},
"security": [
{
"bearer": []
}
],
"tags": ["requests"]
}
},
Expand All @@ -1835,6 +1855,11 @@
"description": ""
}
},
"security": [
{
"bearer": []
}
],
"tags": ["requests"]
}
},
Expand All @@ -1856,6 +1881,11 @@
"description": ""
}
},
"security": [
{
"bearer": []
}
],
"tags": ["requests"]
}
},
Expand All @@ -1878,6 +1908,11 @@
"description": ""
}
},
"security": [
{
"bearer": []
}
],
"tags": ["requests"]
}
},
Expand Down Expand Up @@ -1909,6 +1944,11 @@
"description": ""
}
},
"security": [
{
"bearer": []
}
],
"tags": ["requests"]
}
},
Expand Down Expand Up @@ -1940,6 +1980,11 @@
"description": ""
}
},
"security": [
{
"bearer": []
}
],
"tags": ["requests"]
}
},
Expand Down Expand Up @@ -1971,6 +2016,11 @@
"description": ""
}
},
"security": [
{
"bearer": []
}
],
"tags": ["requests"]
}
},
Expand Down Expand Up @@ -2002,6 +2052,11 @@
"description": ""
}
},
"security": [
{
"bearer": []
}
],
"tags": ["requests"]
}
},
Expand Down Expand Up @@ -2033,6 +2088,11 @@
"description": ""
}
},
"security": [
{
"bearer": []
}
],
"tags": ["requests"]
}
},
Expand Down Expand Up @@ -2064,6 +2124,11 @@
"description": ""
}
},
"security": [
{
"bearer": []
}
],
"tags": ["requests"]
}
},
Expand Down Expand Up @@ -2095,6 +2160,11 @@
"description": ""
}
},
"security": [
{
"bearer": []
}
],
"tags": ["requests"]
}
},
Expand Down Expand Up @@ -2126,6 +2196,11 @@
"description": ""
}
},
"security": [
{
"bearer": []
}
],
"tags": ["requests"]
}
},
Expand Down Expand Up @@ -2157,6 +2232,11 @@
"description": ""
}
},
"security": [
{
"bearer": []
}
],
"tags": ["requests"]
}
},
Expand Down Expand Up @@ -2188,6 +2268,11 @@
"description": ""
}
},
"security": [
{
"bearer": []
}
],
"tags": ["requests"]
}
},
Expand All @@ -2210,6 +2295,11 @@
"description": ""
}
},
"security": [
{
"bearer": []
}
],
"tags": ["requests"]
}
},
Expand All @@ -2232,6 +2322,11 @@
"description": ""
}
},
"security": [
{
"bearer": []
}
],
"tags": ["requests"]
}
},
Expand Down
29 changes: 16 additions & 13 deletions apps/api/src/app/employees/employees.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,16 @@ import {
} from './employees.dto';

@ApiTags('employees')
@ApiBearerAuth()
@UseGuards(JwtAuthGuard)
@Controller('employees')
export class EmployeesController {
constructor(private readonly employees: EmployeesService) {}

@Get()
list(@Query('includeInactive') includeInactive?: string): Promise<EmployeeDto[]> {
list(
@Query('includeInactive') includeInactive?: string,
): Promise<EmployeeDto[]> {
return this.employees.list({ includeInactive: includeInactive === 'true' });
}

Expand All @@ -40,16 +44,14 @@ export class EmployeesController {
}

@Post()
@ApiBearerAuth()
@UseGuards(JwtAuthGuard, RolesGuard)
@UseGuards(RolesGuard)
@Roles('HRAdmin')
create(@Body() dto: CreateEmployeeDto): Promise<EmployeeDto> {
return this.employees.create(dto);
}

@Put(':id')
@ApiBearerAuth()
@UseGuards(JwtAuthGuard, RolesGuard)
@UseGuards(RolesGuard)
@Roles('HRAdmin')
update(
@Param('id', new ParseUUIDPipe()) id: string,
Expand All @@ -59,8 +61,7 @@ export class EmployeesController {
}

@Post(':id/password')
@ApiBearerAuth()
@UseGuards(JwtAuthGuard, RolesGuard)
@UseGuards(RolesGuard)
@Roles('HRAdmin')
@HttpCode(HttpStatus.NO_CONTENT)
setPassword(
Expand All @@ -71,18 +72,20 @@ export class EmployeesController {
}

@Delete(':id')
@ApiBearerAuth()
@UseGuards(JwtAuthGuard, RolesGuard)
@UseGuards(RolesGuard)
@Roles('HRAdmin')
deactivate(@Param('id', new ParseUUIDPipe()) id: string): Promise<EmployeeDto> {
deactivate(
@Param('id', new ParseUUIDPipe()) id: string,
): Promise<EmployeeDto> {
return this.employees.deactivate(id);
}

@Post(':id/reactivate')
@ApiBearerAuth()
@UseGuards(JwtAuthGuard, RolesGuard)
@UseGuards(RolesGuard)
@Roles('HRAdmin')
reactivate(@Param('id', new ParseUUIDPipe()) id: string): Promise<EmployeeDto> {
reactivate(
@Param('id', new ParseUUIDPipe()) id: string,
): Promise<EmployeeDto> {
return this.employees.reactivate(id);
}
}
Loading