[offers][chore] Change filter field from company name to company id

pull/373/head
BryannYeap 2 years ago
parent 08fb401c57
commit d1fa6c6170

@ -6,9 +6,10 @@ function Test() {
const data = trpc.useQuery([
'offers.list',
{
limit: 5,
companyId: 'cl93patjt0003txewyiaky7xx',
limit: 2,
location: 'Singapore, Singapore',
offset: 0,
offset: 3,
sortBy: '-monthYearReceived',
yoeCategory: 1,
},

@ -32,7 +32,7 @@ const createSortByValidationRegex = () => {
export const offersRouter = createRouter().query('list', {
input: z.object({
company: z.string().nullish(),
companyId: z.string().nullish(),
dateEnd: z.date().nullish(),
dateStart: z.date().nullish(),
limit: z.number().nonnegative(),
@ -91,6 +91,7 @@ export const offersRouter = createRouter().query('list', {
})
: yoeRange.maxYoe
? await ctx.prisma.offersOffer.findMany({
// Junior, Mid
include: {
OffersFullTime: {
include: {
@ -112,7 +113,6 @@ export const offersRouter = createRouter().query('list', {
},
},
},
// Junior, Mid
where: {
AND: [
{
@ -204,8 +204,8 @@ export const offersRouter = createRouter().query('list', {
data = data.filter((offer) => {
let validRecord = true;
if (input.company) {
validRecord = validRecord && offer.company.name === input.company;
if (input.companyId) {
validRecord = validRecord && offer.company.id === input.companyId;
}
if (input.title) {

Loading…
Cancel
Save