Content import: sync sections and articles (archive is the source of truth)
- importZip now updates titles/positions of existing chapters and sections and removes sections/articles of archived chapters that are missing in the archive (so restructured material no longer leaves stale sections behind); removed count is reported in ContentImportResult and in the admin flash message - docs: note about import semantics in the class diagram and sequences
This commit is contained in:
@@ -38,9 +38,11 @@ class ContentAdminController(
|
||||
}
|
||||
return try {
|
||||
val result = api.importContent(token(session), file.originalFilename ?: "content.zip", file.bytes)
|
||||
val removedNote = if (result.removed > 0) ", удалено устаревших: ${result.removed}" else ""
|
||||
redirect.addFlashAttribute(
|
||||
"notice",
|
||||
"Импортировано: глав ${result.chapters}, разделов ${result.sections}, статей ${result.articles}, картинок ${result.assets}",
|
||||
"Импортировано: глав ${result.chapters}, разделов ${result.sections}, " +
|
||||
"статей ${result.articles}, картинок ${result.assets}$removedNote",
|
||||
)
|
||||
"redirect:/admin/content"
|
||||
} catch (ex: ApiException) {
|
||||
|
||||
@@ -365,6 +365,7 @@ data class ContentImportResultDto(
|
||||
val sections: Int = 0,
|
||||
val articles: Int = 0,
|
||||
val assets: Int = 0,
|
||||
val removed: Int = 0,
|
||||
)
|
||||
|
||||
class DownloadDto(
|
||||
|
||||
Reference in New Issue
Block a user