Refactor user ID handling to use UUIDs; update related components and serializers for consistency

This commit is contained in:
Sean Morley
2024-11-17 16:34:46 -05:00
parent 129c76078e
commit 86d213bb8b
18 changed files with 78 additions and 46 deletions

View File

@@ -15,7 +15,6 @@
console.log(data);
let adventures: Adventure[] = data.props.adventures || [];
let categories: Category[] = data.props.categories || [];
let currentSort = {
order_by: '',
@@ -36,14 +35,13 @@
let typeString: string = '';
$: {
console.log(typeString);
if (typeof window !== 'undefined' && typeString) {
if (typeof window !== 'undefined') {
let url = new URL(window.location.href);
url.searchParams.set('types', typeString);
goto(url.toString(), { invalidateAll: true, replaceState: true });
} else if (typeof window !== 'undefined' && !typeString) {
let url = new URL(window.location.href);
url.searchParams.set('types', 'all');
if (typeString) {
url.searchParams.set('types', typeString);
} else {
url.searchParams.delete('types');
}
goto(url.toString(), { invalidateAll: true, replaceState: true });
}
}

View File

@@ -82,7 +82,7 @@
{/if}
{#if adventure}
{#if data.user && data.user.pk == adventure.user_id}
{#if data.user && data.user.uuid == adventure.user_id}
<div class="fixed bottom-4 right-4 z-[999]">
<button class="btn m-1 size-16 btn-primary" on:click={() => (isEditModalOpen = true)}
><ClipboardList class="w-8 h-8" /></button

View File

@@ -263,7 +263,7 @@
</div>
{/if}
{#if collection}
{#if data.user && !collection.is_archived}
{#if data.user && data.user.uuid && (data.user.uuid == collection.user_id || collection.shared_with.includes(data.user.uuid)) && !collection.is_archived}
<div class="fixed bottom-4 right-4 z-[999]">
<div class="flex flex-row items-center justify-center gap-4">
<div class="dropdown dropdown-top dropdown-end">
@@ -275,7 +275,7 @@
tabindex="0"
class="dropdown-content z-[1] menu p-4 shadow bg-base-300 text-base-content rounded-box w-52 gap-4"
>
{#if collection.user_id === data.user.pk}
{#if collection.user_id === data.user.uuid}
<p class="text-center font-bold text-lg">{$t('adventures.link_new')}</p>
<button
class="btn btn-primary"

View File

@@ -41,13 +41,13 @@
publicAdventures = data.props.adventures;
if (data.user?.pk != null) {
myAdventures = myAdventures.filter((adventure) => adventure.user_id === data.user?.pk);
myAdventures = myAdventures.filter((adventure) => adventure.user_id === data.user?.uuid);
} else {
myAdventures = [];
}
publicAdventures = publicAdventures.filter(
(adventure) => adventure.user_id !== data.user?.pk
(adventure) => adventure.user_id !== data.user?.uuid
);
if (data.props.osmData) {