From 491903ae34f35f62103a47c5e5951ff5673ffeb4 Mon Sep 17 00:00:00 2001 From: Rishi Kunnath <82925475+rishikunnath2747@users.noreply.github.com> Date: Fri, 25 Jul 2025 14:06:47 +0530 Subject: [PATCH] changes --- cap-notebook/demoapp/app/common.cds | 66 ++++++++++++++++++++++ cap-notebook/demoapp/srv/admin-service.cds | 10 ++++ 2 files changed, 76 insertions(+) diff --git a/cap-notebook/demoapp/app/common.cds b/cap-notebook/demoapp/app/common.cds index 5f5909928..c9120dfe6 100644 --- a/cap-notebook/demoapp/app/common.cds +++ b/cap-notebook/demoapp/app/common.cds @@ -95,6 +95,72 @@ annotate Attachments with @Common: {SideEffects #ContentChanged: { TargetEntities : [Books.attachments] }}{}; +annotate my.Books.references with @UI: { + HeaderInfo: { + $Type : 'UI.HeaderInfoType', + TypeName : '{i18n>Attachment}', + TypeNamePlural: '{i18n>Attachments}', + }, + LineItem : [ + {Value: fileName, @HTML5.CssDefaults: {width: '20%'}}, + {Value: content, @HTML5.CssDefaults: {width: '20%'}}, + {Value: createdAt, @HTML5.CssDefaults: {width: '20%'}}, + {Value: createdBy, @HTML5.CssDefaults: {width: '20%'}}, + {Value: note, @HTML5.CssDefaults: {width: '20%'}}, + + { + $Type : 'UI.DataFieldForAction', + Label : 'Copy Attachments', + Action: 'AdminService.copyAttachments', + } + ] +} { + note @(title: '{i18n>Note}'); + fileName @(title: '{i18n>Filename}'); + modifiedAt @(odata.etag: null); + content + @Core.ContentDisposition: { Filename: fileName } + @(title: '{i18n>Attachment}'); + folderId @UI.Hidden; + repositoryId @UI.Hidden ; + objectId @UI.Hidden ; + mimeType @UI.Hidden; + status @UI.Hidden; +} + +annotate my.Books.footnotes with @UI: { + HeaderInfo: { + $Type : 'UI.HeaderInfoType', + TypeName : '{i18n>Attachment}', + TypeNamePlural: '{i18n>Attachments}', + }, + LineItem : [ + {Value: fileName, @HTML5.CssDefaults: {width: '20%'}}, + {Value: content, @HTML5.CssDefaults: {width: '20%'}}, + {Value: createdAt, @HTML5.CssDefaults: {width: '20%'}}, + {Value: createdBy, @HTML5.CssDefaults: {width: '20%'}}, + {Value: note, @HTML5.CssDefaults: {width: '20%'}}, + + { + $Type : 'UI.DataFieldForAction', + Label : 'Copy Attachments', + Action: 'AdminService.copyAttachments', + } + ] +} { + note @(title: '{i18n>Note}'); + fileName @(title: '{i18n>Filename}'); + modifiedAt @(odata.etag: null); + content + @Core.ContentDisposition: { Filename: fileName } + @(title: '{i18n>Attachment}'); + folderId @UI.Hidden; + repositoryId @UI.Hidden ; + objectId @UI.Hidden ; + mimeType @UI.Hidden; + status @UI.Hidden; +} + //////////////////////////////////////////////////////////////////////////// // // Books Elements diff --git a/cap-notebook/demoapp/srv/admin-service.cds b/cap-notebook/demoapp/srv/admin-service.cds index 7247b2ca9..d5d3b7eec 100644 --- a/cap-notebook/demoapp/srv/admin-service.cds +++ b/cap-notebook/demoapp/srv/admin-service.cds @@ -8,4 +8,14 @@ service AdminService @(requires: ['admin','system-user']) { @(Common.SideEffects : {TargetEntities: ['']},) action copyAttachments(in:many $self,up__ID:String,objectIds:String); } + entity Books.references as projection on my.Books.references + actions { + @(Common.SideEffects : {TargetEntities: ['']},) + action copyAttachments(in:many $self,up__ID:String,objectIds:String); + } + entity Books.footnotes as projection on my.Books.footnotes + actions { + @(Common.SideEffects : {TargetEntities: ['']},) + action copyAttachments(in:many $self,up__ID:String,objectIds:String); + } }