In most models, we do not use hard object deletion.
This is done to facilitate deleted data recovery cases.
Instead, we mark objects as deleted using the
deletedAt
service attribute.Deleting an object
To delete an object - we need to update it by putting in the
deletedAt
attribute to the current time in ISO format. Example:mutation { updateOrganization(id: "5cb19b4a-a215-466e-8214-01c24942d962", data: { deletedAt: "2023-06-02T11:38:25Z" }) { id } }
Retrieving non-deleted data
You don't have to do anything to get only non-deleted objects from the query :)
By default, we exclude deleted objects from the output.
Retrieving deleted objects
In order to get all the objects, including the deleted ones, in the query address, it is necessary to add the query-parameter
deleted=true
.To filter objects you use the filters on the
deletedAt
field.
So, for example, this is what the query looks like for all deleted contacts of the residents that are attached to the non-deleted houses.{ allContacts (where: { deletedAt_not: null property: { deletedAt: null } }) { id property { id } } }
The URL of the request looks like this: https://condo.d.doma.ai/admin/api?deleted=true