Update reviews/srv/reviews-service.js
Co-authored-by: Daniel Hutzel <daniel.hutzel@sap.com>
This commit is contained in:
@@ -16,9 +16,8 @@ module.exports = cds.service.impl (async function(){
|
|||||||
const {rating} = await cds.transaction(req) .run (
|
const {rating} = await cds.transaction(req) .run (
|
||||||
SELECT.one (['round(avg(rating),2) as rating']) .from (Reviews) .where ({subject})
|
SELECT.one (['round(avg(rating),2) as rating']) .from (Reviews) .where ({subject})
|
||||||
)
|
)
|
||||||
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 })
|
messaging.tx(req).emit ('review/reviewed', { subject, rating })
|
||||||
})
|
})
|
||||||
|
|
||||||
// Increment counter for reviews considered helpful
|
// Increment counter for reviews considered helpful
|
||||||
|
|||||||
Reference in New Issue
Block a user