Skip to content

Commit

Permalink
fix(core): send deleted payload, not payload before the deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
bobeal committed Dec 23, 2024
1 parent b8b4c1d commit e55f767
Showing 1 changed file with 8 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -580,21 +580,14 @@ class EntityService(
val expandedDeletedEntity = Entity.toExpandedDeletedEntity(entityId, deletedAt)
val entity = databaseClient.sql(
"""
WITH entity_before_delete AS (
SELECT *
FROM entity_payload
WHERE entity_id = :entity_id
),
update_entity AS (
UPDATE entity_payload
SET deleted_at = :deleted_at,
payload = :payload,
scopes = null,
specific_access_policy = null,
types = '{}'
WHERE entity_id = :entity_id
)
SELECT * FROM entity_before_delete
UPDATE entity_payload
SET deleted_at = :deleted_at,
payload = :payload,
scopes = null,
specific_access_policy = null,
types = '{}'
WHERE entity_id = :entity_id
RETURNING *
""".trimIndent()
)
.bind("entity_id", entityId)
Expand Down

0 comments on commit e55f767

Please sign in to comment.