Compare commits

..

12 Commits

Author SHA1 Message Date
Christian Georgi
0e894313c3 Update README.md 2020-04-20 17:11:43 +02:00
Christian Georgi
83ea6a363d Add package-lock.json, fix readme 2020-04-02 16:12:08 +02:00
Christian Georgi
98cf14101a Update readme 2020-03-23 17:10:22 +01:00
D065023
401ff039ff rm other packages 2020-03-20 10:52:10 +01:00
D065023
4d8b887389 Merge branch 'OpenSAP-week4-unit1' of https://github.com/SAP-samples/cloud-cap-samples into OpenSAP-week4-unit1 2020-03-16 09:25:38 +01:00
D065023
8ab6a7ebf6 added package-lock 2020-03-16 09:25:32 +01:00
Dr. David Kunz
09eb51fa32 Update package.json 2020-02-11 11:49:25 +01:00
D065023
7a6a6a0257 rm req 2020-01-29 15:21:47 +01:00
D065023
f17c5bfa57 rm amqp 2020-01-29 15:20:23 +01:00
D065023
85498a9875 added default 2020-01-29 15:18:20 +01:00
D065023
19b09645db rm imported 2020-01-29 15:04:51 +01:00
D065023
9861b05f2d imported 2020-01-29 14:57:38 +01:00
8 changed files with 5 additions and 5718 deletions

View File

@@ -11,7 +11,7 @@ In SAP Business Application Studio, open a terminal.
Then clone the repo with this specific branch: Then clone the repo with this specific branch:
```sh ```sh
git clone https://github.com/sap-samples/cloud-cap-samples projects/cloud-cap-samples -b openSAP-week4-unit2-final git clone https://github.com/sap-samples/cloud-cap-samples projects/cloud-cap-samples -b openSAP-week4-unit1
cd projects/cloud-cap-samples cd projects/cloud-cap-samples
``` ```

View File

@@ -35,8 +35,8 @@ entity Authors : managed {
entity Orders : cuid, managed { entity Orders : cuid, managed {
OrderNo : String @title : 'Order Number'; //> readable key OrderNo : String @title : 'Order Number'; //> readable key
status : Status default 'processing'; status : Status default 'processing';
Items : Composition of many OrderItems Items : Composition of many OrderItems
on Items.parent = $self; on Items.parent = $self;
total : Decimal(9, 2)@readonly; total : Decimal(9, 2)@readonly;
currency : Currency; currency : Currency;

View File

@@ -13,16 +13,5 @@
}, },
"scripts": { "scripts": {
"start": "npx cds run" "start": "npx cds run"
},
"cds": {
"requires": {
"API_BUSINESS_PARTNER": {
"kind": "odata",
"model": "srv/external/API_BUSINESS_PARTNER",
"--credentials": {
"destination": "cap-api098"
}
}
}
} }
} }

View File

@@ -1,5 +1,4 @@
using { sap.capire.bookshop as my } from '../db/schema'; using { sap.capire.bookshop as my } from '../db/schema';
using { API_BUSINESS_PARTNER as external } from './external/API_BUSINESS_PARTNER.csn';
@path:'/browse' @path:'/browse'
service CatalogService { service CatalogService {
@@ -8,14 +7,6 @@ service CatalogService {
author.name as author author.name as author
} excluding { createdBy, modifiedBy }; } excluding { createdBy, modifiedBy };
@readonly entity BusinessPartners as projection on external.A_BusinessPartner {
key BusinessPartner as ID,
FirstName,
MiddleName,
LastName,
BusinessPartnerIsBlocked
};
@requires_: 'authenticated-user' @requires_: 'authenticated-user'
@insertonly entity Orders as projection on my.Orders; @insertonly entity Orders as projection on my.Orders;

View File

@@ -1,12 +1,10 @@
const cds = require('@sap/cds') const cds = require('@sap/cds')
/** Service implementation for CatalogService */ /** Service implementation for CatalogService */
module.exports = cds.service.impl(async function () { module.exports = cds.service.impl(function () {
const { Books, Orders, BusinessPartners } = this.entities const { Books, Orders } = this.entities
const bupaSrv = await cds.connect.to('API_BUSINESS_PARTNER')
this.after('READ', Books, each => each.stock > 111 && _addDiscount2(each, 11)) this.after('READ', Books, each => each.stock > 111 && _addDiscount2(each, 11))
this.before('CREATE', Orders, _reduceStock) this.before('CREATE', Orders, _reduceStock)
this.on('READ', BusinessPartners, req => bupaSrv.tx(req).run(req.query))
/** Add some discount for overstocked books */ /** Add some discount for overstocked books */
function _addDiscount2(each, discount) { function _addDiscount2(each, discount) {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +0,0 @@
BusinessPartner;FirstName;MiddleName;LastName;BusinessPartnerIsBlocked
ALICE;Alice;In;Wonderland;false
BOB;Bob;The;Builder;false
JABBA;Jabba;The;Hutt;true
1 BusinessPartner FirstName MiddleName LastName BusinessPartnerIsBlocked
2 ALICE Alice In Wonderland false
3 BOB Bob The Builder false
4 JABBA Jabba The Hutt true