From 9291e8e7c9354a5abb0713f1b24bef2cd1c03322 Mon Sep 17 00:00:00 2001 From: Daniel Hutzel Date: Tue, 31 Oct 2023 15:36:45 +0530 Subject: [PATCH 1/4] . --- README.md | 8 +- etc/dark.drawio.svg | 141 ++++++++++++++----------- etc/incidents.drawio.svg | 116 ++++++++++----------- etc/samples.drawio.svg | 216 ++++++++++++++++++++++++++++++++++++++- samples.md | 2 + 5 files changed, 361 insertions(+), 122 deletions(-) diff --git a/README.md b/README.md index f9056c3c..7d49bf50 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,16 @@ # Welcome to cap/samples -Find here a collection of samples for the [SAP Cloud Application Programming Model](https://cap.cloud.sap) organized in a simplistic [monorepo setup](samples.md#all-in-one-monorepo). → See [**Overview** of contained samples](samples.md) +Find here a collection of samples for the [SAP Cloud Application Programming Model](https://cap.cloud.sap) organized in a simplistic [monorepo setup](samples.md#all-in-one-monorepo). + +[See **Overview** of contained samples](samples.md): + +![](etc/samples.drawio.svg) ![](https://github.com/SAP-samples/cloud-cap-samples/workflows/CI/badge.svg) [![REUSE status](https://api.reuse.software/badge/github.com/SAP-samples/cloud-cap-samples)](https://api.reuse.software/info/github.com/SAP-samples/cloud-cap-samples) + + ### Preliminaries 1. Ensure you have the latest LTS version of Node.js installed (see [Getting Started](https://cap.cloud.sap/docs/get-started/)) diff --git a/etc/dark.drawio.svg b/etc/dark.drawio.svg index 6a8892e9..6a04d573 100644 --- a/etc/dark.drawio.svg +++ b/etc/dark.drawio.svg @@ -1,13 +1,13 @@ - + - + - -
-
-
+ +
+
+
@capire/
@@ -17,39 +17,39 @@
- + @capire/... - + - -
-
-
+ +
+
+
@capire/
- fiori + bookstore
- + @capire/... - + - -
-
-
+ +
+
+
@capire/
@@ -59,18 +59,18 @@
- + @capire/... - + - -
-
-
+ +
+
+
@capire/
@@ -80,18 +80,18 @@
- + @capire/... - + - -
-
-
+ +
+
+
@capire/
@@ -101,26 +101,26 @@
- + @capire/... - - - - - - - - - + + + + + + + + + - -
-
-
+ +
+
+
@capire/
@@ -130,18 +130,18 @@
- + @capire/... - + - -
-
-
+ +
+
+
S/4 @@ -149,23 +149,46 @@
- + S/4 - - - - - - + + + + + + + + + + +
+
+
+ @capire/ +
+ + fiori + +
+
+
+
+ + @capire/... + +
+
+ + - Viewer does not support full SVG 1.1 + Text is not SVG - cannot display diff --git a/etc/incidents.drawio.svg b/etc/incidents.drawio.svg index afb0d10c..50ad88b3 100644 --- a/etc/incidents.drawio.svg +++ b/etc/incidents.drawio.svg @@ -1,13 +1,13 @@ - + - + - +
-
-
+
+
S/4 HANA
@@ -21,10 +21,10 @@ - +
-
-
+
+
Business
Partner @@ -32,18 +32,18 @@
- + Business... - + - +
-
-
+
+
Incident Mgmt @@ -61,16 +61,16 @@ - +
-
-
+
+
Incidents
- + Incidents @@ -81,27 +81,27 @@ - +
-
-
+
+
Customers
- + Customers - + - +
-
-
+
+
SuccessFactors
@@ -115,10 +115,10 @@ - +
-
-
+
+
Workforce
Person @@ -126,7 +126,7 @@
- + Workforce... @@ -134,10 +134,10 @@ - +
-
-
+
+
Employee
Timesheet @@ -145,7 +145,7 @@
- + Employee... @@ -155,16 +155,16 @@ - +
-
-
+
+
Messages
- + Messages @@ -175,10 +175,10 @@ - +
-
-
+
+
Service
Worker @@ -186,7 +186,7 @@
- + Service... @@ -198,10 +198,10 @@ - +
-
-
+
+
Worker
Availability @@ -209,7 +209,7 @@
- + Worker... @@ -219,16 +219,16 @@ - +
-
-
+
+
Backend Services
- + Backend Services @@ -236,16 +236,16 @@ - +
-
-
+
+
Usage Views
- + Usage Views @@ -253,16 +253,16 @@ - +
-
-
+
+
Extension Data
- + Extension Data @@ -274,7 +274,7 @@ - Viewer does not support full SVG 1.1 + Text is not SVG - cannot display diff --git a/etc/samples.drawio.svg b/etc/samples.drawio.svg index 125b0ed8..2588e138 100644 --- a/etc/samples.drawio.svg +++ b/etc/samples.drawio.svg @@ -1,4 +1,212 @@ - - - -
Bookshop
Bookshop
Composite
App
Composite...
Reviews
Service
Reviews...
Code
Lists
Code...
Orders
Service
Orders...
Suppliers
Service
Suppliers...
S/4
S/4
Fiori
App
Fiori...
Viewer does not support full SVG 1.1
\ No newline at end of file + + + + + + + +
+
+
+ + Bookshop + +
+ App +
+
+
+
+ + Bookshop... + +
+
+ + + + +
+
+
+ + + + Bookstore +
+
+
+ App +
+
+
+
+
+
+ + Bookstore... + +
+
+ + + + +
+
+
+ + + Reviews + +
+ Service +
+
+
+
+
+
+ + Reviews... + +
+
+ + + + +
+
+
+ + Common + +
+ Data +
+
+
+
+ + Common... + +
+
+ + + + +
+
+
+ + + Orders + +
+ Service +
+
+
+
+
+
+ + Orders... + +
+
+ + + + + + + + + + + + +
+
+
+ + + Suppliers + +
+ Service +
+
+
+
+
+
+ + Suppliers... + +
+
+ + + + +
+
+
+ + S/4 + +
+
+
+
+ + S/4 + +
+
+ + + + + + + + + + +
+
+
+ + + Fiori + +
+ App +
+
+
+
+
+
+ + Fiori... + +
+
+ + +
+ + + + + Text is not SVG - cannot display + + + +
\ No newline at end of file diff --git a/samples.md b/samples.md index f5b84060..5fb85e51 100644 --- a/samples.md +++ b/samples.md @@ -3,6 +3,8 @@ The following list gives an overview of the samples provided in subdirectories. Each sub directory essentially is an individual npm package arranged in an [all-in-one monorepo](#all-in-one-monorepo) umbrella setup. +![](etc/samples.drawio.svg) + ## [@capire/hello-world](hello) From 1ea4b15d77229b238f622f9e38c8b31244d5fa04 Mon Sep 17 00:00:00 2001 From: Daniel Hutzel Date: Thu, 2 Nov 2023 08:40:01 +0530 Subject: [PATCH 2/4] . --- bookstore/srv/mashup.cds | 23 ++++++----------------- etc/samples.drawio.svg | 2 +- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/bookstore/srv/mashup.cds b/bookstore/srv/mashup.cds index 7344ff1a..74b8f4cb 100644 --- a/bookstore/srv/mashup.cds +++ b/bookstore/srv/mashup.cds @@ -4,20 +4,16 @@ // respective reuse packages and services // -using { sap.capire.bookshop.Books } from '@capire/bookshop'; // // Extend Books with access to Reviews and average ratings // +using { sap.capire.bookshop.Books } from '@capire/bookshop'; using { ReviewsService.Reviews } from '@capire/reviews'; extend Books with { reviews : Composition of many Reviews on reviews.subject = $self.ID; - - @Common.Label : '{i18n>Rating}' - rating : Decimal; - - @Common.Label : '{i18n>NumberOfReviews}' - numberOfReviews : Integer; + rating : type of Reviews:rating; // average rating + numberOfReviews : Integer @title : '{i18n>NumberOfReviews}'; } @@ -25,18 +21,11 @@ extend Books with { // Extend Orders with Books as Products // using { sap.capire.orders.Orders } from '@capire/orders'; -extend Orders with { - extend Items with { - book : Association to Books on product.ID = book.ID - } +extend Orders:Items with { + book : Association to Books on product.ID = book.ID } - -// Add orders fiori app (in case of embedded orders service) +// Ensure models from all imported packages are loaded using from '@capire/orders/app/fiori'; - -// Add data browser using from '@capire/data-viewer'; - -// Incorporate pre-build extensions from... using from '@capire/common'; diff --git a/etc/samples.drawio.svg b/etc/samples.drawio.svg index 2588e138..43febc30 100644 --- a/etc/samples.drawio.svg +++ b/etc/samples.drawio.svg @@ -1,4 +1,4 @@ - + From 1e0ac9609c8139cc83a30ddead0a6ee632d8b238 Mon Sep 17 00:00:00 2001 From: Daniel Hutzel Date: Mon, 6 Nov 2023 04:58:43 +0100 Subject: [PATCH 3/4] . --- bookshop/db/schema.cds | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/bookshop/db/schema.cds b/bookshop/db/schema.cds index f2fb626f..930f19eb 100644 --- a/bookshop/db/schema.cds +++ b/bookshop/db/schema.cds @@ -2,25 +2,25 @@ using { Currency, managed, sap } from '@sap/cds/common'; namespace sap.capire.bookshop; entity Books : managed { - key ID : Integer; - title : localized String(111) @mandatory ; - descr : localized String(1111); - author : Association to Authors @mandatory; - genre : Association to Genres; - stock : Integer; - price : Decimal; + key ID : Integer; + title : localized String(111) @mandatory; + descr : localized String(1111); + author : Association to Authors @mandatory; + genre : Association to Genres; + stock : Integer; + price : Decimal; currency : Currency; - image : LargeBinary @Core.MediaType : 'image/png'; + image : LargeBinary @Core.MediaType: 'image/png'; } entity Authors : managed { - key ID : Integer; - name : String(111) @mandatory; + key ID : Integer; + name : String(111) @mandatory; dateOfBirth : Date; dateOfDeath : Date; placeOfBirth : String; placeOfDeath : String; - books : Association to many Books on books.author = $self; + books : Association to many Books on books.author = $self; } /** Hierarchically organized Code List for Genres */ From 1ff14d3a09d7a9bcb9162e9cdf4fa80992acd874 Mon Sep 17 00:00:00 2001 From: Daniel Hutzel Date: Mon, 6 Nov 2023 05:03:10 +0100 Subject: [PATCH 4/4] cosmetics --- bookshop/srv/admin-service.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bookshop/srv/admin-service.js b/bookshop/srv/admin-service.js index 7a5d5804..d737a65a 100644 --- a/bookshop/srv/admin-service.js +++ b/bookshop/srv/admin-service.js @@ -8,6 +8,6 @@ module.exports = class AdminService extends cds.ApplicationService { init(){ /** Generate primary keys for target entity in request */ async function genid (req) { - const {ID} = await cds.tx(req).run (SELECT.one.from(req.target).columns('max(ID) as ID')) - req.data.ID = ID - ID % 100 + 100 + 1 + const {id} = await SELECT.one.from(req.target).columns('max(ID) as id') + req.data.ID = id - id % 100 + 100 + 1 }