Skip to content

Commit

Permalink
feat: content delivery view published files (#2759)
Browse files Browse the repository at this point in the history
  • Loading branch information
stepan662 authored Dec 16, 2024
1 parent 9c1de22 commit fc4aa1c
Show file tree
Hide file tree
Showing 12 changed files with 515 additions and 857 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="last_published_files" type="jsonb"/>
</addColumn>
</changeSet>
</databaseChangeLog>
6 changes: 5 additions & 1 deletion e2e/cypress/e2e/projects/contentDelivery.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,16 @@ describe('Content delivery', () => {
contentDeliveryTestData.clean();
});

it('publishes content manually', () => {
it('publishes content manually and shows files', () => {
gcyAdvanced({ value: 'content-delivery-list-item', name: 'Azure' })
.findDcy('content-delivery-item-publish')
.click();
waitForGlobalLoading();
assertMessage('Content published successfully!');
gcyAdvanced({ value: 'content-delivery-list-item', name: 'Azure' })
.findDcy('content-delivery-files-button')
.click();
gcy('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 @@ -140,6 +140,7 @@ declare namespace DataCy {
"content-delivery-add-button" |
"content-delivery-auto-publish-checkbox" |
"content-delivery-delete-button" |
"content-delivery-files-button" |
"content-delivery-form-custom-slug" |
"content-delivery-form-name" |
"content-delivery-form-save" |
Expand All @@ -148,6 +149,7 @@ declare namespace DataCy {
"content-delivery-item-type" |
"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 fc4aa1c

Please sign in to comment.