Release 202506091433
This commit is contained in:
@@ -333,6 +333,8 @@ const [categories, [services, totalServices], countCommunityOnly, attributes] =
|
|||||||
where,
|
where,
|
||||||
select: {
|
select: {
|
||||||
id: true,
|
id: true,
|
||||||
|
serviceVisibility: true,
|
||||||
|
verificationStatus: true,
|
||||||
...(Object.fromEntries(sortOptions.map((option) => [option.orderBy.key, true])) as Record<
|
...(Object.fromEntries(sortOptions.map((option) => [option.orderBy.key, true])) as Record<
|
||||||
(typeof sortOptions)[number]['orderBy']['key'],
|
(typeof sortOptions)[number]['orderBy']['key'],
|
||||||
true
|
true
|
||||||
@@ -354,10 +356,18 @@ const [categories, [services, totalServices], countCommunityOnly, attributes] =
|
|||||||
sortBy(unsortedServices, 'id'),
|
sortBy(unsortedServices, 'id'),
|
||||||
[
|
[
|
||||||
...(filters.q ? (['similarityScore'] as const) : ([] as const)),
|
...(filters.q ? (['similarityScore'] as const) : ([] as const)),
|
||||||
|
(service) => (service.verificationStatus === 'VERIFICATION_FAILED' ? 1 : 0),
|
||||||
|
(service) => (service.serviceVisibility === 'ARCHIVED' ? 1 : 0),
|
||||||
selectedSort.orderBy.key,
|
selectedSort.orderBy.key,
|
||||||
() => rng(),
|
() => rng(),
|
||||||
],
|
],
|
||||||
[...(filters.q ? (['desc'] as const) : ([] as const)), selectedSort.orderBy.direction, 'asc']
|
[
|
||||||
|
...(filters.q ? (['desc'] as const) : ([] as const)),
|
||||||
|
'asc',
|
||||||
|
'asc',
|
||||||
|
selectedSort.orderBy.direction,
|
||||||
|
'asc',
|
||||||
|
]
|
||||||
).slice((filters.page - 1) * PAGE_SIZE, filters.page * PAGE_SIZE)
|
).slice((filters.page - 1) * PAGE_SIZE, filters.page * PAGE_SIZE)
|
||||||
|
|
||||||
const unsortedServicesWithInfoMissingSimilarityScore = await prisma.service.findMany({
|
const unsortedServicesWithInfoMissingSimilarityScore = await prisma.service.findMany({
|
||||||
@@ -410,11 +420,19 @@ const [categories, [services, totalServices], countCommunityOnly, attributes] =
|
|||||||
unsortedServicesWithInfo,
|
unsortedServicesWithInfo,
|
||||||
[
|
[
|
||||||
...(filters.q ? (['similarityScore'] as const) : ([] as const)),
|
...(filters.q ? (['similarityScore'] as const) : ([] as const)),
|
||||||
|
(service) => (service.verificationStatus === 'VERIFICATION_FAILED' ? 1 : 0),
|
||||||
|
(service) => (service.serviceVisibility === 'ARCHIVED' ? 1 : 0),
|
||||||
selectedSort.orderBy.key,
|
selectedSort.orderBy.key,
|
||||||
// Now we can shuffle indeternimistically, because the pagination was already applied
|
// Now we can shuffle indeternimistically, because the pagination was already applied
|
||||||
() => Math.random(),
|
() => Math.random(),
|
||||||
],
|
],
|
||||||
[...(filters.q ? (['desc'] as const) : ([] as const)), selectedSort.orderBy.direction, 'asc']
|
[
|
||||||
|
...(filters.q ? (['desc'] as const) : ([] as const)),
|
||||||
|
'asc',
|
||||||
|
'asc',
|
||||||
|
selectedSort.orderBy.direction,
|
||||||
|
'asc',
|
||||||
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
return [sortedServicesWithInfo, totalServices] as const
|
return [sortedServicesWithInfo, totalServices] as const
|
||||||
|
|||||||
Reference in New Issue
Block a user