mirror of
https://github.com/ENSL/ensl_gathers.git
synced 2024-11-23 12:52:15 +00:00
22 lines
405 B
JavaScript
22 lines
405 B
JavaScript
|
/*
|
||
|
* Events Controller
|
||
|
*
|
||
|
* Server API
|
||
|
* event:append - New event to be added to history
|
||
|
*
|
||
|
*/
|
||
|
|
||
|
const winston = require("winston");
|
||
|
const pubsub = require("./pubsub.js");
|
||
|
|
||
|
module.exports = namespace => {
|
||
|
pubsub.on("newEvent", event => {
|
||
|
if (!event.public) return;
|
||
|
namespace.emit("event:append", {
|
||
|
type: event.type,
|
||
|
description: event.description,
|
||
|
createdAt: event.createdAt
|
||
|
})
|
||
|
});
|
||
|
};
|