I'm trying to create a useful dashboard and my first challenge is getting rid of many of my test accounts etc.
i've thus far managed to make a table and identify those users (e.g. anonymous users or my many test emails). I can multiple select items and I can also run a search for a type and select all.
But deleting them still only works when a single user is selected.
I've spoken to support and seen some other articles in the community but either not exactly what i'm trying to do or it's still to advanced for me to see how to convert it to do what I want.
At the moment I have the following:
- a query to list my firebase Auth user table.
- A table to display it.
- A delete user query.
- A button to trigger deletion of the selected user.
I have found the following:
- When the deleteUser query has the UID as the following it successfully passes the UID of the selected user and deletes it but only if it's a single item.
{{ userTable.selectedRow.data.uid }}
- I can make an array of the selected UID by using the following:
{{ formatDataAsObject(userTable.selectedRow.data).uid }}
But then it doesn't run the delete as it's not a valid UID.
- Support has advised me that firebase doesn't support this sort of thing so JS is the next step. They linked me a great article which I'm trying to parse. It does seem to be doing something, but not bulk deleting my files. Below is both the link and what I've written in a new js query.
https://docs.retool.com/docs/scripting-retool#promises-and-async-queries
var rows = [{ a: 1 }, { a: 2 }, { a: 3 }, { a: 4 }];
function runQuery(i) {
if (i >= rows.length) {
console.log("Finished running all queries");
return;
}
var data = rows[i];
console.log("Running query for row", data);
DeleteUser.trigger({
additionalScope: {
data: data,
},
// You can use the argument to get the data with the onSuccess function
onSuccess: function (data) {
runQuery(i + 1);
},
});
}
runQuery(0);
Instead I'm receiving the error:
DeleteUser: {"status":422,"message":"There is no user record corresponding to the provided identifier.","statusCode":422,"error":"Unprocessable Entity","data":null,"queryExecutionMetadata":{"estimatedResponseSizeBytes":139,"resourceTimeTakenMs":191,"isPreview...