From 84753ad9334172992574cc23f7e2e79ae9e741e8 Mon Sep 17 00:00:00 2001 From: jiikko Date: Sat, 7 Jan 2023 11:07:30 +0900 Subject: [PATCH] =?UTF-8?q?event-type=20warn=E3=82=92=E5=8F=97=E3=81=91?= =?UTF-8?q?=E5=8F=96=E3=82=8C=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E3=81=99?= =?UTF-8?q?=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/event.rb | 3 ++- app/services/api/save_event_service.rb | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/models/event.rb b/app/models/event.rb index 3430c4e4..89e3ee57 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -1,12 +1,13 @@ class Event < ApplicationRecord serialize :body, JSON - enum event_type: { boot: 0, reload_config: 10, load_config: 20, heartbeat: 30, error: 40, start_reboot: 50, } + enum event_type: { boot: 0, reload_config: 10, load_config: 20, heartbeat: 30, error: 40, warn: 45, start_reboot: 50, } belongs_to :pbm_session def self.event_types [ OpenStruct.new(name: :error), + OpenStruct.new(name: :warn), OpenStruct.new(name: :boot), OpenStruct.new(name: :load_config), OpenStruct.new(name: :reload_config), diff --git a/app/services/api/save_event_service.rb b/app/services/api/save_event_service.rb index 84be4e2b..bc200238 100644 --- a/app/services/api/save_event_service.rb +++ b/app/services/api/save_event_service.rb @@ -50,6 +50,8 @@ def self.execute!(session_id: , hostname: , event_type: , body: , device_id: ) end when "error" next pbm_session.events.create!(event_type: :error, body: body) + when "warn" + next pbm_session.events.create!(event_type: :warn, body: body) end end end