Skip to content

Commit

Permalink
Merge pull request #171 from seanmorley15/development
Browse files Browse the repository at this point in the history
Mobile Optimization and Security Fixes
  • Loading branch information
seanmorley15 authored Aug 6, 2024
2 parents 5288439 + 304097f commit 290505d
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 20 deletions.
3 changes: 2 additions & 1 deletion backend/server/adventures/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class AdventureSerializer(serializers.ModelSerializer):
class Meta:
model = Adventure
fields = '__all__'
read_only_fields = ['id', 'created_at', 'updated_at', 'user_id']

def to_representation(self, instance):
representation = super().to_representation(instance)
Expand Down Expand Up @@ -205,4 +206,4 @@ class Meta:
model = Collection
# fields are all plus the adventures field
fields = ['id', 'description', 'user_id', 'name', 'is_public', 'adventures', 'created_at', 'start_date', 'end_date', 'transportations', 'notes', 'updated_at', 'checklists']
read_only_fields = ['id', 'created_at', 'updated_at']
read_only_fields = ['id', 'created_at', 'updated_at', 'user_id']
24 changes: 12 additions & 12 deletions backend/server/users/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,19 +105,19 @@ def save(self, request):
from django.conf import settings
import os

class AdventureSerializer(serializers.ModelSerializer):
image = serializers.SerializerMethodField()
# class AdventureSerializer(serializers.ModelSerializer):
# image = serializers.SerializerMethodField()

class Meta:
model = Adventure
fields = ['id', 'user_id', 'type', 'name', 'location', 'activity_types', 'description',
'rating', 'link', 'image', 'date', 'trip_id', 'is_public', 'longitude', 'latitude']
# class Meta:
# model = Adventure
# fields = ['id', 'user_id', 'type', 'name', 'location', 'activity_types', 'description',
# 'rating', 'link', 'image', 'date', 'trip_id', 'is_public', 'longitude', 'latitude']

def get_image(self, obj):
if obj.image:
public_url = os.environ.get('PUBLIC_URL', '')
return f'{public_url}/media/{obj.image.name}'
return None
# def get_image(self, obj):
# if obj.image:
# public_url = os.environ.get('PUBLIC_URL', '')
# return f'{public_url}/media/{obj.image.name}'
# return None

class UserDetailsSerializer(serializers.ModelSerializer):
"""
Expand Down Expand Up @@ -161,7 +161,7 @@ class Meta(UserDetailsSerializer.Meta):

model = UserModel
fields = ('pk', *extra_fields)
read_only_fields = ('email', 'date_joined', 'is_staff')
read_only_fields = ('email', 'date_joined', 'is_staff', 'is_superuser', 'is_active', 'pk')

class CustomUserDetailsSerializer(UserDetailsSerializer):

Expand Down
6 changes: 4 additions & 2 deletions backend/server/worldtravel/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@ def get_flag_url(self, obj):
class Meta:
model = Country
fields = '__all__' # Serialize all fields of the Adventure model
read_only_fields = ['id', 'name', 'country_code', 'continent', 'flag_url']

class RegionSerializer(serializers.ModelSerializer):
flag_url = ''
class Meta:
model = Region
fields = '__all__' # Serialize all fields of the Adventure model
read_only_fields = ['id', 'name', 'country']

class VisitedRegionSerializer(serializers.ModelSerializer):
class Meta:
model = VisitedRegion
fields = '__all__' # Serialize all fields of the Adventure model
fields = '__all__' # Serialize all fields of the Adventure model
read_only_fields = ['user_id', 'id']
4 changes: 2 additions & 2 deletions frontend/src/lib/components/ChecklistModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@
<!-- svelte-ignore a11y-no-noninteractive-element-interactions -->
<!-- svelte-ignore a11y-no-noninteractive-tabindex -->
<div class="modal-box" role="dialog" on:keydown={handleKeydown} tabindex="0">
<h3 class="font-bold text-lg">Checklist Editor</h3>
<h3 class="font-bold text-lg mb-2">Checklist Editor</h3>
{#if initialName}
<p class="font-semibold text-md mb-2">Editing note {initialName}</p>
<p class="font-semibold text-md mb-2">Editing checklist {initialName}</p>
{/if}

{#if (checklist && user?.pk == checklist?.user_id) || !checklist}
Expand Down
9 changes: 6 additions & 3 deletions frontend/src/lib/components/Navbar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
<!-- svelte-ignore a11y-no-noninteractive-tabindex -->
<ul
tabindex="0"
class="menu menu-sm dropdown-content mt-3 z-[1] p-2 shadow bg-base-100 rounded-box w-52 gap-2"
class="menu dropdown-content mt-3 z-[1] p-2 shadow bg-neutral text-neutral-content rounded-box gap-2 w-96"
>
{#if data.user}
<li>
Expand Down Expand Up @@ -109,7 +109,7 @@
/>
</svg>
</label>
<button on:click={searchGo} type="submit" class="btn btn-neutral">Search</button>
<button on:click={searchGo} type="submit" class="btn btn-primary">Search</button>
</form>
</ul>
</div>
Expand Down Expand Up @@ -174,7 +174,10 @@
<DotsHorizontal class="w-6 h-6" />
</div>
<!-- svelte-ignore a11y-no-noninteractive-tabindex -->
<ul tabindex="0" class="dropdown-content z-[1] menu p-2 shadow bg-base-100 rounded-box w-52">
<ul
tabindex="0"
class="dropdown-content bg-neutral text-neutral-content z-[1] menu p-2 shadow rounded-box w-52"
>
<button class="btn" on:click={() => (isAboutModalOpen = true)}>About AdventureLog</button>
<p class="font-bold m-4 text-lg">Theme Selection</p>
<form method="POST" use:enhance={submitUpdateTheme}>
Expand Down

0 comments on commit 290505d

Please sign in to comment.