fixing reviews sample
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
cds.requires.messaging.kind = file-based-messaging
|
||||
cds.odata.skipValidation = true
|
||||
PORT = 5005
|
||||
@@ -10,7 +10,7 @@ service ReviewsService {
|
||||
annotate Reviews with {
|
||||
subject @mandatory;
|
||||
title @mandatory;
|
||||
rating @mandatory @assert.enum;
|
||||
rating @assert.enum;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user