Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
static async pages(args: any) {
console.log(args, 'query args ===================')
const options: FindManyOptions<article> = {
skip: args.page < 2 ? 0 : (args.page - 1) * args.pageSize,
take: args.pageSize,
order: {},
where: {
deletedAt: null
}
}
if(args.title) {
options.where['title'] = Like(`%${args.title}%`)
}
if(args.abstract) {
options.where['abstract'] = Like(`%${args.abstract}%`)
}
if(args.tag) {
options.where['tag'] = Like(`%${args.tag}%`)
}
if(args.createdAt) {
const date = args.createdAt.map((c: string) => (Moment(c)).valueOf())
options.where['createdAt'] = Between(date[0], date[1])
}
if(args.order) {
options.order = Object.assign(options.order, args.order)
}
console.log(options, '----options')
const pages = await getRepository(Article).findAndCount(options)
// .createQueryBuilder()
// .where({</article>
it('should return a filter', () => {
const fieldFilter = new FieldFilter(built, 'name', LookupFilter.CONTAINS, 'value');
fieldFilter.buildQuery();
expect(built['where']['name']).toEqual(Like('%value%'));
});
.end((err, res) => {
expect(JSON.parse(res.text)).toEqual({
where: {
name: 'rjlopezdev',
email: Like('%@gmail.com%')
},
skip: 0,
take: 25
});
done();
})
})
static async pages(args: any) {
console.log(args, 'query args ===================')
const options: FindManyOptions<article> = {
skip: args.page < 2 ? 0 : (args.page - 1) * args.pageSize,
take: args.pageSize,
order: {},
where: {
deletedAt: null
}
}
if(args.title) {
options.where['title'] = Like(`%${args.title}%`)
}
if(args.abstract) {
options.where['abstract'] = Like(`%${args.abstract}%`)
}
if(args.tag) {
options.where['tag'] = Like(`%${args.tag}%`)
}
if(args.createdAt) {
const date = args.createdAt.map((c: string) => (Moment(c)).valueOf())
options.where['createdAt'] = Between(date[0], date[1])
}
if(args.order) {
options.order = Object.assign(options.order, args.order)
}
console.log(options, '----options')
</article>
public async readTasks(req: Request, res: Response, next: NextFunction): Promise {
try {
const { title, term, status, assignee, author, tag, organization, branch } = req.query;
let where: FindConditions = {};
if (title && title.length) {
where = { ...where, title: Like(`%${title}%`) };
}
if (term && term.length) {
where = { ...where, description: Like(`%${term}%`) };
}
if (status) {
where = { ...where, status: { id: status } };
}
if (assignee) {
where = { ...where, assignee: { id: assignee } };
}
if (author) {
where = { ...where, author: { id: author } };
public async readTasks(req: Request, res: Response, next: NextFunction): Promise {
try {
const { title, term, status, assignee, author, tag, organization, branch } = req.query;
let where: FindConditions = {};
if (title && title.length) {
where = { ...where, title: Like(`%${title}%`) };
}
if (term && term.length) {
where = { ...where, description: Like(`%${term}%`) };
}
if (status) {
where = { ...where, status: { id: status } };
}
if (assignee) {
where = { ...where, assignee: { id: assignee } };
}
if (author) {
where = { ...where, author: { id: author } };
}
if (tag && tag.length) {
where = { ...where, tags: Like(`%${tag}%`) };
static async pages(args: any) {
const options: FindManyOptions = {
skip: args.page < 2 ? 0 : (args.page - 1) * args.pageSize,
take: args.pageSize,
order: {},
where: {
deletedAt: null
}
}
if(args.description) {
options.where['description'] = Like(`%${args.description}%`)
}
if(args.createdAt) {
const date = args.createdAt.map((c: string) => (Moment(c)).valueOf())
options.where['createdAt'] = Between(date[0], date[1])
}
if(args.order) {
options.order = Object.assign(options.order, args.order)
}
const pages = await getRepository('comment').findAndCount(options)
return pages
}
async findRecordsForRestore(multisigAddress: string): Promise {
return await this.find({ path: Like(`%${multisigAddress}`) });
}
}
findAll(lang: LanguageCode, filterTerm?: string): Promise>> {
const findOptions: FindManyOptions = {
relations: ['options'],
};
if (filterTerm) {
findOptions.where = {
code: Like(`%${filterTerm}%`),
};
}
return this.connection.manager
.find(ProductOptionGroup, findOptions)
.then(groups => groups.map(group => translateDeep(group, lang, ['options'])));
}
public async searchTaskByDescription(
req: Request,
res: Response,
next: NextFunction
): Promise {
try {
const { title, searchTerm, status, assignee, author, branch, closed } = req.query
let where = {}
if (title && title.length) {
where = { ...where, title: Like(`%${title}%`) }
}
if (searchTerm && searchTerm.length) {
where = { ...where, description: Like(`%${searchTerm}%`) }
}
if (status) {
where = { ...where, status: { id: status } }
}
if (assignee) {
where = { ...where, assignee: { id: assignee } }
}
if (author) {
where = { ...where, author: { id: author } }