forked from Ruderverein-Donau-Linz/rowt
Merge branch 'fix-direct-add' into 'staging'
Fix direct add See merge request PhilippHofer/rot!107
This commit is contained in:
commit
bfd9178d82
@ -145,6 +145,20 @@ impl From<LogbookUpdateError> for LogbookCreateError {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Logbook {
|
impl Logbook {
|
||||||
|
pub async fn find_by_id_tx(db: &mut Transaction<'_, Sqlite>, id: i32) -> Option<Self> {
|
||||||
|
sqlx::query_as!(
|
||||||
|
Self,
|
||||||
|
"
|
||||||
|
SELECT id,boat_id,shipmaster,steering_person,shipmaster_only_steering,departure,arrival,destination,distance_in_km,comments,logtype
|
||||||
|
FROM logbook
|
||||||
|
WHERE id like ?
|
||||||
|
",
|
||||||
|
id
|
||||||
|
)
|
||||||
|
.fetch_one(db)
|
||||||
|
.await
|
||||||
|
.ok()
|
||||||
|
}
|
||||||
pub async fn find_by_id(db: &SqlitePool, id: i32) -> Option<Self> {
|
pub async fn find_by_id(db: &SqlitePool, id: i32) -> Option<Self> {
|
||||||
sqlx::query_as!(
|
sqlx::query_as!(
|
||||||
Self,
|
Self,
|
||||||
@ -273,7 +287,9 @@ ORDER BY departure DESC
|
|||||||
.fetch_one(&mut tx)
|
.fetch_one(&mut tx)
|
||||||
.await.unwrap().id;
|
.await.unwrap().id;
|
||||||
|
|
||||||
let logbook = Logbook::find_by_id(db, inserted_row as i32).await.unwrap(); //ok
|
let logbook = Logbook::find_by_id_tx(&mut tx, inserted_row as i32)
|
||||||
|
.await
|
||||||
|
.unwrap(); //ok
|
||||||
|
|
||||||
return match logbook
|
return match logbook
|
||||||
.home_with_transaction(&mut tx, created_by_user, log_to_finalize)
|
.home_with_transaction(&mut tx, created_by_user, log_to_finalize)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user