From 9a83067d04c9648416b92fc8d7b8a542b0b9aa96 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Thu, 10 Jan 2019 21:39:25 -0800 Subject: code docs/comments and rustfmt --- rust/src/entity_crud.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'rust/src/entity_crud.rs') diff --git a/rust/src/entity_crud.rs b/rust/src/entity_crud.rs index a0101de8..3d9b5165 100644 --- a/rust/src/entity_crud.rs +++ b/rust/src/entity_crud.rs @@ -1,3 +1,10 @@ +//! Create/Update/Read/Delete methods for all entity types +//! +//! This module is very large (perhaps it should be split into per-entity files?), but it basically +//! comes down to implementing the EntityCrud trait for each of the entity types. *All* entity +//! reads and mutations should go through this file, which defines the mechanics of translation +//! between the SQL schema and API (swagger) JSON models. + use crate::database_models::*; use crate::database_schema::*; use crate::editing::EditContext; @@ -5,7 +12,6 @@ use crate::endpoint_handlers::get_release_files; use crate::errors::*; use crate::identifiers::*; use crate::server::DbConn; -use chrono; use diesel::prelude::*; use diesel::{self, insert_into}; use fatcat_api_spec::models::*; @@ -295,8 +301,10 @@ macro_rules! generic_db_get_rev { fn db_get_rev(conn: &DbConn, rev_id: Uuid, hide: HideFlags) -> Result { let rev = match $rev_table::table.find(rev_id).first(conn) { Ok(rev) => rev, - Err(diesel::result::Error::NotFound) => - Err(FatcatError::NotFound(stringify!($rev_table).to_string(), rev_id.to_string()))?, + Err(diesel::result::Error::NotFound) => Err(FatcatError::NotFound( + stringify!($rev_table).to_string(), + rev_id.to_string(), + ))?, Err(e) => Err(e)?, }; -- cgit v1.2.3