summaryrefslogtreecommitdiffstats
path: root/rust
diff options
context:
space:
mode:
Diffstat (limited to 'rust')
-rw-r--r--rust/src/api_entity_crud.rs2
-rw-r--r--rust/src/database_models.rs3
2 files changed, 3 insertions, 2 deletions
diff --git a/rust/src/api_entity_crud.rs b/rust/src/api_entity_crud.rs
index 605c27ed..71c6c96e 100644
--- a/rust/src/api_entity_crud.rs
+++ b/rust/src/api_entity_crud.rs
@@ -289,7 +289,7 @@ macro_rules! generic_db_delete {
)
.into());
}
- if current.rev_id.is_none() {
+ if current.state()? == EntityState::Deleted {
return Err(ErrorKind::InvalidEntityStateTransform(
"entity was already deleted".to_string(),
)
diff --git a/rust/src/database_models.rs b/rust/src/database_models.rs
index 82088f28..d5daf9a4 100644
--- a/rust/src/database_models.rs
+++ b/rust/src/database_models.rs
@@ -11,6 +11,7 @@ use uuid::Uuid;
// Ugh. I thought the whole point was to *not* do this, but:
// https://github.com/diesel-rs/diesel/issues/1589
+#[derive(Clone, Copy, Debug, PartialEq)]
pub enum EntityState {
WorkInProgress,
Active(Uuid),
@@ -113,7 +114,7 @@ macro_rules! entity_structs {
(None, None) => Ok(EntityState::Deleted),
(Some(redir), rev) => Ok(EntityState::Redirect(redir, rev)),
(None, Some(rev)) => Ok(EntityState::Active(rev)),
- _ => bail!("Invalid EntityIdentRow state"),
+ //_ => bail!("Invalid EntityIdentRow state"),
}
}
}