Skip to content

Commit

Permalink
chore: deleting debugging lines [2024-12-08]
Browse files Browse the repository at this point in the history
  • Loading branch information
CHRISCARLON committed Dec 8, 2024
1 parent 98633e8 commit 3ff2978
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 14 deletions.
1 change: 1 addition & 0 deletions gridwalk-backend/src/core/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ impl WorkspaceMember {
Ok(database
.get_workspace_member(workspace, user)
.await
// TODO: Fix unwrap
.unwrap())
}

Expand Down
10 changes: 0 additions & 10 deletions gridwalk-backend/src/data/dynamodb/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -418,8 +418,6 @@ impl UserStore for Dynamodb {
return Ok(vec![]);
}

println!("{:?}", member_items);

// Extract user IDs and create batch get request
let keys: Vec<HashMap<String, AV>> = member_items
.iter()
Expand Down Expand Up @@ -477,18 +475,10 @@ impl UserStore for Dynamodb {
if !item.contains_key("role") {
item.insert("role".to_string(), AV::S("member".to_string()));
}

// The conversion will use:
// - PK (already contains WSP#<id>)
// - SK (already contains USER#<id>)
// - role (we just ensured exists)
// - email (we just added)
Some(item.into())
})
.collect();

println!("{:?}", members);

Ok(members)
}

Expand Down
10 changes: 6 additions & 4 deletions gridwalk-backend/src/routes/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ pub async fn create_workspace(
.app_data
.add_workspace_member(&wsp, &owner, WorkspaceRole::Admin, now)
.await;
"workspace created".into_response()
"workspace created successfully".into_response()
}
Err(_) => "workspace not created".into_response(),
}
Expand All @@ -97,13 +97,13 @@ pub async fn add_workspace_member(
Err(_) => return "workspace not found".into_response(),
};

// Attempt to add member (role is already parsed since you use WorkspaceRole in ReqAddWorkspaceMember)
// Add memeber workspace
match workspace
.add_member(&state.app_data, &req_user, &user_to_add, req.role)
.await
{
Ok(_) => "member added".into_response(),
Err(_) => "failed to add member".into_response(),
Ok(_) => "member added to workspace successfully".into_response(),
Err(_) => "failed to add member to workspace".into_response(),
}
} else {
"unauthorized".into_response()
Expand All @@ -128,6 +128,7 @@ pub async fn remove_workspace_member(
Err(_) => return "user not found".into_response(),
};

// Remove workspace member
match wsp.remove_member(&state.app_data, &req_user, &user).await {
Ok(_) => "removed workspace member".into_response(),
Err(_) => "failed to remove member".into_response(),
Expand All @@ -154,6 +155,7 @@ pub async fn get_workspace_members(
}
};

//
if let Ok(_member) = workspace.get_member(&state.app_data, &req_user).await {
// Get all members and transform to simplified response
match workspace.get_members(&state.app_data).await {
Expand Down

0 comments on commit 3ff2978

Please sign in to comment.