fixing reviews sample

This commit is contained in:
Daniel
2020-10-22 18:06:04 +02:00
committed by Daniel Hutzel
parent 363e9aa9a8
commit c424517770
3 changed files with 5 additions and 14 deletions

View File

@@ -8,10 +8,12 @@ const cds = require ('@sap/cds')
// Connect CatalogService and ReviewsService when all are served...
cds.once('served', async ({CatalogService}) => {
const ReviewsService = await cds.connect.to('ReviewsService')
const messaging = await cds.connect.to('messaging')
// reflect entity definitions used below...
const { Books } = cds.entities('sap.capire.bookshop')
const { Reviews } = cds.entities('ReviewsService')
const messaging = await cds.connect.to('messaging')
const { Reviews } = ReviewsService.entities
// prepend the following handler so it overrides the default handler
CatalogService.prepend (srv => srv.on ('READ', 'Books/reviews', (req) => {
@@ -28,15 +30,5 @@ cds.once('served', async ({CatalogService}) => {
})
// Other bootstrapping events you could hook in to...
/* eslint-disable no-unused-vars */
cds.on('bootstrap',(app) => {/* ... */})
cds.on('loaded', (model) => {/* ... */})
cds.on('connect', (srv) => {/* ... */})
cds.on('serving', (srv) => {/* ... */})
cds.once('served', (all) => {/* ... */})
cds.once('listening', ({server,url}) => {/* ... */})
// Delegate bootstrapping to built-in server.js
module.exports = cds.server

View File

@@ -1,3 +1,2 @@
cds.requires.messaging.kind = file-based-messaging
cds.odata.skipValidation = true
PORT = 5005

View File

@@ -10,7 +10,7 @@ service ReviewsService {
annotate Reviews with {
subject @mandatory;
title @mandatory;
rating @mandatory @assert.enum;
rating @assert.enum;
}
}