SeedCompany / cord-api-v3

Bible translation project management API
MIT License
18 stars 4 forks source link

Deactivate correct relationships on deleted resource #1745

Open blakekrammes opened 3 years ago

blakekrammes commented 3 years ago

I'm not aware of any bugs caused by this currently, but there are certain relationships that I believe should be deactivated on delete that are not. Currently we're only deactivating relationships going into the deleted resource. In some cases, however, we want to deactivate relationships going in both directions. See the parent relationship from a deleted file node to its parent directory after delete.

It's still active. If this were deactivated, it would have prevented this bug: https://github.com/SeedCompany/cord-api-v3/issues/1715. This was fixed by replacing the FileNode label with Deleted_FileNode.

This is the query that was checking for files by name. It still found the deleted file since its parent relationship to the directory was still active. Note the parent relationship going from the deleted file node on 70 to the parent directory on 68. https://github.com/SeedCompany/cord-api-v3/blob/b1f975eb1f9ef1db577f24919cf38d1abfa91187/src/components/file/file.repository.ts#L61-L75

I think we need to go through and enumerate cases where we need to deactivate relationships going out of the deleted base node.

┆Issue is synchronized with this Monday item by Unito

sync-by-unito[bot] commented 1 year ago

➤ Seth McKnight commented:

I'm not aware of any bugs caused by this currently, but there are certain relationships that I believe should be deactivated on delete that are not. Currently we're only deactivating relationships going into the deleted resource. In some cases, however, we want to deactivate relationships going in both directions. See the parent relationship from a deleted file node to its parent directory after delete.

It's still active. If this were deactivated, it would have prevented this bug: https://github.com/SeedCompany/cord-api-v3/issues/1715. This was fixed by replacing the FileNode label with Deleted_FileNode.

This is the query that was checking for files by name. It still found the deleted file since its parent relationship to the directory was still active. Note the parent relationship going from the deleted file node on 70 to the parent directory on 68. https://github.com/SeedCompany/cord-api-v3/blob/b1f975eb1f9ef1db577f24919cf38d1abfa91187/src/compone... ( https://github.com/SeedCompany/cord-api-v3/blob/b1f975eb1f9ef1db577f24919cf38d1abfa91187/src/components/file/file.repository.ts#L61-L75 )

I think we need to go through and enumerate cases where we need to deactivate relationships going out of the deleted base node.