Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(props) {
super(props);
// tinymceがかぶらないようにするためにcuidを生成
this.cuid = cuid();
}
static get createSchema() {
return Joi.object({
userId: Joi.string().required(),
id: Joi.string().default(cuid()),
createdAt: Joi.number().default(moment().unix()),
importStatus: Joi.object(),
isDelete: Joi.string().default(false.toString()),
name: Joi.string().required(),
// Not sure if this should be required
senderId: Joi.string()
});
}
decrypt(event.authToken).then((decoded) => {
if (event.template) {
const template = event.template;
template.userId = decoded.sub;
template.id = cuid();
handleScreenshot(template)
.then(templateToSave => EmailTemplate.save(templateToSave))
.then(() => cb(null, template))
.catch((e) => {
debug(e);
return cb(ApiErrors.response(e));
});
} else {
return cb(ApiErrors.response('No template specified'));
}
}).catch(err => cb(ApiErrors.response(err), null));
}
static _buildCommonEmailParams(sender, automationAction) {
logger().debug('_buildCommonEmailParams', JSON.stringify({ automationAction, sender }));
return {
id: cuid(),
userId: automationAction.userId,
sender,
status: 'scheduled',
scheduledAt: moment().unix() + (automationAction.delay || 0),
automationId: automationAction.automationId,
automationActionId: automationAction.id
};
}
export const makeTodo = (text: string, completed?: boolean) => ({
id: cuid(),
text,
completed: Boolean(completed),
});
function createAutomation(userId, event) {
const baseAutomation = { id: cuid(), userId, status: 'paused' };
const automation = Object.assign({}, event.automation, baseAutomation);
const checkParams = paramsChecker(['userId', 'listId', 'senderId', 'id']);
return checkParams(automation)
.then(validAutomation => Automation.save(validAutomation))
.then(() => automation);
}
decrypt(event.authToken).then((decoded) => {
if(decoded.sub === 'google-oauth2|113947278021199221588') throw 'Sorry, the demo account is not allowed to perform this action' //demo account
if (event.campaign) {
let campaign = event.campaign;
campaign.userId = decoded.sub;
campaign.id = cuid();
campaign.status = 'draft';
Campaign.save(campaign).then(() => {
return cb(null, campaign);
}).catch(e => {
debug(e);
return cb(ApiErrors.response(e));
});
} else {
return cb(ApiErrors.response('No campaign specified'));
}
})
.catch(err => cb(ApiErrors.response(err), null));
constructor(props) {
super(props);
this.cuid = cuid();
const { value } = props;
this.state = {
mode: S(value).isEmpty() || S(value).isNumeric() ? 'fixedValue' : 'answerValue',
};
}
updateState (message) {
this.setState({
messages: [
...this.state.messages,
{
message: 'Message...',
kitid: cuid(),
timeout: 3000,
animate: {
in : kitid => this.handleNotifyIn(kitid),
out: kitid => this.handleNotifyOut(kitid)
},
onClick: e => this.handleClose(e),
...message,
}
]
});
}