Merge branch 'main' of gitlab.com:PhilippHofer/rot
This commit is contained in:
commit
4e47d6e419
@ -5,8 +5,7 @@
|
|||||||
## New large features
|
## New large features
|
||||||
### Logbuch
|
### Logbuch
|
||||||
Next:
|
Next:
|
||||||
- Make boats updateable (incl. rower + location)
|
- Start with CREATE for logbook
|
||||||
- Write tests for model/boat.rs
|
|
||||||
|
|
||||||
### Guest-Scheckbuch
|
### Guest-Scheckbuch
|
||||||
- guest_trip
|
- guest_trip
|
||||||
|
@ -72,20 +72,23 @@ ORDER BY amount_seats DESC
|
|||||||
default_shipmaster_only_steering: bool,
|
default_shipmaster_only_steering: bool,
|
||||||
skull: bool,
|
skull: bool,
|
||||||
external: bool,
|
external: bool,
|
||||||
|
location_id: Option<i64>,
|
||||||
|
owner: Option<i64>,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
sqlx::query!(
|
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,
|
name,
|
||||||
amount_seats,
|
amount_seats,
|
||||||
year_built,
|
year_built,
|
||||||
boatbuilder,
|
boatbuilder,
|
||||||
default_shipmaster_only_steering,
|
default_shipmaster_only_steering,
|
||||||
skull,
|
skull,
|
||||||
external
|
external,
|
||||||
|
location_id,
|
||||||
|
owner
|
||||||
)
|
)
|
||||||
.execute(db)
|
.execute(db)
|
||||||
.await
|
.await.is_ok()
|
||||||
.is_ok()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn update(
|
pub async fn update(
|
||||||
@ -167,7 +170,9 @@ mod test {
|
|||||||
"Best Boatbuilder".into(),
|
"Best Boatbuilder".into(),
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
false
|
false,
|
||||||
|
Some(1),
|
||||||
|
None
|
||||||
)
|
)
|
||||||
.await,
|
.await,
|
||||||
true
|
true
|
||||||
@ -187,7 +192,9 @@ mod test {
|
|||||||
"Best Boatbuilder".into(),
|
"Best Boatbuilder".into(),
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
false
|
false,
|
||||||
|
Some(1),
|
||||||
|
None
|
||||||
)
|
)
|
||||||
.await,
|
.await,
|
||||||
false
|
false
|
||||||
|
@ -111,6 +111,8 @@ struct BoatAddForm<'r> {
|
|||||||
default_shipmaster_only_steering: bool,
|
default_shipmaster_only_steering: bool,
|
||||||
skull: bool,
|
skull: bool,
|
||||||
external: bool,
|
external: bool,
|
||||||
|
location_id: Option<i64>,
|
||||||
|
owner: Option<i64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[post("/boat/new", data = "<data>")]
|
#[post("/boat/new", data = "<data>")]
|
||||||
@ -128,6 +130,8 @@ async fn create(
|
|||||||
data.default_shipmaster_only_steering,
|
data.default_shipmaster_only_steering,
|
||||||
data.skull,
|
data.skull,
|
||||||
data.external,
|
data.external,
|
||||||
|
data.location_id,
|
||||||
|
data.owner,
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
|
@ -30,6 +30,8 @@
|
|||||||
<label for="boatbuilder" class="sr-only">Boatbuilder</label>
|
<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"/>
|
<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>
|
</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>
|
<div>
|
||||||
default_shipmaster_only_steering:
|
default_shipmaster_only_steering:
|
||||||
<label for="default_shipmaster_only_steering" class="sr-only">default_shipmaster_only_steering</label>
|
<label for="default_shipmaster_only_steering" class="sr-only">default_shipmaster_only_steering</label>
|
||||||
|
Loading…
Reference in New Issue
Block a user