overview_sorting.rb 624 B

1234567891011121314151617181920212223
  1. # Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. class User::OverviewSorting < ApplicationModel
  3. include CanPriorization
  4. belongs_to :user, class_name: 'User'
  5. belongs_to :overview
  6. belongs_to :created_by, class_name: 'User'
  7. belongs_to :updated_by, class_name: 'User'
  8. default_scope { order(:prio, :id) }
  9. def self.prio_create(id:, prio:, current_user:)
  10. overview = Overview.find(id)
  11. User::OverviewSorting.create!(
  12. user: current_user,
  13. overview: overview,
  14. prio: prio,
  15. created_by: current_user,
  16. updated_by: current_user
  17. )
  18. end
  19. end