From f039fff630e72fa1ba513146e48a460ab6a17588 Mon Sep 17 00:00:00 2001 From: Jan Schutte <4732389+SchutteJan@users.noreply.github.com> Date: Wed, 24 Jul 2024 23:41:51 +0200 Subject: [PATCH] feat: include google_place_id in LocationResponse --- backend/src/db/locations.rs | 2 ++ backend/src/models/locations.rs | 2 ++ frontend/src/lib/BarItem.svelte | 45 ++++++++++++++++++++++----------- frontend/src/models/schemas.ts | 1 + 4 files changed, 35 insertions(+), 15 deletions(-) diff --git a/backend/src/db/locations.rs b/backend/src/db/locations.rs index 10f33c0..1b79ad5 100644 --- a/backend/src/db/locations.rs +++ b/backend/src/db/locations.rs @@ -20,6 +20,7 @@ pub async fn get_bars(conn: &DbConn) -> Result, Error> { id, name, description, + google_place_id, coordinates, imageurl, address_line, @@ -53,6 +54,7 @@ pub async fn get_bars_with_visits( locations::id, locations::name, locations::description, + locations::google_place_id, locations::coordinates, locations::imageurl, locations::address_line, diff --git a/backend/src/models/locations.rs b/backend/src/models/locations.rs index 464b8e9..bde5b41 100644 --- a/backend/src/models/locations.rs +++ b/backend/src/models/locations.rs @@ -28,6 +28,7 @@ pub struct LocationResponse { pub id: i32, pub name: String, pub description: Option, + pub google_place_id: Option, pub coordinates: Point, pub imageurl: Option, pub address_line: String, @@ -89,6 +90,7 @@ impl From<&Location> for LocationResponse { id: l.id, name: l.name.clone(), description: l.description.clone(), + google_place_id: l.google_place_id.clone(), coordinates: l.coordinates, imageurl: l.imageurl.clone(), visited_at: None, diff --git a/frontend/src/lib/BarItem.svelte b/frontend/src/lib/BarItem.svelte index 2df0a29..d5f0938 100644 --- a/frontend/src/lib/BarItem.svelte +++ b/frontend/src/lib/BarItem.svelte @@ -29,24 +29,39 @@ } -
- {bar.name} -
-

{bar.name}

+
+
+ + {bar.name} +
+

{bar.name}

-

- {bar.address_line} • - {bar.area_name ? bar.area_name : 'Unknown Area'} -

+

+ {bar.address_line} • + {bar.area_name ? bar.area_name : 'Unknown Area'} +

- {#if isLoggedIn} - {#if bar.visited_at} - + {#if isLoggedIn} + {#if bar.visited_at} + + {:else} + + {/if} + {/if} +
+
+
+

+ {#if bar.description} + {bar.description} {:else} - + No description available. {/if} - {/if} -

+

+ Open in Maps 🡵 +