bug fix
This commit is contained in:
parent
9af7bab1db
commit
818b04b781
|
@ -9,7 +9,6 @@ type Props = {
|
|||
name: boolean;
|
||||
url: boolean;
|
||||
description: boolean;
|
||||
collection: boolean;
|
||||
tags: boolean;
|
||||
};
|
||||
};
|
||||
|
@ -53,16 +52,6 @@ export default function FilterSearchDropdown({
|
|||
})
|
||||
}
|
||||
/>
|
||||
<Checkbox
|
||||
label="Collection"
|
||||
state={searchFilter.collection}
|
||||
onClick={() =>
|
||||
setSearchFilter({
|
||||
...searchFilter,
|
||||
collection: !searchFilter.collection,
|
||||
})
|
||||
}
|
||||
/>
|
||||
<Checkbox
|
||||
label="Tags"
|
||||
state={searchFilter.tags}
|
||||
|
|
|
@ -41,6 +41,21 @@ export default async function getLink(userId: number, body: string) {
|
|||
}
|
||||
: undefined,
|
||||
where: {
|
||||
collection: {
|
||||
id: query.collectionId ? query.collectionId : undefined, // If collectionId was defined, filter by collection
|
||||
OR: [
|
||||
{
|
||||
ownerId: userId,
|
||||
},
|
||||
{
|
||||
members: {
|
||||
some: {
|
||||
userId,
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
[query.searchQuery ? "OR" : "AND"]: [
|
||||
{
|
||||
pinnedBy: query.pinnedOnly ? { some: { id: userId } } : undefined,
|
||||
|
@ -72,32 +87,6 @@ export default async function getLink(userId: number, body: string) {
|
|||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
{
|
||||
collection: {
|
||||
id: query.collectionId ? query.collectionId : undefined, // If collectionId was defined, filter by collection
|
||||
name:
|
||||
query.searchQuery && query.searchFilter?.collection
|
||||
? {
|
||||
contains: query.searchQuery,
|
||||
mode: "insensitive",
|
||||
}
|
||||
: undefined,
|
||||
OR: query.searchQuery
|
||||
? undefined
|
||||
: [
|
||||
{
|
||||
ownerId: userId,
|
||||
},
|
||||
{
|
||||
members: {
|
||||
some: {
|
||||
userId,
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
tags:
|
||||
query.searchQuery && !query.searchFilter?.tags
|
||||
|
|
|
@ -60,7 +60,6 @@ export type LinkSearchFilter = {
|
|||
name: boolean;
|
||||
url: boolean;
|
||||
description: boolean;
|
||||
collection: boolean;
|
||||
tags: boolean;
|
||||
};
|
||||
|
||||
|
|
Ŝarĝante…
Reference in New Issue