summaryrefslogtreecommitdiffstats
path: root/rust
diff options
context:
space:
mode:
Diffstat (limited to 'rust')
-rw-r--r--rust/src/api_entity_crud.rs8
-rw-r--r--rust/src/api_wrappers.rs6
-rw-r--r--rust/src/database_models.rs4
-rw-r--r--rust/src/database_schema.rs14
4 files changed, 17 insertions, 15 deletions
diff --git a/rust/src/api_entity_crud.rs b/rust/src/api_entity_crud.rs
index cab6f58f..76fa9bba 100644
--- a/rust/src/api_entity_crud.rs
+++ b/rust/src/api_entity_crud.rs
@@ -72,8 +72,8 @@ where
ident: FatCatId,
limit: Option<i64>,
) -> Result<Vec<EntityHistoryEntry>>;
- fn db_get_edit(conn: &DbConn, edit_id: i64) -> Result<Self::EditRow>;
- fn db_delete_edit(conn: &DbConn, edit_id: i64) -> Result<()>;
+ fn db_get_edit(conn: &DbConn, edit_id: Uuid) -> Result<Self::EditRow>;
+ fn db_delete_edit(conn: &DbConn, edit_id: Uuid) -> Result<()>;
fn db_get_redirects(conn: &DbConn, ident: FatCatId) -> Result<Vec<FatCatId>>;
fn db_accept_edits(conn: &DbConn, editgroup_id: FatCatId) -> Result<u64>;
@@ -368,7 +368,7 @@ macro_rules! generic_db_get_history {
macro_rules! generic_db_get_edit {
($edit_table:ident) => {
- fn db_get_edit(conn: &DbConn, edit_id: i64) -> Result<Self::EditRow> {
+ fn db_get_edit(conn: &DbConn, edit_id: Uuid) -> Result<Self::EditRow> {
Ok($edit_table::table.find(edit_id).first(conn)?)
}
};
@@ -377,7 +377,7 @@ macro_rules! generic_db_get_edit {
macro_rules! generic_db_delete_edit {
($edit_table:ident) => {
/// This method assumes the connection is already in a transaction
- fn db_delete_edit(conn: &DbConn, edit_id: i64) -> Result<()> {
+ fn db_delete_edit(conn: &DbConn, edit_id: Uuid) -> Result<()> {
// ensure that edit hasn't been accepted
let accepted_rows: Vec<(EditgroupRow, ChangelogRow, Self::EditRow)> = editgroup::table
.inner_join(changelog::table)
diff --git a/rust/src/api_wrappers.rs b/rust/src/api_wrappers.rs
index aa168076..cf696d15 100644
--- a/rust/src/api_wrappers.rs
+++ b/rust/src/api_wrappers.rs
@@ -327,12 +327,13 @@ macro_rules! wrap_entity_handlers {
fn $get_edit_fn(
&self,
- edit_id: i64,
+ edit_id: String,
_context: &Context,
) -> Box<Future<Item = $get_edit_resp, Error = ApiError> + Send> {
let conn = self.db_pool.get().expect("db_pool error");
// No transaction for GET?
let ret = match (|| {
+ let edit_id = Uuid::from_str(&edit_id)?;
$model::db_get_edit(&conn, edit_id)?.into_model()
})() {
Ok(edit) =>
@@ -351,11 +352,12 @@ macro_rules! wrap_entity_handlers {
fn $delete_edit_fn(
&self,
- edit_id: i64,
+ edit_id: String,
_context: &Context,
) -> Box<Future<Item = $delete_edit_resp, Error = ApiError> + Send> {
let conn = self.db_pool.get().expect("db_pool error");
let ret = match conn.transaction(|| {
+ let edit_id = Uuid::from_str(&edit_id)?;
$model::db_delete_edit(&conn, edit_id)
}) {
Ok(()) =>
diff --git a/rust/src/database_models.rs b/rust/src/database_models.rs
index d2f6c3c2..fc5fc896 100644
--- a/rust/src/database_models.rs
+++ b/rust/src/database_models.rs
@@ -52,7 +52,7 @@ macro_rules! entity_structs {
#[derive(Debug, Queryable, Identifiable, Associations, AsChangeset, QueryableByName)]
#[table_name = $edit_table]
pub struct $edit_struct {
- pub id: i64,
+ pub id: Uuid,
pub editgroup_id: Uuid,
pub updated: chrono::NaiveDateTime,
pub ident_id: Uuid,
@@ -82,7 +82,7 @@ macro_rules! entity_structs {
redirect_ident: self.redirect_id.map(|v| uuid2fcid(&v)),
prev_revision: self.prev_rev.map(|v| v.to_string()),
ident: uuid2fcid(&self.ident_id),
- edit_id: self.id,
+ edit_id: self.id.to_string(),
extra: self.extra_json,
})
}
diff --git a/rust/src/database_schema.rs b/rust/src/database_schema.rs
index 5db14de5..2777696d 100644
--- a/rust/src/database_schema.rs
+++ b/rust/src/database_schema.rs
@@ -15,7 +15,7 @@ table! {
table! {
container_edit (id) {
- id -> Int8,
+ id -> Uuid,
editgroup_id -> Uuid,
updated -> Timestamptz,
ident_id -> Uuid,
@@ -50,7 +50,7 @@ table! {
table! {
creator_edit (id) {
- id -> Int8,
+ id -> Uuid,
editgroup_id -> Uuid,
updated -> Timestamptz,
ident_id -> Uuid,
@@ -104,7 +104,7 @@ table! {
table! {
file_edit (id) {
- id -> Int8,
+ id -> Uuid,
editgroup_id -> Uuid,
updated -> Timestamptz,
ident_id -> Uuid,
@@ -154,7 +154,7 @@ table! {
table! {
fileset_edit (id) {
- id -> Int8,
+ id -> Uuid,
editgroup_id -> Uuid,
updated -> Timestamptz,
ident_id -> Uuid,
@@ -224,7 +224,7 @@ table! {
table! {
release_edit (id) {
- id -> Int8,
+ id -> Uuid,
editgroup_id -> Uuid,
updated -> Timestamptz,
ident_id -> Uuid,
@@ -296,7 +296,7 @@ table! {
table! {
webcapture_edit (id) {
- id -> Int8,
+ id -> Uuid,
editgroup_id -> Uuid,
updated -> Timestamptz,
ident_id -> Uuid,
@@ -357,7 +357,7 @@ table! {
table! {
work_edit (id) {
- id -> Int8,
+ id -> Uuid,
editgroup_id -> Uuid,
updated -> Timestamptz,
ident_id -> Uuid,