Add remaining project files
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
using LiteDB;
|
||||
using System.Globalization;
|
||||
using System.Numerics;
|
||||
using static DeluxeBackend.Enums;
|
||||
namespace DeluxeBackend.Models
|
||||
{
|
||||
public class Message
|
||||
{
|
||||
[BsonId]
|
||||
public long Id { get; set; }
|
||||
[BsonRef("accounts")]
|
||||
public required Account Player { get; set; }
|
||||
[BsonRef("accounts")]
|
||||
public required Account FromPlayer { get; set; }
|
||||
public DateTime SentTime { get; set; } = DateTime.UtcNow;
|
||||
public required MessageType Type { get; set; }
|
||||
public string Data { get; set; } = string.Empty;
|
||||
|
||||
public Dictionary<string, object> ToDictionary()
|
||||
{
|
||||
string daya = string.Empty;
|
||||
if (Data != null)
|
||||
{
|
||||
daya = Data;
|
||||
}
|
||||
var data = new Dictionary<string, object>
|
||||
{
|
||||
["Id"] = Id,
|
||||
["FromPlayerId"] = FromPlayer.Id,
|
||||
["SentTime"] = SentTime.ToString("o", CultureInfo.InvariantCulture),
|
||||
["Type"] = (int)Type,
|
||||
["Data"] = daya
|
||||
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user