update routes

This commit is contained in:
2025-11-25 10:05:54 -03:00
parent d7fe03bd1f
commit de340a6d46
28 changed files with 152 additions and 84 deletions

View File

@@ -1,7 +1,8 @@
import type { Route } from './+types'
import type { Route } from './+types/route'
import { Suspense } from 'react'
import { Await, useSearchParams } from 'react-router'
import { MeiliSearchFilterBuilder } from 'meilisearch-helper'
import { DataTable } from '@repo/ui/components/data-table'
import { SearchForm } from '@repo/ui/components/search-form'
@@ -18,13 +19,16 @@ export function meta({}: Route.MetaArgs) {
export async function loader({ context, request }: Route.LoaderArgs) {
const { searchParams } = new URL(request.url)
const query = searchParams.get('q') || ''
const sort = searchParams.get('sort') || 'createDate:desc'
const page = Number(searchParams.get('p')) + 1
const hitsPerPage = Number(searchParams.get('perPage')) || 25
let builder = new MeiliSearchFilterBuilder().where('cnpj', 'exists', false)
const users = createSearch({
index: 'betaeducacao-prod-users_d2o3r5gmm4it7j',
sort: ['createDate:desc', 'create_date:desc'],
filter: 'cnpj NOT EXISTS',
filter: builder.build(),
sort: [sort],
query,
page,
hitsPerPage,