Skip to content

Commit

Permalink
Refactor: delete fuzzy and prefix search
Browse files Browse the repository at this point in the history
  • Loading branch information
sipec committed Nov 2, 2023
1 parent 6b5bd4b commit 55c542d
Show file tree
Hide file tree
Showing 12 changed files with 117 additions and 490 deletions.
7 changes: 4 additions & 3 deletions backend/api/src/supabase-search-contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,14 @@ export const searchContracts = async (
contractType,
offset,
limit,
fuzzy,
topicSlug: possibleTopicSlug,
creatorId,
} = validate(bodySchema, body)

if (limit === 0) {
return [] as unknown as Json
}

const isForYou = possibleTopicSlug === 'for-you'
const topicSlug =
possibleTopicSlug && !isForYou ? possibleTopicSlug : undefined
Expand All @@ -49,7 +52,6 @@ export const searchContracts = async (
contractType,
offset,
limit,
fuzzy,
groupId,
creatorId,
uid: userId,
Expand Down Expand Up @@ -112,7 +114,6 @@ const bodySchema = z
.default('ALL'),
offset: z.number().gte(0).default(0),
limit: z.number().gt(0).lte(1000).default(100),
fuzzy: z.boolean().optional(),
topicSlug: z.string().regex(FIRESTORE_DOC_REF_ID_REGEX).optional(),
creatorId: z.string().regex(FIRESTORE_DOC_REF_ID_REGEX).optional(),
})
Expand Down
Loading

0 comments on commit 55c542d

Please sign in to comment.