feat(dict): delete dictionary endpoint + UI button с cascade safety
This commit is contained in:
+34
@@ -0,0 +1,34 @@
|
||||
package cloud.nstart.terravault.ordinis.events.definition;
|
||||
|
||||
import cloud.nstart.terravault.ordinis.events.DataScope;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
|
||||
import java.time.OffsetDateTime;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Удаление справочника (definition). Записывается в outbox + audit_log
|
||||
* ПЕРЕД cascade delete child rows — у consumers'ов остаётся пэйлоад,
|
||||
* чтобы инвалидировать cache / уведомить downstream geoportal / etc.
|
||||
*
|
||||
* <p>Trigger: {@code DELETE /api/v1/dictionaries/{name}} админом. Backend
|
||||
* валидирует отсутствие incoming FK dependents (lineage), затем
|
||||
* cascade-delete'ит records / drafts / schema_drafts через FK CASCADE
|
||||
* (migration 0030).
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public record DictionaryDefinitionDeleted(
|
||||
UUID definitionId,
|
||||
String dictionaryName,
|
||||
String displayName,
|
||||
DataScope scope,
|
||||
String bundle,
|
||||
long recordsDeleted,
|
||||
long draftsDeleted,
|
||||
long schemaDraftsDeleted,
|
||||
OffsetDateTime deletedAt,
|
||||
String deletedBy) implements DictionaryDefinitionEvent {
|
||||
|
||||
@com.fasterxml.jackson.annotation.JsonProperty("type")
|
||||
public String type() { return "DefinitionDeleted"; }
|
||||
}
|
||||
+3
-2
@@ -6,10 +6,11 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type")
|
||||
@JsonSubTypes({
|
||||
@JsonSubTypes.Type(value = DictionaryDefinitionCreated.class, name = "DefinitionCreated"),
|
||||
@JsonSubTypes.Type(value = DictionaryDefinitionUpdated.class, name = "DefinitionUpdated")
|
||||
@JsonSubTypes.Type(value = DictionaryDefinitionUpdated.class, name = "DefinitionUpdated"),
|
||||
@JsonSubTypes.Type(value = DictionaryDefinitionDeleted.class, name = "DefinitionDeleted")
|
||||
})
|
||||
public sealed interface DictionaryDefinitionEvent
|
||||
permits DictionaryDefinitionCreated, DictionaryDefinitionUpdated {
|
||||
permits DictionaryDefinitionCreated, DictionaryDefinitionUpdated, DictionaryDefinitionDeleted {
|
||||
|
||||
java.util.UUID definitionId();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user