Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}),
);
} catch (error) {
throw error;
}
}
@Roles('isSuperuser')
@Permissions('delete_user')
@HttpCode(HttpStatus.NO_CONTENT)
@ApiResponse({
status: HttpStatus.NO_CONTENT,
description: 'The record has been successfully deleted.',
})
@ApiResponse({ status: HttpStatus.FORBIDDEN, description: 'Forbidden.' })
@ApiImplicitParam({ name: 'id', type: Number })
@Delete(':id')
async delete(@Param('id', new ParseIntPipe()) id) {
try {
return plainToClass(
OutUserDto,
await this.service.delete({
id,
}),
);
} catch (error) {
throw error;
}
}
@Roles('isSuperuser')
@Permissions('read_user')
);
} catch (error) {
throw error;
}
}
@Roles('isSuperuser')
@Permissions('read_user')
@HttpCode(HttpStatus.OK)
@ApiResponse({
status: HttpStatus.OK,
type: OutUserDto,
description: ''
})
@ApiResponse({ status: HttpStatus.FORBIDDEN, description: 'Forbidden.' })
@ApiImplicitParam({ name: 'id', type: Number })
@Get(':id')
async findById(@Param('id', new ParseIntPipe()) id) {
try {
return plainToClass(
OutUserDto,
await this.service.findById({
id
})
);
} catch (error) {
throw error;
}
}
@Roles('isSuperuser')
@Permissions('read_user')
)
);
} catch (error) {
throw error;
}
}
@Roles('isSuperuser')
@Permissions('delete_task')
@HttpCode(HttpStatus.NO_CONTENT)
@ApiResponse({
status: HttpStatus.NO_CONTENT,
description: 'The record has been successfully deleted.'
})
@ApiResponse({ status: HttpStatus.FORBIDDEN, description: 'Forbidden.' })
@ApiImplicitParam({ name: 'id', type: Number })
@Delete(':id')
async delete(@Req() req, @Param('id', new ParseIntPipe()) id) {
if (this.coreConfig.demo) {
throw new MethodNotAllowedException('Not allowed in DEMO mode');
}
try {
return plainToClass(
OutTaskDto,
await this.service.delete(
{
id
},
req.user
)
);
} catch (error) {
}),
);
} catch (error) {
throw error;
}
}
@Roles('isSuperuser')
@Permissions('delete_group')
@HttpCode(HttpStatus.NO_CONTENT)
@ApiResponse({
status: HttpStatus.NO_CONTENT,
description: 'The record has been successfully deleted.',
})
@ApiResponse({ status: HttpStatus.FORBIDDEN, description: 'Forbidden.' })
@ApiImplicitParam({ name: 'id', type: Number })
@Delete(':id')
async delete(@Param('id', new ParseIntPipe()) id) {
try {
return plainToClass(
OutGroupDto,
await this.service.delete({
id,
}),
);
} catch (error) {
throw error;
}
}
@Roles('isSuperuser')
@Permissions('read_group')
})
);
} catch (error) {
throw error;
}
}
@Roles('isSuperuser')
@Permissions('change_group')
@HttpCode(HttpStatus.OK)
@ApiResponse({
status: HttpStatus.OK,
type: OutGroupDto,
description: 'The record has been successfully updated.'
})
@ApiResponse({ status: HttpStatus.FORBIDDEN, description: 'Forbidden.' })
@ApiImplicitParam({ name: 'id', type: Number })
@Put(':id')
async update(@Param('id', new ParseIntPipe()) id, @Body() dto: InGroupDto) {
try {
return plainToClass(
OutGroupDto,
await this.service.update({
id,
item: plainToClass(Group, dto)
})
);
} catch (error) {
throw error;
}
}
@Roles('isSuperuser')
@Permissions('delete_group')
newWeapon(
@Body('weapon', WeaponPipe) inWeapon: DbWeapon,
@Param() params: CharacterIdParam
): Observable {
return this.weaponService.newWeapon(inWeapon, params.charId);
}
@Patch('update/:weaponId')
@ApiOperation({
title: 'Update Weapon',
description: 'Update the weapon saved in the database with the specified id'
})
@UseGuards(AuthGuard)
@ApiBearerAuth()
@ApiOkResponse({ type: DbWeapon })
@ApiImplicitParam({ name: 'weaponId', type: 'string', required: true })
@ApiImplicitBody({ name: 'weapon', type: WeaponDTO })
updateWeapon(
@Body('weapon', WeaponPipe) inWeapon: DbWeapon,
@Param() params: WeaponIdParam
): Observable {
return this.weaponService.updateWeapon(inWeapon);
}
}
object.id = id;
object = await this.contentTypeRepository.save(object);
return plainToClass(OutContentTypeDto, object);
} catch (error) {
throw error;
}
}
@Roles('isSuperuser')
@Permissions('delete_content-type')
@HttpCode(HttpStatus.NO_CONTENT)
@ApiResponse({
status: HttpStatus.NO_CONTENT,
description: 'The record has been successfully deleted.'
})
@ApiResponse({ status: HttpStatus.FORBIDDEN, description: 'Forbidden.' })
@ApiImplicitParam({ name: 'id', type: Number })
@Delete(':id')
async delete(
@Param('id', new ParseIntPipe()) id
) {
try {
return await this.contentTypeRepository.delete(id);
} catch (error) {
throw error;
}
}
@Roles('isSuperuser')
@Permissions('read_content-type')
@HttpCode(HttpStatus.OK)
@ApiResponse({
status: HttpStatus.OK, type: OutContentTypeDto,
description: ''
item: plainToClass(Permission, dto)
})
);
} catch (error) {
throw error;
}
}
@Roles('isSuperuser')
@Permissions('delete_permission')
@HttpCode(HttpStatus.NO_CONTENT)
@ApiResponse({
status: HttpStatus.NO_CONTENT,
description: 'The record has been successfully deleted.'
})
@ApiResponse({ status: HttpStatus.FORBIDDEN, description: 'Forbidden.' })
@ApiImplicitParam({ name: 'id', type: Number })
@Delete(':id')
async delete(@Param('id', new ParseIntPipe()) id) {
try {
return plainToClass(
OutPermissionDto,
await this.service.delete({
id
})
);
} catch (error) {
throw error;
}
}
@Roles('isSuperuser')
@Permissions('read_permission')
@HttpCode(HttpStatus.OK)