Browse Source

fix clippy warnings

pull/2667/head
MFijak 3 years ago
committed by Maximilian Fijak
parent
commit
35f528eb57
  1. 6
      src/api/core/organizations.rs
  2. 2
      src/db/models/collection.rs
  3. 16
      src/db/models/group.rs

6
src/api/core/organizations.rs

@ -1594,7 +1594,7 @@ impl SelectionReadOnly {
pub fn to_collection_group (&self, groups_uuid: String) -> CollectionGroup {
CollectionGroup::new (
self.Id.clone(),
groups_uuid.clone(),
groups_uuid,
self.ReadOnly,
self.HidePasswords
)
@ -1656,12 +1656,12 @@ async fn put_group(_org_id: String, group_id: String, data: JsonUpcase<GroupRequ
}
async fn add_update_group(mut group: Group, collections: Vec<SelectionReadOnly>, conn: &DbConn) -> JsonResult {
group.save(&conn).await?;
group.save(conn).await?;
for selection_read_only_request in collections {
let mut collection_group = selection_read_only_request.to_collection_group(group.uuid.clone());
collection_group.save(&conn).await?;
collection_group.save(conn).await?;
}
Ok(Json(json!({

2
src/db/models/collection.rs

@ -127,7 +127,7 @@ impl Collection {
self.update_users_revision(conn).await;
CollectionCipher::delete_all_by_collection(&self.uuid, conn).await?;
CollectionUser::delete_all_by_collection(&self.uuid, conn).await?;
CollectionGroup::delete_all_by_collection(&self.uuid, &conn).await?;
CollectionGroup::delete_all_by_collection(&self.uuid, conn).await?;
db_run! { conn: {
diesel::delete(collections::table.filter(collections::uuid.eq(self.uuid)))

16
src/db/models/group.rs

@ -41,10 +41,10 @@ impl Group {
Self {
uuid: crate::util::get_uuid(),
organizations_uuid: organizations_uuid,
name: name,
access_all: access_all,
external_id: external_id,
organizations_uuid,
name,
access_all,
external_id,
creation_date: now,
revision_date: now
}
@ -79,8 +79,8 @@ impl CollectionGroup {
impl GroupUser {
pub fn new (groups_uuid: String, users_organizations_uuid: String) -> Self {
Self {
groups_uuid: groups_uuid,
users_organizations_uuid: users_organizations_uuid
groups_uuid,
users_organizations_uuid
}
}
}
@ -183,8 +183,8 @@ impl Group {
}
pub async fn delete(&self, conn: &DbConn) -> EmptyResult {
CollectionGroup::delete_all_by_group(&self.uuid, &conn).await?;
GroupUser::delete_all_by_group(&self.uuid, &conn).await?;
CollectionGroup::delete_all_by_group(&self.uuid, conn).await?;
GroupUser::delete_all_by_group(&self.uuid, conn).await?;
db_run! { conn: {
diesel::delete(groups::table.filter(groups::uuid.eq(&self.uuid)))

Loading…
Cancel
Save