Compare commits
1 Commits
CAA265-nod
...
CAA265-nod
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
162bdb5b90 |
@@ -1,3 +1,3 @@
|
|||||||
# Final state of exercise 3 for CAA265 - Rapid Service Development with SAP Cloud Application Programming Model
|
# Final state after exercise 2 for CAA265 - Rapid Service Development with SAP Cloud Application Programming Model
|
||||||
|
|
||||||
**DO NOT MERGE IN MASTER**
|
**DO NOT MERGE IN MASTER**
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"cds_version": "^3.17.4"
|
|
||||||
}
|
|
||||||
@@ -9,7 +9,6 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@sap/capire-products": "^1.0.0",
|
"@sap/capire-products": "^1.0.0",
|
||||||
"reviews-service": "file:packages/reviews-service-1.0.0.tgz",
|
|
||||||
"@sap/cds": "^3.17.4",
|
"@sap/cds": "^3.17.4",
|
||||||
"express": "^4.17.1"
|
"express": "^4.17.1"
|
||||||
},
|
},
|
||||||
@@ -17,16 +16,5 @@
|
|||||||
"build": "cds build/all --clean",
|
"build": "cds build/all --clean",
|
||||||
"deploy": "cds deploy",
|
"deploy": "cds deploy",
|
||||||
"start": "cds run"
|
"start": "cds run"
|
||||||
},
|
|
||||||
"cds": {
|
|
||||||
"requires": {
|
|
||||||
"sap.capire.reviews.ReviewsService": {
|
|
||||||
"model": "reviews-service",
|
|
||||||
"kind": "odata",
|
|
||||||
"credentials": {
|
|
||||||
"file": "default"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,11 +14,4 @@ service CatalogService {
|
|||||||
using { sap.capire.products.AdminService } from '@sap/capire-products';
|
using { sap.capire.products.AdminService } from '@sap/capire-products';
|
||||||
extend service AdminService with {
|
extend service AdminService with {
|
||||||
entity Authors as projection on my.Authors;
|
entity Authors as projection on my.Authors;
|
||||||
}
|
|
||||||
|
|
||||||
// Adding reviews via capire-reviews service
|
|
||||||
using { sap.capire.reviews.ReviewsService as external} from 'reviews-service';
|
|
||||||
|
|
||||||
extend service CatalogService {
|
|
||||||
@readonly entity Reviews @(cds.persistence.skip) as projection on external.Reviews;
|
|
||||||
}
|
}
|
||||||
@@ -15,21 +15,4 @@ module.exports = async (srv) => {
|
|||||||
}
|
}
|
||||||
})))
|
})))
|
||||||
})
|
})
|
||||||
|
|
||||||
const reviews_srv = await cds.connect.to('sap.capire.reviews.ReviewsService')
|
|
||||||
|
|
||||||
// react on event messages from reviews service
|
|
||||||
reviews_srv.on('reviewed', (msg) => {
|
|
||||||
console.debug('> received', msg)
|
|
||||||
})
|
|
||||||
|
|
||||||
// delegate requests to reviews service
|
|
||||||
srv.on('READ', 'Reviews', async (req) => {
|
|
||||||
const { Reviews } = reviews_srv.entities
|
|
||||||
|
|
||||||
const tx = reviews_srv.transaction(req)
|
|
||||||
const results = await tx.read(Reviews)
|
|
||||||
|
|
||||||
return results
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
Binary file not shown.
Reference in New Issue
Block a user