add sqlite compatibility + fix whitespace bug collections

This commit is contained in:
Jordan Higuera Higuera
2023-08-03 21:33:51 -07:00
parent 264ea03e63
commit 22093c0c29
8 changed files with 130 additions and 67 deletions
-5
View File
@@ -66,7 +66,6 @@ export default async function getLink(userId: number, body: string) {
query.searchQuery && query.searchFilter?.name
? query.searchQuery
: undefined,
mode: "insensitive",
},
},
{
@@ -75,7 +74,6 @@ export default async function getLink(userId: number, body: string) {
query.searchQuery && query.searchFilter?.url
? query.searchQuery
: undefined,
mode: "insensitive",
},
},
{
@@ -84,7 +82,6 @@ export default async function getLink(userId: number, body: string) {
query.searchQuery && query.searchFilter?.description
? query.searchQuery
: undefined,
mode: "insensitive",
},
},
{
@@ -100,7 +97,6 @@ export default async function getLink(userId: number, body: string) {
query.searchQuery && query.searchFilter?.tags
? {
contains: query.searchQuery,
mode: "insensitive",
}
: undefined,
OR: [
@@ -114,7 +110,6 @@ export default async function getLink(userId: number, body: string) {
query.searchFilter?.tags
? query.searchQuery
: undefined,
mode: "insensitive",
},
collection: {
members: {
+5 -2
View File
@@ -20,12 +20,15 @@ export default async function postLink(
};
}
link.collection.name = link.collection.name.trim();
// This has to move above we assign link.collection.name
// Because if the link is null (write then delete text on collection)
// It will try to do trim on empty string and will throw and error, this prevents it.
if (!link.collection.name) {
link.collection.name = "Unnamed Collection";
}
link.collection.name = link.collection.name.trim();
if (link.collection.id) {
const collectionIsAccessible = (await getPermission(
userId,