@speakr/speakr-module-services
Version:
SPEAKR Shared Service Module
23 lines (18 loc) • 488 B
JavaScript
;
const db = require('../../db');
module.exports = {
published
};
function published(creative, config) {
return db.creatives_status_types.findOrCreate({ where: {
type: 'Published',
platform_id: creative.platform_id
}})
.spread((statusType) =>
db.creatives_statuses.create({
message: config.message,
creatives_status_types_id: statusType.id,
creative_id: creative.id
})
.then((status) => console.log(`Creative ${creative.id} published.`)))
}