aboutsummaryrefslogtreecommitdiffstats
path: root/rust
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-08-14 21:04:56 -0700
committerBryan Newbold <bnewbold@robocracy.org>2018-08-14 21:04:56 -0700
commitede30fef3e572b142dfde3b77b9642ccee841587 (patch)
treee6fe5553b7e148d9e00687cf9c0b76e1ef6a7d6d /rust
parent602d0ff2598b6ac15766689c925aff818c029615 (diff)
downloadfatcat-ede30fef3e572b142dfde3b77b9642ccee841587.tar.gz
fatcat-ede30fef3e572b142dfde3b77b9642ccee841587.zip
revert role_val change
Diffstat (limited to 'rust')
-rw-r--r--rust/migrations/2018-05-12-001226_init/up.sql4
-rw-r--r--rust/src/api_server.rs6
-rw-r--r--rust/src/database_models.rs4
-rw-r--r--rust/src/database_schema.rs2
4 files changed, 8 insertions, 8 deletions
diff --git a/rust/migrations/2018-05-12-001226_init/up.sql b/rust/migrations/2018-05-12-001226_init/up.sql
index 95efc9b8..542f8cca 100644
--- a/rust/migrations/2018-05-12-001226_init/up.sql
+++ b/rust/migrations/2018-05-12-001226_init/up.sql
@@ -272,7 +272,7 @@ CREATE TABLE release_contrib (
release_rev UUID REFERENCES release_rev(id) NOT NULL,
creator_ident_id UUID REFERENCES creator_ident(id),
raw_name TEXT,
- role_val TEXT, -- TODO: enum?
+ role TEXT, -- TODO: enum?
index_val BIGINT,
extra_json JSON
);
@@ -429,7 +429,7 @@ INSERT INTO release_rev_abstract (release_rev, abstract_sha1, mimetype, lang) VA
('00000000-0000-0000-4444-FFF000000001', '1ba86bf8c2979a62d29b18b537e50b2b093be27e', 'text/plain', 'en'),
('00000000-0000-0000-4444-FFF000000002', '0da908ab584b5e445a06beb172e3fab8cb5169e3', 'application/xml+jats', 'en');
-INSERT INTO release_contrib (release_rev, creator_ident_id, raw_name, role_val, index_val) VALUES
+INSERT INTO release_contrib (release_rev, creator_ident_id, raw_name, role, index_val) VALUES
('00000000-0000-0000-4444-FFF000000002', null, null, null, null),
('00000000-0000-0000-4444-FFF000000002', '00000000-0000-0000-2222-000000000002', 'some contrib', 'editor', 4),
('00000000-0000-0000-4444-FFF000000003', '00000000-0000-0000-2222-000000000003', 'John P. A. Ioannidis', 'author', 0);
diff --git a/rust/src/api_server.rs b/rust/src/api_server.rs
index 10587d08..de776238 100644
--- a/rust/src/api_server.rs
+++ b/rust/src/api_server.rs
@@ -216,14 +216,14 @@ fn release_row2entity(
let contribs: Vec<ReleaseContrib> = release_contrib::table
.filter(release_contrib::release_rev.eq(rev.id))
- .order((release_contrib::role_val.asc(), release_contrib::index_val.asc()))
+ .order((release_contrib::role.asc(), release_contrib::index_val.asc()))
.get_results(conn)
.expect("fetch release refs")
.into_iter()
.map(|c: ReleaseContribRow| ReleaseContrib {
index: c.index_val,
raw_name: c.raw_name,
- role: c.role_val,
+ role: c.role,
extra: c.extra_json,
creator_id: c.creator_ident_id.map(|v| uuid2fcid(&v)),
creator: None,
@@ -762,7 +762,7 @@ impl Server {
.map(|v| fcid2uuid(&v).expect("valid fatcat identifier")),
raw_name: c.raw_name.clone(),
index_val: c.index,
- role_val: c.role.clone(),
+ role: c.role.clone(),
extra_json: c.extra.clone(),
})
.collect();
diff --git a/rust/src/database_models.rs b/rust/src/database_models.rs
index c7da4de7..47e00bcf 100644
--- a/rust/src/database_models.rs
+++ b/rust/src/database_models.rs
@@ -227,7 +227,7 @@ pub struct ReleaseContribRow {
pub release_rev: Uuid,
pub creator_ident_id: Option<Uuid>,
pub raw_name: Option<String>,
- pub role_val: Option<String>,
+ pub role: Option<String>,
pub index_val: Option<i64>,
pub extra_json: Option<serde_json::Value>,
}
@@ -238,7 +238,7 @@ pub struct ReleaseContribNewRow {
pub release_rev: Uuid,
pub creator_ident_id: Option<Uuid>,
pub raw_name: Option<String>,
- pub role_val: Option<String>,
+ pub role: Option<String>,
pub index_val: Option<i64>,
pub extra_json: Option<serde_json::Value>,
}
diff --git a/rust/src/database_schema.rs b/rust/src/database_schema.rs
index d6084ab9..a6605d81 100644
--- a/rust/src/database_schema.rs
+++ b/rust/src/database_schema.rs
@@ -158,7 +158,7 @@ table! {
release_rev -> Uuid,
creator_ident_id -> Nullable<Uuid>,
raw_name -> Nullable<Text>,
- role_val -> Nullable<Text>,
+ role -> Nullable<Text>,
index_val -> Nullable<Int8>,
extra_json -> Nullable<Json>,
}