diff --git a/migrations/0014_remove_cafe_notes.sql b/migrations/0014_remove_cafe_notes.sql new file mode 100644 index 0000000..9554899 --- /dev/null +++ b/migrations/0014_remove_cafe_notes.sql @@ -0,0 +1 @@ +ALTER TABLE cafes DROP COLUMN notes; diff --git a/scripts/bootstrap-db.sh b/scripts/bootstrap-db.sh index ac3d8b2..df92615 100755 --- a/scripts/bootstrap-db.sh +++ b/scripts/bootstrap-db.sh @@ -426,8 +426,7 @@ fi --country "United Kingdom" \ --latitude 51.5055 \ --longitude -0.0910 \ - --website "https://www.monmouthcoffee.co.uk" \ - --notes "Iconic Borough Market cafe; queues around the block for a reason." + --website "https://www.monmouthcoffee.co.uk" # London - Prufrock Coffee ./target/debug/brewlog cafe add \ @@ -436,8 +435,7 @@ fi --country "United Kingdom" \ --latitude 51.5246 \ --longitude -0.1098 \ - --website "https://www.prufrockcoffee.com" \ - --notes "Award-winning Leather Lane cafe with stellar barista training programme." + --website "https://www.prufrockcoffee.com" # Madrid - Hola Coffee ./target/debug/brewlog cafe add \ @@ -446,8 +444,7 @@ fi --country "Spain" \ --latitude 40.4285 \ --longitude -3.7025 \ - --website "https://www.holacoffee.es" \ - --notes "Pioneering specialty coffee in the Malasaña neighbourhood." + --website "https://www.holacoffee.es" # Madrid - Toma Café ./target/debug/brewlog cafe add \ @@ -455,8 +452,7 @@ fi --city "Madrid" \ --country "Spain" \ --latitude 40.4260 \ - --longitude -3.7075 \ - --notes "Relaxed Malasaña spot known for excellent filter and warm atmosphere." + --longitude -3.7075 # Berlin - The Barn ./target/debug/brewlog cafe add \ @@ -465,8 +461,7 @@ fi --country "Germany" \ --latitude 52.5298 \ --longitude 13.4020 \ - --website "https://thebarn.de" \ - --notes "Light-roast pioneer in Prenzlauer Berg; their own roastery supplies the cafe." + --website "https://thebarn.de" # Berlin - Companion Coffee ./target/debug/brewlog cafe add \ @@ -475,8 +470,7 @@ fi --country "Germany" \ --latitude 52.4952 \ --longitude 13.4188 \ - --website "https://www.companion.coffee" \ - --notes "Minimalist Neukölln cafe with a curated rotating menu of guest roasters." + --website "https://www.companion.coffee" # Munich - Man Versus Machine ./target/debug/brewlog cafe add \ @@ -485,8 +479,7 @@ fi --country "Germany" \ --latitude 48.1310 \ --longitude 11.5690 \ - --website "https://www.mvsmcoffee.de" \ - --notes "Munich's specialty flagship; roasts in-house and competes internationally." + --website "https://www.mvsmcoffee.de" # Munich - Vits der Kaffee ./target/debug/brewlog cafe add \ @@ -495,8 +488,7 @@ fi --country "Germany" \ --latitude 48.1353 \ --longitude 11.5741 \ - --website "https://www.vfrischekaffee.de" \ - --notes "Modern cafe near Viktualienmarkt with thoughtful sourcing and seasonal offerings." + --website "https://www.vfrischekaffee.de" # Bristol - Full Court Press ./target/debug/brewlog cafe add \ @@ -505,8 +497,7 @@ fi --country "United Kingdom" \ --latitude 51.4543 \ --longitude -2.5930 \ - --website "https://www.fullcourtpress.coffee" \ - --notes "Bristol institution on Broad Street; brunch and specialty coffee done right." + --website "https://www.fullcourtpress.coffee" # Bristol - Small Street Espresso ./target/debug/brewlog cafe add \ @@ -514,8 +505,7 @@ fi --city "Bristol" \ --country "United Kingdom" \ --latitude 51.4540 \ - --longitude -2.5955 \ - --notes "Tiny takeaway bar with a cult following for its espresso and flat whites." + --longitude -2.5955 # ============================================================================ # Cups - 1 to 3 cups per cafe, pairing roasts with cafes visited diff --git a/src/application/routes/cafes.rs b/src/application/routes/cafes.rs index e84e885..c3aaced 100644 --- a/src/application/routes/cafes.rs +++ b/src/application/routes/cafes.rs @@ -156,8 +156,7 @@ pub(crate) async fn update_cafe( || payload.country.is_some() || payload.latitude.is_some() || payload.longitude.is_some() - || payload.website.is_some() - || payload.notes.is_some(); + || payload.website.is_some(); if !has_changes { return Err(AppError::validation("no changes provided").into()); diff --git a/src/domain/cafes.rs b/src/domain/cafes.rs index c25389c..7020cc6 100644 --- a/src/domain/cafes.rs +++ b/src/domain/cafes.rs @@ -14,7 +14,6 @@ pub struct Cafe { pub latitude: f64, pub longitude: f64, pub website: Option, - pub notes: Option, pub created_at: DateTime, pub updated_at: DateTime, } @@ -27,7 +26,6 @@ pub struct NewCafe { pub latitude: f64, pub longitude: f64, pub website: Option, - pub notes: Option, } impl NewCafe { @@ -36,7 +34,6 @@ impl NewCafe { self.city = self.city.trim().to_string(); self.country = self.country.trim().to_string(); self.website = normalize_optional_field(self.website); - self.notes = normalize_optional_field(self.notes); self } @@ -64,7 +61,6 @@ pub struct UpdateCafe { pub latitude: Option, pub longitude: Option, pub website: Option, - pub notes: Option, } #[derive(Debug, Clone, Copy, Eq, PartialEq)] diff --git a/src/infrastructure/backup.rs b/src/infrastructure/backup.rs index 00b2cc4..f7c623e 100644 --- a/src/infrastructure/backup.rs +++ b/src/infrastructure/backup.rs @@ -151,7 +151,7 @@ impl BackupService { async fn export_cafes(&self) -> anyhow::Result> { let records = sqlx::query_as::<_, CafeRecord>( - "SELECT id, name, slug, city, country, latitude, longitude, website, notes, created_at, updated_at FROM cafes ORDER BY id", + "SELECT id, name, slug, city, country, latitude, longitude, website, created_at, updated_at FROM cafes ORDER BY id", ) .fetch_all(&self.pool) .await @@ -350,7 +350,7 @@ impl BackupService { ) -> anyhow::Result<()> { for cafe in cafes { sqlx::query( - "INSERT INTO cafes (id, name, slug, city, country, latitude, longitude, website, notes, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", + "INSERT INTO cafes (id, name, slug, city, country, latitude, longitude, website, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", ) .bind(i64::from(cafe.id)) .bind(&cafe.name) @@ -360,7 +360,6 @@ impl BackupService { .bind(cafe.latitude) .bind(cafe.longitude) .bind(cafe.website.as_deref()) - .bind(cafe.notes.as_deref()) .bind(cafe.created_at) .bind(cafe.updated_at) .execute(&mut **tx) @@ -577,7 +576,6 @@ struct CafeRecord { latitude: f64, longitude: f64, website: Option, - notes: Option, created_at: DateTime, updated_at: DateTime, } @@ -593,7 +591,6 @@ impl CafeRecord { latitude: self.latitude, longitude: self.longitude, website: self.website, - notes: self.notes, created_at: self.created_at, updated_at: self.updated_at, } diff --git a/src/infrastructure/repositories/cafes.rs b/src/infrastructure/repositories/cafes.rs index 682ab87..e37f4a0 100644 --- a/src/infrastructure/repositories/cafes.rs +++ b/src/infrastructure/repositories/cafes.rs @@ -45,7 +45,6 @@ impl SqlCafeRepository { latitude, longitude, website, - notes, created_at, updated_at, } = record; @@ -59,7 +58,6 @@ impl SqlCafeRepository { latitude, longitude, website, - notes, created_at, updated_at, } @@ -115,8 +113,8 @@ impl CafeRepository for SqlCafeRepository { let now = Utc::now(); let record = query_as::<_, CafeRecord>( - "INSERT INTO cafes (name, slug, city, country, latitude, longitude, website, notes, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\ - RETURNING id, name, slug, city, country, latitude, longitude, website, notes, created_at, updated_at", + "INSERT INTO cafes (name, slug, city, country, latitude, longitude, website, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)\ + RETURNING id, name, slug, city, country, latitude, longitude, website, created_at, updated_at", ) .bind(&new_cafe.name) .bind(&slug) @@ -125,7 +123,6 @@ impl CafeRepository for SqlCafeRepository { .bind(new_cafe.latitude) .bind(new_cafe.longitude) .bind(new_cafe.website.as_deref()) - .bind(new_cafe.notes.as_deref()) .bind(now) .bind(now) .fetch_one(&mut *tx) @@ -170,7 +167,7 @@ impl CafeRepository for SqlCafeRepository { async fn get(&self, id: CafeId) -> Result { let record = query_as::<_, CafeRecord>( - "SELECT id, name, slug, city, country, latitude, longitude, website, notes, created_at, updated_at FROM cafes WHERE id = ?", + "SELECT id, name, slug, city, country, latitude, longitude, website, created_at, updated_at FROM cafes WHERE id = ?", ) .bind(i64::from(id)) .fetch_optional(&self.pool) @@ -185,7 +182,7 @@ impl CafeRepository for SqlCafeRepository { async fn get_by_slug(&self, slug: &str) -> Result { let record = query_as::<_, CafeRecord>( - "SELECT id, name, slug, city, country, latitude, longitude, website, notes, created_at, updated_at FROM cafes WHERE slug = ?", + "SELECT id, name, slug, city, country, latitude, longitude, website, created_at, updated_at FROM cafes WHERE slug = ?", ) .bind(slug) .fetch_optional(&self.pool) @@ -206,7 +203,7 @@ impl CafeRepository for SqlCafeRepository { use crate::infrastructure::repositories::pagination::SearchFilter; let order_clause = Self::order_clause(request); - let base_query = "SELECT id, name, slug, city, country, latitude, longitude, website, notes, created_at, updated_at FROM cafes"; + let base_query = "SELECT id, name, slug, city, country, latitude, longitude, website, created_at, updated_at FROM cafes"; let count_query = "SELECT COUNT(*) FROM cafes"; let sf = search.and_then(|t| SearchFilter::new(t, vec!["name", "city", "country"])); @@ -232,7 +229,6 @@ impl CafeRepository for SqlCafeRepository { push_update_field!(builder, sep, "latitude", changes.latitude); push_update_field!(builder, sep, "longitude", changes.longitude); push_update_field!(builder, sep, "website", changes.website); - push_update_field!(builder, sep, "notes", changes.notes); let _ = sep; builder.push(" WHERE id = "); @@ -276,7 +272,6 @@ struct CafeRecord { latitude: f64, longitude: f64, website: Option, - notes: Option, created_at: DateTime, updated_at: DateTime, } diff --git a/src/presentation/cli/cafes.rs b/src/presentation/cli/cafes.rs index 59e342b..18f7eec 100644 --- a/src/presentation/cli/cafes.rs +++ b/src/presentation/cli/cafes.rs @@ -45,8 +45,6 @@ pub struct AddCafeCommand { pub longitude: f64, #[arg(long)] pub website: Option, - #[arg(long)] - pub notes: Option, } pub async fn add_cafe(client: &BrewlogClient, command: AddCafeCommand) -> Result<()> { @@ -57,7 +55,6 @@ pub async fn add_cafe(client: &BrewlogClient, command: AddCafeCommand) -> Result latitude: command.latitude, longitude: command.longitude, website: command.website, - notes: command.notes, }; let cafe = client.cafes().create(&payload).await?; @@ -87,8 +84,6 @@ pub struct UpdateCafeCommand { pub longitude: Option, #[arg(long)] pub website: Option, - #[arg(long)] - pub notes: Option, } pub async fn update_cafe(client: &BrewlogClient, command: UpdateCafeCommand) -> Result<()> { @@ -99,7 +94,6 @@ pub async fn update_cafe(client: &BrewlogClient, command: UpdateCafeCommand) -> latitude: command.latitude, longitude: command.longitude, website: command.website, - notes: command.notes, }; let cafe = client diff --git a/src/presentation/web/views/cafes.rs b/src/presentation/web/views/cafes.rs index 49413e0..db8c09a 100644 --- a/src/presentation/web/views/cafes.rs +++ b/src/presentation/web/views/cafes.rs @@ -12,7 +12,6 @@ pub struct CafeView { pub has_website: bool, pub website_url: String, pub website_label: String, - pub notes: String, pub created_at: String, pub created_at_sort_key: i64, } @@ -28,7 +27,6 @@ impl From for CafeView { latitude, longitude, website, - notes, created_at, updated_at: _, } = cafe; @@ -53,7 +51,6 @@ impl From for CafeView { has_website, website_url: website.clone(), website_label: website, - notes: notes.unwrap_or_else(|| "This cafe has no notes yet.".to_string()), created_at: created_at_label, created_at_sort_key, } diff --git a/templates/cafe_detail.html b/templates/cafe_detail.html index ff9ee99..5c7752c 100644 --- a/templates/cafe_detail.html +++ b/templates/cafe_detail.html @@ -68,6 +68,5 @@ block content %}
{{ cafe.created_at }}
-

{{ cafe.notes }}

{% endblock %} diff --git a/templates/cafes.html b/templates/cafes.html index 42982b9..9c396a6 100644 --- a/templates/cafes.html +++ b/templates/cafes.html @@ -312,15 +312,6 @@ placeholder="-122.4194" /> -