review/reviewed -> reviewed

This commit is contained in:
D065023
2020-09-15 16:36:04 +02:00
parent a71aaf75a1
commit d8308fe7a3
3 changed files with 4 additions and 4 deletions

View File

@@ -20,7 +20,7 @@ cds.once('served', async ({CatalogService}) => {
return SELECT(columns).from(Reviews).limit(limit).where({subject:String(id)})
}))
messaging.on ('review/reviewed', (msg) => {
messaging.on ('reviewed', (msg) => {
console.debug ('> received:', msg.event, msg.data)
const { subject, rating } = msg.data
return UPDATE(Books,subject).with({rating})

View File

@@ -18,7 +18,7 @@ module.exports = cds.service.impl (async function(){
)
const msgTx = messaging.tx(req)
global.it || console.log ('< emitting:', 'reviewed', { subject, rating })
msgTx.emit ('review/reviewed', { subject, rating })
msgTx.emit ('reviewed', { subject, rating })
})
// Increment counter for reviews considered helpful

View File

@@ -24,11 +24,11 @@ describe('Messaging', ()=>{
let N=0, received=[], M=0
it ('should add messaging event handlers', ()=>{
messaging.on('review/reviewed', (msg,next)=> { received.push(msg); return next() })
messaging.on('reviewed', (msg,next)=> { received.push(msg); return next() })
})
it ('should add more messaging event handlers', ()=>{
messaging.on('review/reviewed', (_,next)=> { ++M; return next() })
messaging.on('reviewed', (_,next)=> { ++M; return next() })
})
it ('should add review', async ()=>{