Fix delete_by_uid (database) for controllers and schedules
This commit is contained in:
parent
6a6bb2a4ce
commit
ff4d3b9768
2 changed files with 8 additions and 6 deletions
|
|
@ -79,11 +79,12 @@ impl DbController {
|
|||
conn: &mut PoolConnection<Sqlite>,
|
||||
filter_uid: EmgauwaUid,
|
||||
) -> Result<(), DatabaseError> {
|
||||
if sqlx::query_scalar!("SELECT EXISTS (SELECT 1 FROM controllers WHERE uid = ?)", filter_uid)
|
||||
let exists = sqlx::query_scalar!("SELECT EXISTS (SELECT 1 FROM controllers WHERE uid = ?)", filter_uid)
|
||||
.fetch_optional(conn.deref_mut())
|
||||
.await?
|
||||
.is_none()
|
||||
{
|
||||
.unwrap_or(0);
|
||||
|
||||
if exists == 0 {
|
||||
return Err(DatabaseError::NotFound);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -78,11 +78,12 @@ impl DbSchedule {
|
|||
ScheduleUid::Any(_) => Ok(filter_uid),
|
||||
}?;
|
||||
|
||||
if sqlx::query_scalar!("SELECT EXISTS (SELECT 1 FROM schedules WHERE uid = ?)", filter_uid)
|
||||
let exists = sqlx::query_scalar!("SELECT EXISTS (SELECT 1 FROM schedules WHERE uid = ?)", filter_uid)
|
||||
.fetch_optional(conn.deref_mut())
|
||||
.await?
|
||||
.is_none()
|
||||
{
|
||||
.unwrap_or(0);
|
||||
|
||||
if exists == 0 {
|
||||
return Err(DatabaseError::NotFound);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue