From dfdf4473ea89087a5d055a7d9fdcda62fa727c58 Mon Sep 17 00:00:00 2001 From: theycallmesteve <59837464+theycallmesteve@users.noreply.github.com> Date: Fri, 8 May 2020 13:36:35 -0400 Subject: [PATCH 1/2] Rename to_json_list to to_json_provder to reflect the response model --- src/api/core/two_factor/mod.rs | 2 +- src/db/models/two_factor.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api/core/two_factor/mod.rs b/src/api/core/two_factor/mod.rs index da1ab7ff..4f075116 100644 --- a/src/api/core/two_factor/mod.rs +++ b/src/api/core/two_factor/mod.rs @@ -38,7 +38,7 @@ pub fn routes() -> Vec { #[get("/two-factor")] fn get_twofactor(headers: Headers, conn: DbConn) -> JsonResult { let twofactors = TwoFactor::find_by_user(&headers.user.uuid, &conn); - let twofactors_json: Vec = twofactors.iter().map(TwoFactor::to_json_list).collect(); + let twofactors_json: Vec = twofactors.iter().map(TwoFactor::to_json_provider).collect(); Ok(Json(json!({ "Data": twofactors_json, diff --git a/src/db/models/two_factor.rs b/src/db/models/two_factor.rs index 9bb894b6..2504baab 100644 --- a/src/db/models/two_factor.rs +++ b/src/db/models/two_factor.rs @@ -59,7 +59,7 @@ impl TwoFactor { }) } - pub fn to_json_list(&self) -> Value { + pub fn to_json_provider(&self) -> Value { json!({ "Enabled": self.enabled, "Type": self.atype, From 6a8c65493f2194c065705bfd180b4106e9db6478 Mon Sep 17 00:00:00 2001 From: theycallmesteve <59837464+theycallmesteve@users.noreply.github.com> Date: Fri, 8 May 2020 13:37:40 -0400 Subject: [PATCH 2/2] Rename collection_user_details to collection_read_only to reflect the response model --- src/api/core/organizations.rs | 2 +- src/db/models/organization.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api/core/organizations.rs b/src/api/core/organizations.rs index cdbaebd0..06988462 100644 --- a/src/api/core/organizations.rs +++ b/src/api/core/organizations.rs @@ -374,7 +374,7 @@ fn get_collection_users(org_id: String, coll_id: String, _headers: AdminHeaders, .map(|col_user| { UserOrganization::find_by_user_and_org(&col_user.user_uuid, &org_id, &conn) .unwrap() - .to_json_collection_user_details(col_user.read_only) + .to_json_read_only(col_user.read_only) }) .collect(); diff --git a/src/db/models/organization.rs b/src/db/models/organization.rs index 4ff0c56b..043ee3c1 100644 --- a/src/db/models/organization.rs +++ b/src/db/models/organization.rs @@ -304,7 +304,7 @@ impl UserOrganization { }) } - pub fn to_json_collection_user_details(&self, read_only: bool) -> Value { + pub fn to_json_read_only(&self, read_only: bool) -> Value { json!({ "Id": self.uuid, "ReadOnly": read_only