allow creating all fields for new boats

This commit is contained in:
2023-07-22 16:36:02 +02:00
parent 6f8ef42b87
commit b2f626f906
3 changed files with 19 additions and 6 deletions

View File

@ -72,20 +72,23 @@ ORDER BY amount_seats DESC
default_shipmaster_only_steering: bool,
skull: bool,
external: bool,
location_id: Option<i64>,
owner: Option<i64>,
) -> bool {
sqlx::query!(
"INSERT INTO boat(name, amount_seats, year_built, boatbuilder, default_shipmaster_only_steering, skull, external) VALUES (?,?,?,?,?,?,?)",
"INSERT INTO boat(name, amount_seats, year_built, boatbuilder, default_shipmaster_only_steering, skull, external, location_id, owner) VALUES (?,?,?,?,?,?,?,?,?)",
name,
amount_seats,
year_built,
boatbuilder,
default_shipmaster_only_steering,
skull,
external
external,
location_id,
owner
)
.execute(db)
.await
.is_ok()
.await.is_ok()
}
pub async fn update(
@ -167,7 +170,9 @@ mod test {
"Best Boatbuilder".into(),
true,
true,
false
false,
Some(1),
None
)
.await,
true
@ -187,7 +192,9 @@ mod test {
"Best Boatbuilder".into(),
true,
true,
false
false,
Some(1),
None
)
.await,
false

View File

@ -111,6 +111,8 @@ struct BoatAddForm<'r> {
default_shipmaster_only_steering: bool,
skull: bool,
external: bool,
location_id: Option<i64>,
owner: Option<i64>,
}
#[post("/boat/new", data = "<data>")]
@ -128,6 +130,8 @@ async fn create(
data.default_shipmaster_only_steering,
data.skull,
data.external,
data.location_id,
data.owner,
)
.await
{