49 lines
1.1 KiB
C#
49 lines
1.1 KiB
C#
using System.Net.Http.Headers;
|
|
using System.Text.Json;
|
|
using System.Text.Json.Serialization;
|
|
using Confluent.Kafka;
|
|
|
|
namespace Kafka.Lib.Auth;
|
|
|
|
public class UserChangeMessageType : IMessageType
|
|
{
|
|
private string? _userId;
|
|
private Dictionary<string, string> _changes = new Dictionary<string, string>();
|
|
private string? _id;
|
|
private readonly string _eventType = "NewUser";
|
|
|
|
public string? UserId
|
|
{
|
|
get => _userId;
|
|
set => _userId = value;
|
|
}
|
|
|
|
public Dictionary<string, string> Changes
|
|
{
|
|
get => _changes;
|
|
set => _changes = value;
|
|
}
|
|
|
|
public string? Id
|
|
{
|
|
get => _id;
|
|
set => _id = value;
|
|
}
|
|
|
|
public string EventType => _eventType;
|
|
|
|
[JsonIgnore]
|
|
public string Text
|
|
{
|
|
get => JsonSerializer.Serialize(this);
|
|
set
|
|
{
|
|
var val = JsonSerializer.Deserialize<UserChangeMessageType>(value);
|
|
if (val == null) throw new MessageNullException();
|
|
|
|
_changes = val.Changes;
|
|
_userId = val.UserId;
|
|
_id = val.Id;
|
|
}
|
|
}
|
|
} |