Create virus scan model to store clamav result

This commit is contained in:
Mathieu Magnin 2018-05-11 14:59:20 +02:00
parent 645d112f5c
commit 927cd3c6f4
4 changed files with 40 additions and 0 deletions

17
app/models/virus_scan.rb Normal file
View file

@ -0,0 +1,17 @@
class VirusScan < ApplicationRecord
belongs_to :champ
enum status: {
pending: 'pending',
safe: 'safe',
infected: 'infected',
}
validates :champ_id, uniqueness: { scope: :blob_key }
after_create :perform_scan
def perform_scan
AntiVirusJob.perform_later(self)
end
end