From ddedc4e9599591a42bc505ce4595a41c95f6cbe1 Mon Sep 17 00:00:00 2001 From: David Costa Date: Tue, 2 Mar 2021 13:29:13 -0300 Subject: [PATCH 1/2] add examples of deploy on env --- .env.example | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.env.example b/.env.example index bf6d213..e78c560 100644 --- a/.env.example +++ b/.env.example @@ -1,6 +1,11 @@ PORT=5000 DATABASE_URL="postgresql://root:123@localhost:5432/withmoney_dev?schema=public" +DEPLOY_NAME=api.withmoney +DEPLOY_USER=username +DEPLOY_HOST=host +DEPLOY_PATH=/var/www/api.withmoney.me + SECRET_SALT=9 SECRET_KEY=onemoretime From 2d9d14399626b2bf57b2f22d8e018bc5db2f607b Mon Sep 17 00:00:00 2001 From: David Costa Date: Tue, 2 Mar 2021 13:58:26 -0300 Subject: [PATCH 2/2] fix: category search --- src/types/Category/queries/findMany.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/types/Category/queries/findMany.ts b/src/types/Category/queries/findMany.ts index d3f8cf9..2a9e552 100644 --- a/src/types/Category/queries/findMany.ts +++ b/src/types/Category/queries/findMany.ts @@ -1,4 +1,5 @@ import { queryField, arg, nonNull, list } from '@nexus/schema'; +import { NexusGenInputs } from '../../../generated/nexus'; import { getUserId } from '../../../utils'; export const CategoryFindManyQuery = queryField('findManyCategory', { @@ -13,10 +14,22 @@ export const CategoryFindManyQuery = queryField('findManyCategory', { resolve: async (_parent, args, ctx) => { const userId = await getUserId(ctx); + let where: NexusGenInputs['OperationWhereInput'] | null = {}; + + if (args.where.name.contains) { + where = { + ...args.where, + name: { + contains: args.where.name.contains, + mode: 'insensitive', + }, + }; + } + const data = await ctx.prisma.category.findMany({ ...args, where: { - ...args.where, + ...where, userId, }, }); @@ -24,7 +37,7 @@ export const CategoryFindManyQuery = queryField('findManyCategory', { const pagination = { totalItems: await ctx.prisma.category.count({ where: { - ...args.where, + ...where, userId, }, }),