# 删除课堂时将相应的课堂消息置为删除状态，并给老师发送删除消息
class DeleteCourseNotifyJob < ApplicationJob
  queue_as :notify

  def perform(course_id, user_id)
    course = Course.find_by(id: course_id)
    return if course.blank?

    Tiding.where(belong_container: course).update_all(is_delete: 1)
    Tiding.create!(user_id: user_id, trigger_user_id: user_id, container_id: course.id,
                   container_type: 'DeleteCourse', tiding_type: 'System', belong_container: course, extra: course.name)
  end
end
