Skip to content
Draft
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: 9 additions & 12 deletions tutorials/cp-cap-java-service-reuse/cp-cap-java-service-reuse.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,35 +106,32 @@ Now that you have created your bookstore project, you need to define the domain

```CDS
namespace sap.capire.bookstore;

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suppose the remove those blank lines. I understand that it improves readability, but in a tutorial where this is copied, it just increases the size of the document.

using { Currency, cuid, managed } from '@sap/cds/common';
using { sap.capire.products.Products } from '@sap/capire-products';

entity Books as projection on Products; extend Products with {
// Note: we map Books to Products to allow reusing AdminService as is
author : Association to Authors;
}

entity Authors : cuid {
firstname : String(111);
lastname : String(111);
books : Association to many Books on books.author = $self;
}

@Capabilities.Updatable: false
entity Orders : cuid, managed {
items : Composition of many OrderItems on items.parent = $self;
items : Composition of many {
book_ID : UUID;
amount : Integer;
netAmount : Decimal(9,2) @readonly;
};
total : Decimal(9,2) @readonly;
currency : Currency;
}

@Capabilities.Updatable: false
entity OrderItems : cuid {
parent : Association to Orders not null;
book_ID : UUID;
amount : Integer;
netAmount : Decimal(9,2) @readonly;
}
```

The domain model defines four entities:
Expand Down