allow creating all fields for new boats

This commit is contained in:
philipp 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
{

View File

@ -30,6 +30,8 @@
<label for="boatbuilder" class="sr-only">Boatbuilder</label>
<input type="text" name="boatbuilder" class="relative block rounded-md border-0 py-1.5 px-2 text-gray-900 ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:z-10 focus:ring-2 focus:ring-inset focus:ring-primary-600 sm:text-sm sm:leading-6 mb-2 md:mb-0" placeholder="Boatbuilder"/>
</div>
{{ macros::select(data=locations, label='location', select_name='location_id', selected_id=1) }}
{{ macros::select(data=users, label='users', select_name='owner', default="Vereinsboot") }}
<div>
default_shipmaster_only_steering:
<label for="default_shipmaster_only_steering" class="sr-only">default_shipmaster_only_steering</label>