diff options
| author | Bryan Newbold <bnewbold@robocracy.org> | 2018-07-20 21:01:44 -0700 | 
|---|---|---|
| committer | Bryan Newbold <bnewbold@robocracy.org> | 2018-07-20 21:01:44 -0700 | 
| commit | f3243f752f4a1eaae8726674b1978d96ad8da2e4 (patch) | |
| tree | 7a9c75280fa1a0a45a11acf8af333e86fc9b4494 /rust | |
| parent | 67b83400633d16480b6842877d3ea11e7ae3fdc5 (diff) | |
| download | fatcat-f3243f752f4a1eaae8726674b1978d96ad8da2e4.tar.gz fatcat-f3243f752f4a1eaae8726674b1978d96ad8da2e4.zip | |
oops, forgot revisions should be UUID
Diffstat (limited to 'rust')
| -rw-r--r-- | rust/src/api_server.rs | 10 | ||||
| -rw-r--r-- | rust/src/database_models.rs | 2 | ||||
| -rw-r--r-- | rust/tests/test_api_server.rs | 11 | 
3 files changed, 17 insertions, 6 deletions
| diff --git a/rust/src/api_server.rs b/rust/src/api_server.rs index fa64bf7b..b260a98a 100644 --- a/rust/src/api_server.rs +++ b/rust/src/api_server.rs @@ -99,7 +99,7 @@ fn container_row2entity(          coden: rev.coden,          state: state,          ident: ident_id, -        revision: Some(uuid2fcid(&rev.id)), +        revision: Some(rev.id.to_string()),          redirect: redirect_id,          extra: rev.extra_json,          editgroup_id: None, @@ -122,7 +122,7 @@ fn creator_row2entity(ident: Option<CreatorIdentRow>, rev: CreatorRevRow) -> Res          orcid: rev.orcid,          state: state,          ident: ident_id, -        revision: Some(uuid2fcid(&rev.id)), +        revision: Some(rev.id.to_string()),          redirect: redirect_id,          editgroup_id: None,          extra: rev.extra_json, @@ -160,7 +160,7 @@ fn file_row2entity(          releases: Some(releases),          state: state,          ident: ident_id, -        revision: Some(uuid2fcid(&rev.id)), +        revision: Some(rev.id.to_string()),          redirect: redirect_id,          editgroup_id: None,          extra: rev.extra_json, @@ -232,7 +232,7 @@ fn release_row2entity(          contribs: Some(contribs),          state: state,          ident: ident_id, -        revision: Some(uuid2fcid(&rev.id)), +        revision: Some(rev.id.to_string()),          redirect: redirect_id,          editgroup_id: None,          extra: rev.extra_json, @@ -252,7 +252,7 @@ fn work_row2entity(ident: Option<WorkIdentRow>, rev: WorkRevRow) -> Result<WorkE          work_type: rev.work_type,          state: state,          ident: ident_id, -        revision: Some(uuid2fcid(&rev.id)), +        revision: Some(rev.id.to_string()),          redirect: redirect_id,          editgroup_id: None,          extra: rev.extra_json, diff --git a/rust/src/database_models.rs b/rust/src/database_models.rs index 79ff45fe..167d2fbe 100644 --- a/rust/src/database_models.rs +++ b/rust/src/database_models.rs @@ -54,7 +54,7 @@ macro_rules! entity_structs {              fn to_model(self) -> Result<EntityEdit> {                  Ok(EntityEdit {                      editgroup_id: uuid2fcid(&self.editgroup_id), -                    revision: self.rev_id.map(|v| uuid2fcid(&v)), +                    revision: self.rev_id.map(|v| v.to_string()),                      redirect_ident: self.redirect_id.map(|v| uuid2fcid(&v)),                      ident: uuid2fcid(&self.ident_id),                      edit_id: self.id, diff --git a/rust/tests/test_api_server.rs b/rust/tests/test_api_server.rs index fbaaa836..4c269e7f 100644 --- a/rust/tests/test_api_server.rs +++ b/rust/tests/test_api_server.rs @@ -57,6 +57,17 @@ fn test_entity_gets() {          Some("Trivial Results"),      ); +    // Check revision encoding +    check_response( +        request::get( +            "http://localhost:9411/v0/container/aaaaaaaaaaaaaeiraaaaaaaaai", +            headers.clone(), +            &router, +        ), +        status::Ok, +        Some("00000000-0000-0000-1111-fff000000002"), +    ); +      check_response(          request::get(              "http://localhost:9411/v0/creator/aaaaaaaaaaaaaircaaaaaaaaae", | 
