From c463ac61b0bfe46c83a2150fd92a51fdc85e212d Mon Sep 17 00:00:00 2001 From: Lisa Julia Nebel Date: Wed, 18 Mar 2026 18:49:40 +0100 Subject: [PATCH 1/3] Test with SNAPSHOT of attachments plugin --- samples/bookshop/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/bookshop/pom.xml b/samples/bookshop/pom.xml index ce37d9cf..4ea90122 100644 --- a/samples/bookshop/pom.xml +++ b/samples/bookshop/pom.xml @@ -48,7 +48,7 @@ com.sap.cds cds-feature-attachments - 1.3.3 + 1.4.0-SNAPSHOT From 8a274c766127faed46e9425a4a59e15310d18c2e Mon Sep 17 00:00:00 2001 From: Lisa Julia Nebel Date: Wed, 18 Mar 2026 18:50:45 +0100 Subject: [PATCH 2/3] Enable draft for books --- samples/bookshop/srv/attachments.cds | 1 + 1 file changed, 1 insertion(+) diff --git a/samples/bookshop/srv/attachments.cds b/samples/bookshop/srv/attachments.cds index 5a54d43f..4c00ae68 100644 --- a/samples/bookshop/srv/attachments.cds +++ b/samples/bookshop/srv/attachments.cds @@ -45,6 +45,7 @@ annotate adminService.Books with @(UI.Facets: [{ Target: 'mediaValidatedAttachments/@UI.LineItem' }]); +annotate adminService.Books with @odata.draft.enabled; service nonDraft { entity Books as projection on my.Books; From 7d75c9550cfc29a8c61e2e6f97c2eee6dfc147ee Mon Sep 17 00:00:00 2001 From: Lisa Julia Nebel Date: Wed, 18 Mar 2026 18:51:54 +0100 Subject: [PATCH 3/3] Change mediaValidatedAttachments to be a compositionof one Attachments, use a FieldGroup UI facet for that, not a LineItem UI facet --- samples/bookshop/srv/attachments.cds | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/samples/bookshop/srv/attachments.cds b/samples/bookshop/srv/attachments.cds index 4c00ae68..dcc35ffe 100644 --- a/samples/bookshop/srv/attachments.cds +++ b/samples/bookshop/srv/attachments.cds @@ -8,7 +8,7 @@ extend my.Books with { @UI.Hidden sizeLimitedAttachments : Composition of many Attachments; @UI.Hidden - mediaValidatedAttachments : Composition of many Attachments; + mediaValidatedAttachments : Composition of one Attachments; @UI.Hidden anotherMediaValidatedAttachments : Composition of many Attachments; } @@ -42,11 +42,21 @@ annotate adminService.Books with @(UI.Facets: [{ $Type : 'UI.ReferenceFacet', ID : 'AttachmentsFacet', Label : '{i18n>attachments}', - Target: 'mediaValidatedAttachments/@UI.LineItem' + Target: 'mediaValidatedAttachments/@UI.FieldGroup' }]); annotate adminService.Books with @odata.draft.enabled; + +annotate adminService.Books.mediaValidatedAttachments with @UI.FieldGroup: { + Data: [ + {Value: content}, + {Value: fileName}, + {Value: mimeType}, + {Value: status} + ] +}; + service nonDraft { entity Books as projection on my.Books; }