Open LamaEats opened 1 year ago
some thoughts in sql:
select *
from "Activity"
left join "User"
on "User"."activityId" = "Activity".id
left join "Goal"
on "Goal"."activityId" = "Activity".id
left join "Priority"
on "Goal"."priorityId" = "Priority".id
inner join (
VALUES ('dsagfsabgbt', ARRAY['cl6z1n4yd128323bhcpxhfguto', 'cl6yv5o0600433bd7h3czz21g'], ARRAY['2', '3'])
) as filter_query (id, issuers, priorities)
on ("Activity".id = any(filter_query.issuers) or filter_query.issuers is null) and "Priority".id = any(filter_query.priorities)
model GoalView { id String @id @default(cuid()) title? String issuer String[] sort: group: }
// ?filterId=1231
issuer: [4123, 1231]
issuer: [{ id: 124124 }]
// Raw SQL // row 1 with inner join of preset data const preset = { id: 1231 issuer: [4123, 1231] }
// row 2 prisma.goal.findMany({ where: { activityId: { in: preset.issuer } } })
interface PageViewContext { queryParams: { id?: string; issuer: string[]; sort: string[]; groupBy: string[]; }; viewPrams: { mode: list, kanban } }
Currently couple params are passed both in URL and via props. Could be simplified by using a cache or a context.
Ex.: https://github.com/taskany-inc/issues/blob/main/src/components/FilteredPage/FilteredPage.tsx#L73C9-L73C27 https://github.com/taskany-inc/issues/blob/main/src/hooks/useFiltersPreset.ts https://github.com/taskany-inc/issues/blob/main/src/hooks/useUrlFilterParams.ts