mirror of
https://github.com/yangshun/tech-interview-handbook.git
synced 2025-07-28 20:52:00 +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([
|
||||
'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) {
|
||||
|
Reference in New Issue
Block a user