mirror of
https://github.com/yangshun/tech-interview-handbook.git
synced 2025-07-29 21:23:14 +08:00
[offers][chore] Change filter field from company name to company id
This commit is contained in:
@ -6,9 +6,10 @@ function Test() {
|
|||||||
const data = trpc.useQuery([
|
const data = trpc.useQuery([
|
||||||
'offers.list',
|
'offers.list',
|
||||||
{
|
{
|
||||||
limit: 5,
|
companyId: 'cl93patjt0003txewyiaky7xx',
|
||||||
|
limit: 2,
|
||||||
location: 'Singapore, Singapore',
|
location: 'Singapore, Singapore',
|
||||||
offset: 0,
|
offset: 3,
|
||||||
sortBy: '-monthYearReceived',
|
sortBy: '-monthYearReceived',
|
||||||
yoeCategory: 1,
|
yoeCategory: 1,
|
||||||
},
|
},
|
||||||
|
@ -32,7 +32,7 @@ const createSortByValidationRegex = () => {
|
|||||||
|
|
||||||
export const offersRouter = createRouter().query('list', {
|
export const offersRouter = createRouter().query('list', {
|
||||||
input: z.object({
|
input: z.object({
|
||||||
company: z.string().nullish(),
|
companyId: z.string().nullish(),
|
||||||
dateEnd: z.date().nullish(),
|
dateEnd: z.date().nullish(),
|
||||||
dateStart: z.date().nullish(),
|
dateStart: z.date().nullish(),
|
||||||
limit: z.number().nonnegative(),
|
limit: z.number().nonnegative(),
|
||||||
@ -91,6 +91,7 @@ export const offersRouter = createRouter().query('list', {
|
|||||||
})
|
})
|
||||||
: yoeRange.maxYoe
|
: yoeRange.maxYoe
|
||||||
? await ctx.prisma.offersOffer.findMany({
|
? await ctx.prisma.offersOffer.findMany({
|
||||||
|
// Junior, Mid
|
||||||
include: {
|
include: {
|
||||||
OffersFullTime: {
|
OffersFullTime: {
|
||||||
include: {
|
include: {
|
||||||
@ -112,7 +113,6 @@ export const offersRouter = createRouter().query('list', {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
// Junior, Mid
|
|
||||||
where: {
|
where: {
|
||||||
AND: [
|
AND: [
|
||||||
{
|
{
|
||||||
@ -204,8 +204,8 @@ export const offersRouter = createRouter().query('list', {
|
|||||||
data = data.filter((offer) => {
|
data = data.filter((offer) => {
|
||||||
let validRecord = true;
|
let validRecord = true;
|
||||||
|
|
||||||
if (input.company) {
|
if (input.companyId) {
|
||||||
validRecord = validRecord && offer.company.name === input.company;
|
validRecord = validRecord && offer.company.id === input.companyId;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (input.title) {
|
if (input.title) {
|
||||||
|
Reference in New Issue
Block a user