From 6ece23cce5f90eed034ea34a1c751da64d812a87 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Thu, 24 May 2018 17:42:42 -0700 Subject: update codegen and hack-fix tests --- rust/fatcat-api/README.md | 2 +- rust/fatcat-api/api.yaml | 10 +++++----- rust/fatcat-api/api/swagger.yaml | 3 --- rust/fatcat-api/src/models.rs | 5 ----- rust/src/api_server.rs | 19 +++++++++---------- rust/src/database_models.rs | 4 ++-- 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, - #[serde(rename = "container_edits")] - #[serde(skip_serializing_if = "Option::is_none")] - pub container_edits: Option, - #[serde(rename = "extra")] #[serde(skip_serializing_if = "Option::is_none")] pub extra: Option>, @@ -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::, _>( - body.size.map(|v| v as i32), - ) - .bind::, _>(body.sha1) - .bind::, _>(body.url) - .bind::(editgroup_id) - .get_result(&conn) - .unwrap(); + ).bind::, _>(body.size) + .bind::, _>(body.sha1) + .bind::, _>(body.url) + .bind::(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, - pub size: Option, + pub size: Option, pub sha1: Option, pub url: Option, } @@ -181,7 +181,7 @@ pub struct FileReleaseRow { #[table_name = "editgroup"] pub struct EditgroupRow { pub id: i64, - pub extra_json: Option, + //pub extra_json: Option, pub editor_id: i64, pub description: Option, } 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, + //extra_json -> Nullable, editor_id -> Int8, description -> Nullable, } @@ -108,7 +108,7 @@ table! { table! { file_rev (id) { id -> Int8, - extra_json -> Nullable, + //extra_json -> Nullable, size -> Nullable, sha1 -> Nullable, url -> Nullable, -- cgit v1.2.3