|
|
@ -1,7 +1,10 @@
|
|
|
|
import { z } from 'zod';
|
|
|
|
import { z } from 'zod';
|
|
|
|
|
|
|
|
|
|
|
|
import type { FilterCounts } from '~/utils/resumes/resumeFilters';
|
|
|
|
import type { FilterCounts } from '~/utils/resumes/resumeFilters';
|
|
|
|
import { resumeGetFilterCounts } from '~/utils/resumes/resumeGetFilterCounts';
|
|
|
|
import {
|
|
|
|
|
|
|
|
getWhereClauseFilters,
|
|
|
|
|
|
|
|
resumeGetFilterCounts,
|
|
|
|
|
|
|
|
} from '~/utils/resumes/resumePrismaUtils';
|
|
|
|
|
|
|
|
|
|
|
|
import { createProtectedRouter } from '../context';
|
|
|
|
import { createProtectedRouter } from '../context';
|
|
|
|
|
|
|
|
|
|
|
@ -141,10 +144,12 @@ export const resumesResumeUserRouter = createProtectedRouter()
|
|
|
|
take,
|
|
|
|
take,
|
|
|
|
where: {
|
|
|
|
where: {
|
|
|
|
resume: {
|
|
|
|
resume: {
|
|
|
|
experience: { in: experienceFilters },
|
|
|
|
...getWhereClauseFilters(
|
|
|
|
|
|
|
|
experienceFilters,
|
|
|
|
|
|
|
|
roleFilters,
|
|
|
|
|
|
|
|
locationFilters,
|
|
|
|
|
|
|
|
),
|
|
|
|
isResolved: isUnreviewed ? false : {},
|
|
|
|
isResolved: isUnreviewed ? false : {},
|
|
|
|
locationId: { in: locationFilters },
|
|
|
|
|
|
|
|
role: { in: roleFilters },
|
|
|
|
|
|
|
|
title: { contains: searchValue, mode: 'insensitive' },
|
|
|
|
title: { contains: searchValue, mode: 'insensitive' },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
userId,
|
|
|
|
userId,
|
|
|
@ -177,10 +182,12 @@ export const resumesResumeUserRouter = createProtectedRouter()
|
|
|
|
totalRecords = await ctx.prisma.resumesStar.count({
|
|
|
|
totalRecords = await ctx.prisma.resumesStar.count({
|
|
|
|
where: {
|
|
|
|
where: {
|
|
|
|
resume: {
|
|
|
|
resume: {
|
|
|
|
experience: { in: experienceFilters },
|
|
|
|
...getWhereClauseFilters(
|
|
|
|
|
|
|
|
experienceFilters,
|
|
|
|
|
|
|
|
roleFilters,
|
|
|
|
|
|
|
|
locationFilters,
|
|
|
|
|
|
|
|
),
|
|
|
|
isResolved: isUnreviewed ? false : {},
|
|
|
|
isResolved: isUnreviewed ? false : {},
|
|
|
|
locationId: { in: locationFilters },
|
|
|
|
|
|
|
|
role: { in: roleFilters },
|
|
|
|
|
|
|
|
title: { contains: searchValue, mode: 'insensitive' },
|
|
|
|
title: { contains: searchValue, mode: 'insensitive' },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
userId,
|
|
|
|
userId,
|
|
|
@ -193,9 +200,8 @@ export const resumesResumeUserRouter = createProtectedRouter()
|
|
|
|
},
|
|
|
|
},
|
|
|
|
by: ['role'],
|
|
|
|
by: ['role'],
|
|
|
|
where: {
|
|
|
|
where: {
|
|
|
|
experience: { in: experienceFilters },
|
|
|
|
...getWhereClauseFilters(experienceFilters, [], locationFilters),
|
|
|
|
isResolved: isUnreviewed ? false : {},
|
|
|
|
isResolved: isUnreviewed ? false : {},
|
|
|
|
locationId: { in: locationFilters },
|
|
|
|
|
|
|
|
stars: {
|
|
|
|
stars: {
|
|
|
|
some: {
|
|
|
|
some: {
|
|
|
|
userId,
|
|
|
|
userId,
|
|
|
@ -214,9 +220,8 @@ export const resumesResumeUserRouter = createProtectedRouter()
|
|
|
|
},
|
|
|
|
},
|
|
|
|
by: ['experience'],
|
|
|
|
by: ['experience'],
|
|
|
|
where: {
|
|
|
|
where: {
|
|
|
|
|
|
|
|
...getWhereClauseFilters([], roleFilters, locationFilters),
|
|
|
|
isResolved: isUnreviewed ? false : {},
|
|
|
|
isResolved: isUnreviewed ? false : {},
|
|
|
|
locationId: { in: locationFilters },
|
|
|
|
|
|
|
|
role: { in: roleFilters },
|
|
|
|
|
|
|
|
stars: {
|
|
|
|
stars: {
|
|
|
|
some: {
|
|
|
|
some: {
|
|
|
|
userId,
|
|
|
|
userId,
|
|
|
@ -235,9 +240,8 @@ export const resumesResumeUserRouter = createProtectedRouter()
|
|
|
|
},
|
|
|
|
},
|
|
|
|
by: ['locationId'],
|
|
|
|
by: ['locationId'],
|
|
|
|
where: {
|
|
|
|
where: {
|
|
|
|
experience: { in: experienceFilters },
|
|
|
|
...getWhereClauseFilters(experienceFilters, roleFilters, []),
|
|
|
|
isResolved: isUnreviewed ? false : {},
|
|
|
|
isResolved: isUnreviewed ? false : {},
|
|
|
|
role: { in: roleFilters },
|
|
|
|
|
|
|
|
stars: {
|
|
|
|
stars: {
|
|
|
|
some: {
|
|
|
|
some: {
|
|
|
|
userId,
|
|
|
|
userId,
|
|
|
@ -328,10 +332,12 @@ export const resumesResumeUserRouter = createProtectedRouter()
|
|
|
|
skip: isTop10 ? 0 : skip,
|
|
|
|
skip: isTop10 ? 0 : skip,
|
|
|
|
take,
|
|
|
|
take,
|
|
|
|
where: {
|
|
|
|
where: {
|
|
|
|
experience: { in: experienceFilters },
|
|
|
|
...getWhereClauseFilters(
|
|
|
|
|
|
|
|
experienceFilters,
|
|
|
|
|
|
|
|
roleFilters,
|
|
|
|
|
|
|
|
locationFilters,
|
|
|
|
|
|
|
|
),
|
|
|
|
isResolved: isUnreviewed ? false : {},
|
|
|
|
isResolved: isUnreviewed ? false : {},
|
|
|
|
locationId: { in: locationFilters },
|
|
|
|
|
|
|
|
role: { in: roleFilters },
|
|
|
|
|
|
|
|
title: { contains: searchValue, mode: 'insensitive' },
|
|
|
|
title: { contains: searchValue, mode: 'insensitive' },
|
|
|
|
userId,
|
|
|
|
userId,
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -361,10 +367,12 @@ export const resumesResumeUserRouter = createProtectedRouter()
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
totalRecords = await ctx.prisma.resumesResume.count({
|
|
|
|
totalRecords = await ctx.prisma.resumesResume.count({
|
|
|
|
where: {
|
|
|
|
where: {
|
|
|
|
experience: { in: experienceFilters },
|
|
|
|
...getWhereClauseFilters(
|
|
|
|
|
|
|
|
experienceFilters,
|
|
|
|
|
|
|
|
roleFilters,
|
|
|
|
|
|
|
|
locationFilters,
|
|
|
|
|
|
|
|
),
|
|
|
|
isResolved: isUnreviewed ? false : {},
|
|
|
|
isResolved: isUnreviewed ? false : {},
|
|
|
|
locationId: { in: locationFilters },
|
|
|
|
|
|
|
|
role: { in: roleFilters },
|
|
|
|
|
|
|
|
title: { contains: searchValue, mode: 'insensitive' },
|
|
|
|
title: { contains: searchValue, mode: 'insensitive' },
|
|
|
|
userId,
|
|
|
|
userId,
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -376,9 +384,8 @@ export const resumesResumeUserRouter = createProtectedRouter()
|
|
|
|
},
|
|
|
|
},
|
|
|
|
by: ['role'],
|
|
|
|
by: ['role'],
|
|
|
|
where: {
|
|
|
|
where: {
|
|
|
|
experience: { in: experienceFilters },
|
|
|
|
...getWhereClauseFilters(experienceFilters, [], locationFilters),
|
|
|
|
isResolved: isUnreviewed ? false : {},
|
|
|
|
isResolved: isUnreviewed ? false : {},
|
|
|
|
locationId: { in: locationFilters },
|
|
|
|
|
|
|
|
title: { contains: searchValue, mode: 'insensitive' },
|
|
|
|
title: { contains: searchValue, mode: 'insensitive' },
|
|
|
|
userId,
|
|
|
|
userId,
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -393,9 +400,8 @@ export const resumesResumeUserRouter = createProtectedRouter()
|
|
|
|
},
|
|
|
|
},
|
|
|
|
by: ['experience'],
|
|
|
|
by: ['experience'],
|
|
|
|
where: {
|
|
|
|
where: {
|
|
|
|
|
|
|
|
...getWhereClauseFilters([], roleFilters, locationFilters),
|
|
|
|
isResolved: isUnreviewed ? false : {},
|
|
|
|
isResolved: isUnreviewed ? false : {},
|
|
|
|
locationId: { in: locationFilters },
|
|
|
|
|
|
|
|
role: { in: roleFilters },
|
|
|
|
|
|
|
|
title: { contains: searchValue, mode: 'insensitive' },
|
|
|
|
title: { contains: searchValue, mode: 'insensitive' },
|
|
|
|
userId,
|
|
|
|
userId,
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -410,9 +416,8 @@ export const resumesResumeUserRouter = createProtectedRouter()
|
|
|
|
},
|
|
|
|
},
|
|
|
|
by: ['locationId'],
|
|
|
|
by: ['locationId'],
|
|
|
|
where: {
|
|
|
|
where: {
|
|
|
|
experience: { in: experienceFilters },
|
|
|
|
...getWhereClauseFilters(experienceFilters, roleFilters, []),
|
|
|
|
isResolved: isUnreviewed ? false : {},
|
|
|
|
isResolved: isUnreviewed ? false : {},
|
|
|
|
role: { in: roleFilters },
|
|
|
|
|
|
|
|
title: { contains: searchValue, mode: 'insensitive' },
|
|
|
|
title: { contains: searchValue, mode: 'insensitive' },
|
|
|
|
userId,
|
|
|
|
userId,
|
|
|
|
},
|
|
|
|
},
|
|
|
|