<commit_before><commit_msg>Implement create-notice<commit_after>require! {
	'../notice': Notice
	'../../utils/publish-redis-streaming'
	'../../config'
}

# ID -> string -> Object -> Promise
module.exports = (user-id, type, content = null) -> new Promise (resolve, reject) ->
	new Notice {
		user-id
		type
		content
	}
	.save (err, created-notice) ->
		if err then reject err
		stream-obj =
			type: \notice
			value: created-notice.to-object!
		publish-redis-streaming "userStream:#user-id", to-json stream-obj
		resolve created-notice
{'fraction_non_alphanumeric': 0.1623134328358209, 'fraction_numerical': 0.0, 'mean_word_length': 3.296, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4492475', 'n_tokens_mistral': 189, 'n_tokens_neox': 177, 'n_words': 43}