review/reviewed -> reviewed
This commit is contained in:
@@ -20,7 +20,7 @@ cds.once('served', async ({CatalogService}) => {
|
|||||||
return SELECT(columns).from(Reviews).limit(limit).where({subject:String(id)})
|
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)
|
console.debug ('> received:', msg.event, msg.data)
|
||||||
const { subject, rating } = msg.data
|
const { subject, rating } = msg.data
|
||||||
return UPDATE(Books,subject).with({rating})
|
return UPDATE(Books,subject).with({rating})
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ module.exports = cds.service.impl (async function(){
|
|||||||
)
|
)
|
||||||
const msgTx = messaging.tx(req)
|
const msgTx = messaging.tx(req)
|
||||||
global.it || console.log ('< emitting:', 'reviewed', { subject, rating })
|
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
|
// Increment counter for reviews considered helpful
|
||||||
|
|||||||
@@ -24,11 +24,11 @@ describe('Messaging', ()=>{
|
|||||||
|
|
||||||
let N=0, received=[], M=0
|
let N=0, received=[], M=0
|
||||||
it ('should add messaging event handlers', ()=>{
|
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', ()=>{
|
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 ()=>{
|
it ('should add review', async ()=>{
|
||||||
|
|||||||
Reference in New Issue
Block a user