diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2018-05-24 17:42:42 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2018-05-24 17:42:42 -0700 |
commit | 6ece23cce5f90eed034ea34a1c751da64d812a87 (patch) | |
tree | c80b34d04381557784ed99d567dd14d11409e7a6 /rust | |
parent | 4eb8b801ba937e6f0af25bfc233c13b8e25138c0 (diff) | |
download | fatcat-6ece23cce5f90eed034ea34a1c751da64d812a87.tar.gz fatcat-6ece23cce5f90eed034ea34a1c751da64d812a87.zip |
update codegen and hack-fix tests
Diffstat (limited to 'rust')
-rw-r--r-- | rust/fatcat-api/README.md | 2 | ||||
-rw-r--r-- | rust/fatcat-api/api.yaml | 10 | ||||
-rw-r--r-- | rust/fatcat-api/api/swagger.yaml | 3 | ||||
-rw-r--r-- | rust/fatcat-api/src/models.rs | 5 | ||||
-rw-r--r-- | rust/src/api_server.rs | 19 | ||||
-rw-r--r-- | rust/src/database_models.rs | 4 | ||||
-rw-r--r-- | rust/src/database_schema.rs | 4 |
7 files changed, 19 insertions, 28 deletions
diff --git a/rust/fatcat-api/README.md b/rust/fatcat-api/README.md index 03472ac3..f5cf212e 100644 --- a/rust/fatcat-api/README.md +++ b/rust/fatcat-api/README.md @@ -13,7 +13,7 @@ To see how to make this your own, look here: [README](https://github.com/swagger-api/swagger-codegen/blob/master/README.md) - API version: 0.1.0 -- Build date: 2018-05-24T08:29:24.065Z +- Build date: 2018-05-25T00:37:13.827Z This autogenerated project defines an API crate `fatcat` which contains: * An `Api` trait defining the API in Rust. diff --git a/rust/fatcat-api/api.yaml b/rust/fatcat-api/api.yaml index 3fd7a213..df828a41 100644 --- a/rust/fatcat-api/api.yaml +++ b/rust/fatcat-api/api.yaml @@ -177,11 +177,11 @@ definitions: format: int64 description: type: string - container_edits: - type: array - item: - type: integer - format: int64 +# container_edits: +# type: array +# item: +# type: integer +# format: int64 # properties: # edit_id: # type: integer diff --git a/rust/fatcat-api/api/swagger.yaml b/rust/fatcat-api/api/swagger.yaml index a6f7a0fe..8db937d4 100644 --- a/rust/fatcat-api/api/swagger.yaml +++ b/rust/fatcat-api/api/swagger.yaml @@ -1296,8 +1296,6 @@ definitions: format: "int64" description: type: "string" - container_edits: - type: "array" extra: type: "object" additionalProperties: @@ -1308,7 +1306,6 @@ definitions: description: "description" editor_id: 6 id: 0 - container_edits: "" upperCaseName: "EDITGROUP" changelogentries: type: "array" diff --git a/rust/fatcat-api/src/models.rs b/rust/fatcat-api/src/models.rs index 9609e5ec..dc9a103f 100644 --- a/rust/fatcat-api/src/models.rs +++ b/rust/fatcat-api/src/models.rs @@ -199,10 +199,6 @@ pub struct Editgroup { #[serde(skip_serializing_if = "Option::is_none")] pub description: Option<String>, - #[serde(rename = "container_edits")] - #[serde(skip_serializing_if = "Option::is_none")] - pub container_edits: Option<Vec>, - #[serde(rename = "extra")] #[serde(skip_serializing_if = "Option::is_none")] pub extra: Option<HashMap<String, String>>, @@ -214,7 +210,6 @@ impl Editgroup { id: None, editor_id: editor_id, description: None, - container_edits: None, extra: None, } } diff --git a/rust/src/api_server.rs b/rust/src/api_server.rs index c91af9c9..5069d15d 100644 --- a/rust/src/api_server.rs +++ b/rust/src/api_server.rs @@ -543,8 +543,9 @@ impl Api for Server { Some(param) => param as i64, }; - let edit: FileEditRow = diesel::sql_query( - "WITH rev AS ( INSERT INTO file_rev (size, sha1, url) + let edit: FileEditRow = + diesel::sql_query( + "WITH rev AS ( INSERT INTO file_rev (size, sha1, url) VALUES ($1, $2, $3) RETURNING id ), ident AS ( INSERT INTO file_ident (rev_id) @@ -553,14 +554,12 @@ impl Api for Server { INSERT INTO file_edit (editgroup_id, ident_id, rev_id) VALUES ($4, (SELECT ident.id FROM ident), (SELECT rev.id FROM rev)) RETURNING *", - ).bind::<diesel::sql_types::Nullable<diesel::sql_types::Int4>, _>( - body.size.map(|v| v as i32), - ) - .bind::<diesel::sql_types::Nullable<diesel::sql_types::Text>, _>(body.sha1) - .bind::<diesel::sql_types::Nullable<diesel::sql_types::Text>, _>(body.url) - .bind::<diesel::sql_types::BigInt, _>(editgroup_id) - .get_result(&conn) - .unwrap(); + ).bind::<diesel::sql_types::Nullable<diesel::sql_types::Int8>, _>(body.size) + .bind::<diesel::sql_types::Nullable<diesel::sql_types::Text>, _>(body.sha1) + .bind::<diesel::sql_types::Nullable<diesel::sql_types::Text>, _>(body.url) + .bind::<diesel::sql_types::BigInt, _>(editgroup_id) + .get_result(&conn) + .unwrap(); let edit = &edit; let entity_edit = EntityEdit { diff --git a/rust/src/database_models.rs b/rust/src/database_models.rs index d9305e9f..8e93d69e 100644 --- a/rust/src/database_models.rs +++ b/rust/src/database_models.rs @@ -106,7 +106,7 @@ entity_structs!( pub struct FileRevRow { pub id: i64, //extra_json: Option<String>, - pub size: Option<i32>, + pub size: Option<i64>, pub sha1: Option<String>, pub url: Option<String>, } @@ -181,7 +181,7 @@ pub struct FileReleaseRow { #[table_name = "editgroup"] pub struct EditgroupRow { pub id: i64, - pub extra_json: Option<serde_json::Value>, + //pub extra_json: Option<serde_json::Value>, pub editor_id: i64, pub description: Option<String>, } diff --git a/rust/src/database_schema.rs b/rust/src/database_schema.rs index 9bcedf3e..a3b9cf2f 100644 --- a/rust/src/database_schema.rs +++ b/rust/src/database_schema.rs @@ -64,7 +64,7 @@ table! { table! { editgroup (id) { id -> Int8, - extra_json -> Nullable<Json>, + //extra_json -> Nullable<Json>, editor_id -> Int8, description -> Nullable<Text>, } @@ -108,7 +108,7 @@ table! { table! { file_rev (id) { id -> Int8, - extra_json -> Nullable<Json>, + //extra_json -> Nullable<Json>, size -> Nullable<Int8>, sha1 -> Nullable<Text>, url -> Nullable<Text>, |