2012-07-31 01:32:49 -04:00
|
|
|
module Notes
|
2014-01-16 12:03:42 -05:00
|
|
|
class CreateService < BaseService
|
2012-07-31 01:32:49 -04:00
|
|
|
def execute
|
2014-06-17 15:09:01 -04:00
|
|
|
note = project.notes.new(params)
|
2012-07-31 01:32:49 -04:00
|
|
|
note.author = current_user
|
2014-02-20 07:07:42 -05:00
|
|
|
note.system = false
|
2014-06-17 15:09:01 -04:00
|
|
|
|
|
|
|
if note.save
|
2016-01-27 10:59:16 -05:00
|
|
|
# Finish the harder work in the background
|
|
|
|
NewNoteWorker.perform_in(2.seconds, note.id, params)
|
2016-02-20 08:59:59 -05:00
|
|
|
TodoService.new.new_note(note, current_user)
|
2014-06-17 15:09:01 -04:00
|
|
|
end
|
|
|
|
|
2012-07-31 01:32:49 -04:00
|
|
|
note
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|