When we delete an object from our database, we send a query with listobject to find all the relationships established by the type of that object one by one, then we create a delete query. This makes it difficult to collect, delete and maintain the garbage left in the openfga database when the object is deleted.
Describe the ideal solution
It would make it really easy if there was an api call like the one below, where the task of the api is to find out what relationships the type to be deleted has with other types and delete them.
Currently, the best way to know this is to determine which type the object to be deleted represents in the authorization schema, then determine which relationships that type has with which types, then send a listObjects query one by one, then try to find the opposite situations with listUsers.
Checklist
Describe the problem you'd like to have solved
When we delete an object from our database, we send a query with listobject to find all the relationships established by the type of that object one by one, then we create a delete query. This makes it difficult to collect, delete and maintain the garbage left in the openfga database when the object is deleted.
Describe the ideal solution
It would make it really easy if there was an api call like the one below, where the task of the api is to find out what relationships the type to be deleted has with other types and delete them.
fgaClient.deleteType(typeName, id);
Alternatives and current workarounds
Currently, the best way to know this is to determine which type the object to be deleted represents in the authorization schema, then determine which relationships that type has with which types, then send a listObjects query one by one, then try to find the opposite situations with listUsers.
Additional context
No response