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