Update collab permission tests and minor fixes

This commit is contained in:
thiloho
2024-09-06 16:08:34 +02:00
parent a77d2b2d0c
commit b8d23eab00
16 changed files with 804 additions and 610 deletions

View File

@@ -5,33 +5,16 @@ import { join } from "node:path";
export const load: PageServerLoad = async ({ fetch, cookies, url, locals }) => {
const searchQuery = url.searchParams.get("website_search_query");
const sortBy = url.searchParams.get("website_sort");
const filterBy = url.searchParams.get("website_filter");
const params = new URLSearchParams();
const baseFetchUrl = `${API_BASE_PREFIX}/website`;
const baseFetchUrl = `${API_BASE_PREFIX}/website?order=last_modified_at.desc,created_at.desc`;
if (searchQuery) {
params.append("title_search", `wfts(english).${searchQuery}`);
}
switch (sortBy) {
case null:
case "creation-time":
params.append("order", "created_at.desc");
break;
case "last-modified":
params.append("order", "last_modified_at.desc");
break;
case "title-a-to-z":
params.append("order", "title.asc");
break;
case "title-z-to-a":
params.append("order", "title.desc");
break;
}
switch (filterBy) {
case "creations":
params.append("user_id", `eq.${locals.user.id}`);
@@ -41,7 +24,7 @@ export const load: PageServerLoad = async ({ fetch, cookies, url, locals }) => {
break;
}
const constructedFetchUrl = `${baseFetchUrl}?${params.toString()}`;
const constructedFetchUrl = `${baseFetchUrl}&${params.toString()}`;
const totalWebsitesData = await fetch(baseFetchUrl, {
method: "HEAD",