Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions cap-notebook/demoapp/db/schema.cds
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,24 @@ entity Genres : CodeList {
children : Composition of many Genres
on children.parent = $self;
}

/** Adding {Notebooks,Writers} for user service */
entity Notebooks : managed, cuid {
@mandatory title : localized String(111);
descr : localized String(1111);
@mandatory writer : Association to Writers;
stock : Integer;
price : Decimal;
currency : Currency;
image : LargeBinary @Core.MediaType: 'image/png';
}

entity Writers : managed, cuid {
@mandatory name : String(111);
dateOfBirth : Date;
dateOfDeath : Date;
placeOfBirth : String;
placeOfDeath : String;
notebooks : Association to many Notebooks
on notebooks.writer = $self;
}
9 changes: 8 additions & 1 deletion cap-notebook/demoapp/srv/attachment-extension.cds
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
using {sap.capire.bookshop.Books} from '../db/schema';
using {sap.capire.bookshop.Books, sap.capire.bookshop.Notebooks} from '../db/schema';
using {sap.attachments.Attachments, sap.attachments.StatusCode} from`com.sap.cds/sdm`;

extend entity Books with {
attachments : Composition of many Attachments @SDM.Attachments:{maxCount: 4, maxCountError:'Only 4 attachments allowed.'};
references : Composition of many Attachments @SDM.Attachments:{maxCount: 2, maxCountError: 'Only 2 attachments allowed'};
footnotes : Composition of many Attachments;
}

extend entity Notebooks with {
attachments : Composition of many Attachments @SDM.Attachments:{maxCount: 4, maxCountError:'Only 4 attachments allowed.'};
references : Composition of many Attachments @SDM.attachments:{maxCount: 2, maxCountError:'Only 2 attachments allowed.'};
footnotes : Composition of many Attachments;

}
entity Statuses @cds.autoexpose @readonly {
key code : StatusCode;
text : localized String(255);
Expand Down
10 changes: 10 additions & 0 deletions cap-notebook/demoapp/srv/user-service.cds
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using {sap.capire.bookshop as my} from '../db/schema';

service UserService @(requires: [
'admin',
'system-user'
]) {
@odata.draft.enabled
entity Notebooks as projection on my.Notebooks;
entity Writers as projection on my.Writers;
}
Loading