mirror of
https://github.com/ClaytonWWilson/Listify.git
synced 2026-03-10 18:55:03 +00:00
Treat ListSharee as access table
This is so that multiple users can be paired with a single list. In the future, we may want to reconsider list deletion behavior to simply remove a user's access and only delete it when no one has access. We may also want the user deletion Lambda to use the list deletion Lambda when it is created.
This commit is contained in:
@@ -19,6 +19,8 @@ public class UserDeleter implements CallHandler {
|
||||
private final String GET_LISTS = "SELECT * FROM List WHERE (owner = ?);";
|
||||
private final String DELETE_LIST_PRODUCT = "DELETE FROM ListProduct WHERE (listID = ?);";
|
||||
private final String DELETE_LISTS = "DELETE FROM List WHERE (owner = ?);";
|
||||
private final String DELETE_LIST_SHARES = "DELETE FROM ListSharee WHERE (listID = ?);";
|
||||
private final String DELETE_LIST_ACCESS = "DELETE FROM ListSharee WHERE (userID = ?);";
|
||||
|
||||
public UserDeleter(Connection connection, String cognitoID) {
|
||||
this.connection = connection;
|
||||
@@ -57,13 +59,23 @@ public class UserDeleter implements CallHandler {
|
||||
statement = connection.prepareStatement(DELETE_LIST_PRODUCT);
|
||||
statement.setInt(1, listID);
|
||||
System.out.println(statement);
|
||||
statement.executeQuery();
|
||||
statement.executeUpdate();
|
||||
|
||||
statement = connection.prepareStatement(DELETE_LIST_SHARES);
|
||||
statement.setInt(1, listID);
|
||||
System.out.println(statement);
|
||||
statement.executeUpdate();
|
||||
}
|
||||
|
||||
statement = connection.prepareStatement(DELETE_LISTS);
|
||||
statement.setString(1, cognitoID);
|
||||
System.out.println(statement);
|
||||
statement.executeQuery();
|
||||
statement.executeUpdate();
|
||||
statement = connection.prepareStatement(DELETE_LIST_ACCESS);
|
||||
statement.setString(1, cognitoID);
|
||||
System.out.println(statement);
|
||||
statement.executeUpdate();
|
||||
|
||||
connection.commit();
|
||||
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user