tmp
This commit is contained in:
@@ -94,7 +94,7 @@ impl From<(Uuid, Uuid)> for Filter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
pub struct Id(pub Uuid);
|
pub struct Id(Uuid);
|
||||||
|
|
||||||
impl std::fmt::Display for Id {
|
impl std::fmt::Display for Id {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
@@ -102,6 +102,12 @@ impl std::fmt::Display for Id {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Id {
|
||||||
|
pub fn new(id: Uuid) -> Self {
|
||||||
|
Self(id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl From<(Uuid, Uuid)> for Id {
|
impl From<(Uuid, Uuid)> for Id {
|
||||||
fn from((_trip_id, todo_id): (Uuid, Uuid)) -> Self {
|
fn from((_trip_id, todo_id): (Uuid, Uuid)) -> Self {
|
||||||
Self(todo_id)
|
Self(todo_id)
|
||||||
@@ -902,7 +908,7 @@ impl crud::Toggle for StateUpdate {
|
|||||||
id: Self::Id,
|
id: Self::Id,
|
||||||
value: bool,
|
value: bool,
|
||||||
) -> Result<(), crate::Error> {
|
) -> Result<(), crate::Error> {
|
||||||
Todo::update(ctx, pool, filter, id, UpdateElement::State(value.into())).await?;
|
Todo::update(&ctx, &pool, filter, id, UpdateElement::State(value.into())).await?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -977,10 +983,10 @@ impl route::ToggleHtmx for StateUpdate {
|
|||||||
async fn response(
|
async fn response(
|
||||||
ctx: &Context,
|
ctx: &Context,
|
||||||
state: AppState,
|
state: AppState,
|
||||||
(trip_id, todo_id): (Uuid, Uuid),
|
(trip_id, todo_id): Self::UrlParams,
|
||||||
value: bool,
|
value: bool,
|
||||||
) -> Result<Response<BoxBody>, crate::Error> {
|
) -> Result<Response<BoxBody>, crate::Error> {
|
||||||
let todo_item = Todo::find(ctx, &state.database_pool, Filter { trip_id }, Id(todo_id))
|
let todo_item = Todo::find(&ctx, &state.database_pool, Filter { trip_id }, Id(todo_id))
|
||||||
.await?
|
.await?
|
||||||
.ok_or_else(|| {
|
.ok_or_else(|| {
|
||||||
crate::Error::Request(RequestError::NotFound {
|
crate::Error::Request(RequestError::NotFound {
|
||||||
|
|||||||
@@ -441,7 +441,7 @@ pub async fn trip(
|
|||||||
&ctx,
|
&ctx,
|
||||||
&state.database_pool,
|
&state.database_pool,
|
||||||
&todos::Filter { trip_id: id },
|
&todos::Filter { trip_id: id },
|
||||||
components::trips::todos::Id(delete_todo),
|
components::trips::todos::Id::new(delete_todo),
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user