feat(wiki): prune empty folders after document retract

Automatically remove wiki folders that become empty when knowledge is
retracted, using the durable finalize lane so pruning waits until ingest
drains. Repository DeleteFolder now atomically checks emptiness to avoid
races with concurrent page or child-folder writes.
This commit is contained in:
wizardchen
2026-07-22 17:57:55 +08:00
committed by lyingbug
parent ab0b1d65b5
commit 4c3ae69b49
10 changed files with 444 additions and 18 deletions
+1 -1
View File
@@ -314,7 +314,7 @@ func writeWikiFolderError(c *gin.Context, err error) {
switch {
case stderrors.Is(err, repository.ErrWikiFolderNotFound), stderrors.Is(err, repository.ErrWikiPageNotFound):
c.JSON(http.StatusNotFound, gin.H{"error": err.Error()})
case stderrors.Is(err, repository.ErrWikiFolderConflict):
case stderrors.Is(err, repository.ErrWikiFolderConflict), stderrors.Is(err, repository.ErrWikiFolderNotEmpty):
c.JSON(http.StatusConflict, gin.H{"error": err.Error()})
default:
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})