Skip to content

Commit

Permalink
feat: content delivery last publish files
Browse files Browse the repository at this point in the history
  • Loading branch information
stepan662 committed Dec 12, 2024
1 parent c5b2854 commit 873e8b6
Show file tree
Hide file tree
Showing 12 changed files with 514 additions and 856 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class ContentDeliveryConfigModel(
val publicUrl: String?,
val autoPublish: Boolean,
val lastPublished: Long?,
val lastPublishedFiles: Collection<String>,
) : RepresentationModel<ContentDeliveryConfigModel>(), Serializable, IExportParams {
override var languages: Set<String>? = null
override var format: ExportFormat = ExportFormat.JSON
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class ContentDeliveryConfigModelAssembler(
publicUrl = getPublicUrl(entity),
autoPublish = entity.automationActions.isNotEmpty(),
lastPublished = entity.lastPublished?.time,
lastPublishedFiles = entity.lastPublishedFiles ?: listOf(),
).also {
it.copyPropsFrom(entity)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class ContentDeliveryUploader(
storeToStorage(withFullPaths, storage)
purgeCacheIfConfigured(config, files.keys)
config.lastPublished = currentDateProvider.date
config.lastPublishedFiles = files.map { it.key }.toList()
contentDeliveryConfigService.save(config)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ class ContentDeliveryConfig(
@ActivityIgnoredProp
var lastPublished: Date? = null

@Type(JsonBinaryType::class)
@Column(columnDefinition = "jsonb")
@ActivityIgnoredProp
var lastPublishedFiles: List<String>? = null

@ColumnDefault("false")
var pruneBeforePublish = true

Expand Down
7 changes: 6 additions & 1 deletion backend/data/src/main/resources/db/changelog/schema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4009,4 +4009,9 @@
<column name="deleted_at" type="timestamp(6)"/>
</addColumn>
</changeSet>
</databaseChangeLog>
<changeSet author="stepangranat (generated)" id="1733757292979-1">
<addColumn tableName="content_delivery_config">
<column name="lastPublishedFiles" type="jsonb"/>
</addColumn>
</changeSet>
</databaseChangeLog>
5 changes: 5 additions & 0 deletions e2e/cypress/e2e/projects/contentDelivery.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ describe('Content delivery', () => {
.click();
waitForGlobalLoading();
assertMessage('Content published successfully!');
gcyAdvanced({ value: 'content-delivery-list-item', name: 'Azure' })
.findDcy('content-delivery-last-published-section')
.should('be.visible')
.findDcy('content-delivery-published-file')
.should('contain', 'en.json');
});

it('creates content delivery', () => {
Expand Down
2 changes: 2 additions & 0 deletions e2e/cypress/support/dataCyType.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,10 @@ declare namespace DataCy {
"content-delivery-item-edit" |
"content-delivery-item-publish" |
"content-delivery-item-type" |
"content-delivery-last-published-section" |
"content-delivery-list-item" |
"content-delivery-prune-before-publish-checkbox" |
"content-delivery-published-file" |
"content-delivery-storage-selector" |
"content-delivery-storage-selector-item" |
"content-delivery-subtitle" |
Expand Down
Loading

0 comments on commit 873e8b6

Please sign in to comment.