mirror of
https://github.com/Nutomic/ibis.git
synced 2024-11-25 21:01:08 +00:00
remove dbedit.local
This commit is contained in:
parent
ef2f004b05
commit
851f30dc24
6 changed files with 1 additions and 11 deletions
|
@ -13,6 +13,5 @@ create table edit (
|
||||||
diff text not null,
|
diff text not null,
|
||||||
article_id int REFERENCES article ON UPDATE CASCADE ON DELETE CASCADE NOT NULL,
|
article_id int REFERENCES article ON UPDATE CASCADE ON DELETE CASCADE NOT NULL,
|
||||||
version text not null,
|
version text not null,
|
||||||
previous_version text not null,
|
previous_version text not null
|
||||||
local bool not null
|
|
||||||
)
|
)
|
|
@ -35,8 +35,6 @@ pub struct DbEdit {
|
||||||
pub version: EditVersion,
|
pub version: EditVersion,
|
||||||
// TODO: could be an Option<DbEdit.id> instead
|
// TODO: could be an Option<DbEdit.id> instead
|
||||||
pub previous_version: EditVersion,
|
pub previous_version: EditVersion,
|
||||||
// TODO: there is already `local` field on article, do we need this?
|
|
||||||
pub local: bool,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Insertable, AsChangeset)]
|
#[derive(Debug, Clone, Insertable, AsChangeset)]
|
||||||
|
@ -47,7 +45,6 @@ pub struct DbEditForm {
|
||||||
pub article_id: i32,
|
pub article_id: i32,
|
||||||
pub version: EditVersion,
|
pub version: EditVersion,
|
||||||
pub previous_version: EditVersion,
|
pub previous_version: EditVersion,
|
||||||
pub local: bool,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DbEditForm {
|
impl DbEditForm {
|
||||||
|
@ -64,7 +61,6 @@ impl DbEditForm {
|
||||||
article_id: original_article.id,
|
article_id: original_article.id,
|
||||||
version: EditVersion(hash),
|
version: EditVersion(hash),
|
||||||
previous_version,
|
previous_version,
|
||||||
local: true,
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,7 +102,6 @@ impl DbEdit {
|
||||||
article_id: article.id,
|
article_id: article.id,
|
||||||
version: self.version,
|
version: self.version,
|
||||||
previous_version: self.previous_version,
|
previous_version: self.previous_version,
|
||||||
local: true,
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,6 @@ diesel::table! {
|
||||||
article_id -> Int4,
|
article_id -> Int4,
|
||||||
version -> Text,
|
version -> Text,
|
||||||
previous_version -> Text,
|
previous_version -> Text,
|
||||||
local -> Bool,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,6 @@ pub async fn submit_article_update(
|
||||||
article_id: form.article_id,
|
article_id: form.article_id,
|
||||||
version: form.version,
|
version: form.version,
|
||||||
previous_version: form.previous_version,
|
previous_version: form.previous_version,
|
||||||
local: form.local,
|
|
||||||
};
|
};
|
||||||
let instance: DbInstance = original_article
|
let instance: DbInstance = original_article
|
||||||
.instance_id
|
.instance_id
|
||||||
|
|
|
@ -67,7 +67,6 @@ impl Object for DbEdit {
|
||||||
article_id: article.id,
|
article_id: article.id,
|
||||||
version: json.version,
|
version: json.version,
|
||||||
previous_version: json.previous_version,
|
previous_version: json.previous_version,
|
||||||
local: false,
|
|
||||||
};
|
};
|
||||||
let edit = DbEdit::create(&form, &data.db_connection)?;
|
let edit = DbEdit::create(&form, &data.db_connection)?;
|
||||||
Ok(edit)
|
Ok(edit)
|
||||||
|
|
|
@ -453,7 +453,6 @@ async fn test_fork_article() -> MyResult<()> {
|
||||||
assert_eq!(resolve_res.edits[0].diff, fork_res.edits[0].diff);
|
assert_eq!(resolve_res.edits[0].diff, fork_res.edits[0].diff);
|
||||||
assert_eq!(resolve_res.edits[0].version, fork_res.edits[0].version);
|
assert_eq!(resolve_res.edits[0].version, fork_res.edits[0].version);
|
||||||
assert_ne!(resolve_res.edits[0].id, fork_res.edits[0].id);
|
assert_ne!(resolve_res.edits[0].id, fork_res.edits[0].id);
|
||||||
assert!(fork_res.edits[0].local);
|
|
||||||
assert_eq!(resolve_res.latest_version, fork_res.latest_version);
|
assert_eq!(resolve_res.latest_version, fork_res.latest_version);
|
||||||
assert_ne!(resolved_article.ap_id, forked_article.ap_id);
|
assert_ne!(resolved_article.ap_id, forked_article.ap_id);
|
||||||
assert!(forked_article.local);
|
assert!(forked_article.local);
|
||||||
|
|
Loading…
Reference in a new issue