mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-16 22:25:30 +08:00
9d4c97f191
* Add user assignment to task API [SCI-6846] * Add test for task assignments [SCI-6846]
21 lines
804 B
Ruby
21 lines
804 B
Ruby
# frozen_string_literal: true
|
|
|
|
class UserMyModule < ApplicationRecord
|
|
validates :user, presence: true, uniqueness: { scope: :my_module }
|
|
validates :my_module, presence: true
|
|
|
|
belongs_to :user, inverse_of: :user_my_modules, touch: true
|
|
belongs_to :assigned_by, foreign_key: 'assigned_by_id', class_name: 'User', optional: true
|
|
belongs_to :my_module, inverse_of: :user_my_modules, touch: true
|
|
|
|
def log_activity(type_of, current_user)
|
|
Activities::CreateActivityService
|
|
.call(activity_type: type_of,
|
|
owner: current_user,
|
|
team: my_module.experiment.project.team,
|
|
project: my_module.experiment.project,
|
|
subject: my_module,
|
|
message_items: { my_module: my_module.id,
|
|
user_target: user.id })
|
|
end
|
|
end
|