From 3eac30a1e3c7c7ad280f73849836f4b03b4db8b9 Mon Sep 17 00:00:00 2001 From: nfel Date: Mon, 14 Jul 2025 15:21:03 +0330 Subject: [PATCH] v2: events (WIP) Signed-off-by: nfel --- alert/v1/msg.proto | 53 ++++++++++++++++++++++++++++++++-------------- alert/v1/srv.proto | 1 + 2 files changed, 38 insertions(+), 16 deletions(-) diff --git a/alert/v1/msg.proto b/alert/v1/msg.proto index 85ce167..0799a14 100644 --- a/alert/v1/msg.proto +++ b/alert/v1/msg.proto @@ -2,8 +2,8 @@ syntax = "proto3"; package alert.v1; -import "base/v1/msg.proto"; import "auth/v1/msg.proto"; +import "base/v1/msg.proto"; message AlertFilter { base.v1.BaseQueryParam base_filter = 1; @@ -13,19 +13,35 @@ message AlertFilter { // Importance of given event enum Importance { - LOW = 0; // Low Severity ( unimportant and can be ignored ) - MEDIUM = 1; // MEDIUM Severity - HIGH = 2; // High Severity + LOW = 0; // Low Severity ( unimportant and can be ignored ) + MEDIUM = 1; // MEDIUM Severity + HIGH = 2; // High Severity CRITICAL = 3; // CRITICAL Severity ( can cause panics and data lost ) } -enum LogSource { - UNKNOWN = 0; - USER = 1; - SYSTEM = 2; - WALLET = 3; +enum LogType { + TYPE_UNKNOWN = 0; + TYPE_SMS = 1; + TYPE_EMAIL = 2; + TYPE_PUSH = 3; } +enum LogLevel { + LVL_UNKNOWN = 0; + LVL_INFO = 1; + LVL_SUCCESS = 2; + LVL_WARN = 3; + LVL_ERROR = 4; +} + +enum LogSource { + SRC_UNKNOWN = 0; + SRC_USER = 1; + SRC_SYSTEM = 2; + SRC_WALLET = 3; +} + + message Meta { uint32 created_at_ts = 1; uint32 updated_at_ts = 2; @@ -34,14 +50,17 @@ message Meta { message LogEvent { auth.v1.InternalIAM iam = 1; - optional uint64 id = 2; // Record Id of Log stored in db - string content = 3; - optional LogSource source = 4; - Importance importance = 5; - Meta meta = 6; + optional uint64 id = 2; // Record Id of Log stored in db + LogSource source = 3; + Importance importance = 4; + LogLevel level = 5; + string content = 6; + Meta meta = 7; } -message LogEventList { repeated LogEvent events = 1; } +message LogEventList { + repeated LogEvent events = 1; +} /* Internal Msg */ @@ -59,4 +78,6 @@ message SMS { repeated SMSChangeLog change_log = 5; } -message SMSList { repeated SMS sms = 1; } +message SMSList { + repeated SMS sms = 1; +} diff --git a/alert/v1/srv.proto b/alert/v1/srv.proto index a2d3112..0de2f2e 100644 --- a/alert/v1/srv.proto +++ b/alert/v1/srv.proto @@ -11,3 +11,4 @@ service AlertSrv { // rpc Update(LogEvent) returns (base.v1.StatusRes) {} // rpc Get(AlertFilter) returns (base.v1.StatusRes) {} } +