aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-12-20 23:42:05 -0800
committerBryan Newbold <bnewbold@robocracy.org>2018-12-20 23:42:05 -0800
commitca1ec8d9a722dd08f04c21981691d4c060f90a51 (patch)
tree17487bda614827b4b5dd993362cafcc3ad479ee8
parent6e491d1ad583cd24a062654291ab1a4f03115e31 (diff)
downloadfatcat-ca1ec8d9a722dd08f04c21981691d4c060f90a51.tar.gz
fatcat-ca1ec8d9a722dd08f04c21981691d4c060f90a51.zip
GET methods not in transactions
-rw-r--r--rust/src/api_wrappers.rs30
1 files changed, 15 insertions, 15 deletions
diff --git a/rust/src/api_wrappers.rs b/rust/src/api_wrappers.rs
index c8f6b390..545a2079 100644
--- a/rust/src/api_wrappers.rs
+++ b/rust/src/api_wrappers.rs
@@ -36,8 +36,8 @@ macro_rules! wrap_entity_handlers {
_context: &Context,
) -> Box<Future<Item = $get_resp, Error = ApiError> + Send> {
let conn = self.db_pool.get().expect("db_pool error");
- // No transaction for GET
- let ret = match conn.transaction(|| {
+ // No transaction for GET?
+ let ret = match (|| {
let entity_id = FatCatId::from_str(&id)?;
let hide_flags = match hide {
None => HideFlags::none(),
@@ -52,7 +52,7 @@ macro_rules! wrap_entity_handlers {
Ok(entity)
},
}
- }) {
+ })() {
Ok(entity) =>
$get_resp::FoundEntity(entity),
Err(Error(ErrorKind::Diesel(::diesel::result::Error::NotFound), _)) =>
@@ -239,11 +239,11 @@ macro_rules! wrap_entity_handlers {
_context: &Context,
) -> Box<Future<Item = $get_history_resp, Error = ApiError> + Send> {
let conn = self.db_pool.get().expect("db_pool error");
- // No transaction for GET
- let ret = match conn.transaction(|| {
+ // No transaction for GET?
+ let ret = match (|| {
let entity_id = FatCatId::from_str(&id)?;
$model::db_get_history(&conn, entity_id, limit)
- }) {
+ })() {
Ok(history) =>
$get_history_resp::FoundEntityHistory(history),
Err(Error(ErrorKind::Diesel(::diesel::result::Error::NotFound), _)) =>
@@ -269,8 +269,8 @@ macro_rules! wrap_entity_handlers {
_context: &Context,
) -> Box<Future<Item = $get_rev_resp, Error = ApiError> + Send> {
let conn = self.db_pool.get().expect("db_pool error");
- // No transaction for GET
- let ret = match conn.transaction(|| {
+ // No transaction for GET?
+ let ret = match (|| {
let rev_id = Uuid::from_str(&id)?;
let hide_flags = match hide {
None => HideFlags::none(),
@@ -285,7 +285,7 @@ macro_rules! wrap_entity_handlers {
Ok(entity)
},
}
- }) {
+ })() {
Ok(entity) =>
$get_rev_resp::FoundEntityRevision(entity),
Err(Error(ErrorKind::Diesel(::diesel::result::Error::NotFound), _)) =>
@@ -308,10 +308,10 @@ macro_rules! wrap_entity_handlers {
_context: &Context,
) -> Box<Future<Item = $get_edit_resp, Error = ApiError> + Send> {
let conn = self.db_pool.get().expect("db_pool error");
- // No transaction for GET
- let ret = match conn.transaction(|| {
+ // No transaction for GET?
+ let ret = match (|| {
$model::db_get_edit(&conn, edit_id)?.into_model()
- }) {
+ })() {
Ok(edit) =>
$get_edit_resp::FoundEdit(edit),
Err(Error(ErrorKind::Diesel(::diesel::result::Error::NotFound), _)) =>
@@ -355,12 +355,12 @@ macro_rules! wrap_entity_handlers {
_context: &Context,
) -> Box<Future<Item = $get_redirects_resp, Error = ApiError> + Send> {
let conn = self.db_pool.get().expect("db_pool error");
- // No transaction for GET
- let ret = match conn.transaction(|| {
+ // No transaction for GET?
+ let ret = match (|| {
let entity_id = FatCatId::from_str(&id)?;
let redirects: Vec<FatCatId> = $model::db_get_redirects(&conn, entity_id)?;
Ok(redirects.into_iter().map(|fcid| fcid.to_string()).collect())
- }) {
+ })() {
Ok(redirects) =>
$get_redirects_resp::FoundEntityRedirects(redirects),
Err(Error(ErrorKind::Diesel(::diesel::result::Error::NotFound), _)) =>