Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.getRepository(ContentType)
.save(
plainToClass(ContentType, { name: 'demo', title: 'Demo' })
);
const ctUser = await queryRunner.manager
.getRepository(ContentType)
.findOneOrFail({
where: {
name: 'user'
}
});
// create permissions
const readPermissions = await queryRunner.manager
.getRepository(Permission)
.save(
plainToClass(Permission, [
{
title: 'Can read demo',
name: 'read_demo',
contentType: ctNewEntity
},
{
title: 'Can read demos frame',
name: 'read_demos-frame',
contentType: ctUser
},
{
title: 'Can read demos page',
name: 'read_demos-page',
contentType: ctUser
}
])
async findAll(
@Req() req,
@Query('cur_page', new ParseIntWithDefaultPipe(1)) curPage,
@Query('per_page', new ParseIntWithDefaultPipe(10)) perPage,
@Query('q') q,
@Query('sort') sort,
@Query('project') project,
@Query('users') usersIds,
@Query('statuses') statusesNames
) {
try {
return plainToClass(
OutTasksDto,
await this.service.findAll(
{
curPage,
perPage,
q,
sort,
project,
usersIds: usersIds ? usersIds.split(',').filter(id => !isNaN(+id)).map(id => +id) : [],
statusesNames: statusesNames ? statusesNames.split(',').map(name => name.trim()) : []
},
req.user
)
);
} catch (error) {
throw error;
async update(@Param('id', new ParseIntPipe()) id, @Body() dto: InUserDto) {
try {
return plainToClass(
OutUserDto,
await this.service.update({
id,
item: await plainToClass(User, dto).setPassword(dto.password)
})
);
} catch (error) {
throw error;
}
}
@Roles('isSuperuser')
public static FROM_JSON(jsonObject: {}): Athenamessage {
return plainToClass(Athenamessage, jsonObject);
}
responseData: (data: any, action: ProviderActionEnum) => {
if (action === ProviderActionEnum.Delete) {
return true;
} else {
if (action === ProviderActionEnum.LoadAll) {
return plainToClass(ContentType, data.body.contentTypes);
} else {
return plainToClass(ContentType, data.body.contentType);
}
}
},
responsePaginationMeta: (data: any, action: ProviderActionEnum): PaginationMeta => {
static create(target: object): Carousel | Carousel[] {
return plainToClass(Carousel, target);
}
plainToClass(cls: ClassType, plain: Object) {
return plainToClass(cls, plain, { ignoreDecorators: true });
}
private mergeErrors(errors?: IShortValidationErrors, externalErrors?: IShortValidationErrors) {
public static FROM_JSON(jsonObject: {}): OAuthExchange {
return plainToClass(OAuthExchange, jsonObject);
}
async get() {
const { tray } = await new Request(this.session)
.setMethod('POST')
.setResource('storyTray')
.setBodyType('form')
.setData({})
.setData({
_uuid: this.session.uuid,
_csrftoken: this.session.CSRFToken,
supported_capabilities_new: JSON.stringify(SUPPORTED_CAPABILITIES),
})
.send();
return plainToClass(StoryTrayResponse, tray);
}
}
description: 'Description of project 1',
isPublic: true,
users: [uUser1]
})
);
const pProject1Statuses = await queryRunner.manager
.getRepository(Status1538225369404)
.save(
plainToClass(Status1538225369404, [
{ title: 'status 1 for project 1', name: 'p1s1', project: pProject1 },
{ title: 'status 2 for project 1', name: 'p1s2', project: pProject1 },
{ title: 'status 3 for project 1', name: 'p1s3', project: pProject1 }
])
);
const pProject1Tasks = await queryRunner.manager.getRepository(Task1538225369404).save(
plainToClass(Task1538225369404, [
{
title: 'Task 1 for project 1',
description: 'Task 1 of project 1',
project: pProject1,
openAt: new Date(),
status: pProject1Statuses[0]
},
{
title: 'Task 2 for project 1',
description: 'Task 2 of project 1',
project: pProject1,
openAt: new Date(),
closeAt: new Date(),
status: pProject1Statuses[1]
},
{