fixed git clone link

This commit is contained in:
Daniel
2020-03-02 18:33:30 +01:00
parent 2744fe1d9c
commit 93579f83f2
4 changed files with 9 additions and 4 deletions

View File

@@ -15,7 +15,8 @@ Clone this repo as shown below, if you have [git](https://git-scm.com/downloads)
otherwise [download as zip file](archive/master.zip).
```sh
git clone https://github.com/sap-samples/cloud-cap-samples samples
# git clone https://github.com/sap-samples/cloud-cap-samples samples
git clone https://github.com/SAP-samples/cloud-cap-samples -b cap-samples-reloaded samples
cd samples
```

View File

@@ -25,7 +25,7 @@ GET http://localhost:4004/reviews/Reviews?
POST http://localhost:4004/reviews/Reviews
Content-Type: application/json;IEEE754Compatible=true
{"subject":"201", "rating":"5", "title":"boo"}
{"subject":"201", "title":"boo"}
@@ -37,4 +37,4 @@ GET http://localhost:5005/reviews/Reviews?
POST http://localhost:5005/reviews/Reviews
Content-Type: application/json;IEEE754Compatible=true
{"subject":"201", "rating":"5", "title":"boo"}
{"subject":"201", "title":"boo"}

View File

@@ -5,6 +5,10 @@ module.exports = cds.service.impl (function(){
// ( Note: we explicitly specify the namespace to support embedded reuse )
const { Reviews, Likes } = this.entities ('sap.capire.reviews')
this.before (['CREATE','UPDATE','DELETE'], 'Reviews', req => {
if (!req.data.rating) req.data.rating = Math.round(Math.random()*4)+1
})
// Emit an event to inform subscribers about new avg ratings for reviewed subjects
// ( Note: req.on.succeeded ensures we only do that if there's no error )
this.after (['CREATE','UPDATE','DELETE'], 'Reviews', async(_,req) => {

View File

@@ -10,7 +10,7 @@ POST http://localhost:5005/reviews/Reviews
# POST http://localhost:4004/reviews/Reviews
Content-Type: application/json;IEEE754Compatible=true
{"subject":"201", "rating":"5", "title":"boo"}
{"subject":"201", "rating":"4", "title":"boo"}
### Direct Request to ReviewsService
# Note: use 5005 instead of 4004 in case of separate service