From b9b79a7b7385ba18654d51bc2ca1b5d07f191d0e Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Tue, 11 Sep 2018 14:49:25 -0700 Subject: finish fatcat-api => fatcat-api-spec refactor --- rust/src/api_entity_crud.rs | 2 +- rust/src/api_helpers.rs | 2 +- rust/src/api_server.rs | 4 ++-- rust/src/api_wrappers.rs | 10 +++++----- rust/src/bin/fatcatd.rs | 6 +++--- rust/src/database_models.rs | 2 +- rust/src/lib.rs | 2 +- rust/tests/test_api_server.rs | 6 +++--- 8 files changed, 17 insertions(+), 17 deletions(-) diff --git a/rust/src/api_entity_crud.rs b/rust/src/api_entity_crud.rs index 0fb1c690..6bbfcdc4 100644 --- a/rust/src/api_entity_crud.rs +++ b/rust/src/api_entity_crud.rs @@ -5,7 +5,7 @@ use database_schema::*; use diesel::prelude::*; use diesel::{self, insert_into}; use errors::*; -use fatcat_api::models::*; +use fatcat_api_spec::models::*; use sha1::Sha1; use std::marker::Sized; use std::str::FromStr; diff --git a/rust/src/api_helpers.rs b/rust/src/api_helpers.rs index 8ddaf82c..96fc898e 100644 --- a/rust/src/api_helpers.rs +++ b/rust/src/api_helpers.rs @@ -5,7 +5,7 @@ use database_schema::*; use diesel; use diesel::prelude::*; use errors::*; -use fatcat_api::models::*; +use fatcat_api_spec::models::*; use regex::Regex; use serde_json; use std::str::FromStr; diff --git a/rust/src/api_server.rs b/rust/src/api_server.rs index 978f9893..dd35b330 100644 --- a/rust/src/api_server.rs +++ b/rust/src/api_server.rs @@ -8,8 +8,8 @@ use database_schema::*; use diesel::prelude::*; use diesel::{self, insert_into}; use errors::*; -use fatcat_api::models; -use fatcat_api::models::*; +use fatcat_api_spec::models; +use fatcat_api_spec::models::*; use std::str::FromStr; use ConnectionPool; diff --git a/rust/src/api_wrappers.rs b/rust/src/api_wrappers.rs index 4d3373e2..3f070593 100644 --- a/rust/src/api_wrappers.rs +++ b/rust/src/api_wrappers.rs @@ -6,15 +6,15 @@ use api_server::Server; use database_models::EntityEditRow; use diesel::Connection; use errors::*; -use fatcat_api::models; -use fatcat_api::models::*; -use fatcat_api::*; +use fatcat_api_spec::models; +use fatcat_api_spec::models::*; +use fatcat_api_spec::*; use futures::{self, Future}; use std::str::FromStr; /// Helper for generating wrappers (which return "Box::new(futures::done(Ok(BLAH)))" like the -/// codegen fatcat-api code wants) that call through to actual helpers (which have simple Result<> -/// return types) +/// codegen fatcat-api-spec code wants) that call through to actual helpers (which have simple +/// Result<> return types) macro_rules! wrap_entity_handlers { // Would much rather just have entity ident, then generate the other fields from that, but Rust // stable doesn't have a mechanism to "concat" or generate new identifiers in macros, at least diff --git a/rust/src/bin/fatcatd.rs b/rust/src/bin/fatcatd.rs index 1e0c3e53..57b6a3da 100644 --- a/rust/src/bin/fatcatd.rs +++ b/rust/src/bin/fatcatd.rs @@ -6,7 +6,7 @@ extern crate diesel; //extern crate dotenv; extern crate error_chain; extern crate fatcat; -extern crate fatcat_api; +extern crate fatcat_api_spec; extern crate futures; extern crate iron; extern crate iron_slog; @@ -42,7 +42,7 @@ fn main() { let formatter = DefaultLogFormatter; let server = fatcat::server().unwrap(); - let mut router = fatcat_api::router(server); + let mut router = fatcat_api_spec::router(server); router.get("/", root_handler, "root-redirect"); router.get("/swagger-ui", swaggerui_handler, "swagger-ui-html"); @@ -79,7 +79,7 @@ fn main() { let mut chain = Chain::new(LoggerMiddleware::new(router, logger, formatter)); // Auth stuff unused for now - //chain.link_before(fatcat_api::server::ExtractAuthData); + //chain.link_before(fatcat_api_spec::server::ExtractAuthData); // add authentication middlewares into the chain here // for the purpose of this example, pretend we have authenticated a user //chain.link_before(AllowAllMiddleware::new("cosmo")); diff --git a/rust/src/database_models.rs b/rust/src/database_models.rs index 93e6a0fe..02d2be4f 100644 --- a/rust/src/database_models.rs +++ b/rust/src/database_models.rs @@ -2,7 +2,7 @@ use api_helpers::uuid2fcid; use chrono; use database_schema::*; use errors::*; -use fatcat_api::models::{ChangelogEntry, Editgroup, EntityEdit}; +use fatcat_api_spec::models::{ChangelogEntry, Editgroup, EntityEdit}; use serde_json; use uuid::Uuid; diff --git a/rust/src/lib.rs b/rust/src/lib.rs index 57cc535c..381c67ea 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -1,5 +1,5 @@ extern crate chrono; -extern crate fatcat_api; +extern crate fatcat_api_spec; #[macro_use] extern crate diesel; extern crate diesel_migrations; diff --git a/rust/tests/test_api_server.rs b/rust/tests/test_api_server.rs index 54639228..ebc74b67 100644 --- a/rust/tests/test_api_server.rs +++ b/rust/tests/test_api_server.rs @@ -1,6 +1,6 @@ extern crate diesel; extern crate fatcat; -extern crate fatcat_api; +extern crate fatcat_api_spec; extern crate iron; extern crate iron_test; extern crate uuid; @@ -16,12 +16,12 @@ use uuid::Uuid; fn setup() -> ( Headers, - fatcat_api::router::Router, + fatcat_api_spec::router::Router, diesel::r2d2::PooledConnection>, ) { let server = fatcat::test_server().unwrap(); let conn = server.db_pool.get().expect("db_pool error"); - let router = fatcat_api::router(server); + let router = fatcat_api_spec::router(server); let mut headers = Headers::new(); let mime: Mime = "application/json".parse().unwrap(); headers.set(ContentType(mime)); -- cgit v1.2.3