Skip to content

Commit a8decad

Browse files
committed
feat: remove street from application
1 parent 019c05f commit a8decad

4 files changed

Lines changed: 4 additions & 21 deletions

File tree

migrations/20251201155000_create_races_table.sql

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ CREATE TABLE races (
44
name TEXT NOT NULL,
55
miles REAL NOT NULL,
66
start_at DATETIME NOT NULL,
7-
street_address TEXT,
87
race_url TEXT,
98
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
109
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,

src/domain/race.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ pub struct Race {
1717
pub town_id: i64,
1818
pub name: String,
1919
pub miles: f64,
20-
pub street_address: Option<String>,
2120
pub race_url: Option<String>,
2221
pub start_at: chrono::NaiveDateTime,
2322
pub created_at: chrono::NaiveDateTime,
@@ -32,7 +31,6 @@ pub struct RaceView {
3231
pub town: String,
3332
pub county: String,
3433
pub miles: f64,
35-
pub street_address: Option<String>,
3634
pub race_url: Option<String>,
3735
pub start_at: chrono::NaiveDateTime,
3836
pub created_at: chrono::NaiveDateTime,
@@ -76,7 +74,6 @@ pub struct NewRaceForm {
7674
pub distance_unit: DistanceUnit,
7775
#[serde(deserialize_with = "parse_no_seconds")]
7876
pub start_at: NaiveDateTime,
79-
pub street_address: String,
8077
pub race_url: String,
8178
}
8279

@@ -85,7 +82,6 @@ pub struct NewRace {
8582
pub town_id: i64,
8683
pub miles: Miles,
8784
pub start_at: chrono::NaiveDateTime,
88-
pub street_address: Option<String>,
8985
pub race_url: Option<String>,
9086
}
9187

@@ -116,7 +112,6 @@ impl From<SubmitTown> for NewRace {
116112
town_id: form.town_id,
117113
miles,
118114
start_at: form.start_at,
119-
street_address: None,
120115
race_url: None,
121116
}
122117
}
@@ -133,7 +128,6 @@ impl From<NewRaceForm> for NewRace {
133128
town_id: form.town_id,
134129
miles,
135130
start_at: form.start_at,
136-
street_address: Some(form.street_address),
137131
race_url: Some(form.race_url),
138132
}
139133
}

src/infrastructure/db/race_repository.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ impl RaceRepository {
2828
pub async fn get_or_create(&self, race: NewRace) -> Result<RaceView, String> {
2929
let race_id: i64 = sqlx::query_scalar(
3030
r#"
31-
INSERT INTO races (town_id, name, miles, start_at, street_address, race_url)
32-
VALUES (?, LOWER(?), ?, ?, ?, ?)
31+
INSERT INTO races (town_id, name, miles, start_at, race_url)
32+
VALUES (?, LOWER(?), ?, ?, ?)
3333
ON CONFLICT(town_id, name, miles, start_at)
3434
DO UPDATE SET name = name
3535
RETURNING id
@@ -39,7 +39,6 @@ impl RaceRepository {
3939
.bind(race.name)
4040
.bind(race.miles.value())
4141
.bind(race.start_at)
42-
.bind(race.street_address)
4342
.bind(race.race_url)
4443
.fetch_one(self.db.as_ref())
4544
.await

templates/races/add_upcoming.html

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,6 @@ <h1>Add Race</h1>
4242
</select>
4343
</div>
4444
</div>
45-
<div class="form-control">
46-
<label for="street_address">Street Address</label>
47-
<input
48-
id="street_address"
49-
name="street_address"
50-
type="text"
51-
required
52-
autocomplete="off"
53-
placeholder="123 Main Street"
54-
/>
55-
</div>
5645
<div class="form-control">
5746
<label for="start_at">Start Date and Time</label>
5847
<input
@@ -62,6 +51,7 @@ <h1>Add Race</h1>
6251
min="{{ min_race_date }}"
6352
step="900"
6453
required
54+
autocomplete="off"
6555
/>
6656
</div>
6757
<div class="form-control">
@@ -72,6 +62,7 @@ <h1>Add Race</h1>
7262
type="text"
7363
placeholder="https://runsignup.com/your-race"
7464
required
65+
autocomplete="off"
7566
/>
7667
</div>
7768
</form>

0 commit comments

Comments
 (0)