* start with group permissions implementation * refactor group dto stuff * adjustments to api as necessary from client * more api refactor for UserData * use implicit usings and file scoped namespaces * fix userpermissionsextensions * fix extenions * add more comparers * adjust comparers * remove admin stuff (tbd migration to discord bot) * adjust extensions * code style for api --------- Co-authored-by: rootdarkarchon <root.darkarchon@outlook.com>
20 lines
574 B
C#
20 lines
574 B
C#
using System.Security.Cryptography;
|
|
using Newtonsoft.Json;
|
|
|
|
namespace MareSynchronos.API.Data;
|
|
|
|
public abstract class HashableDataBase
|
|
{
|
|
protected HashableDataBase()
|
|
{
|
|
DataHash = new(() =>
|
|
{
|
|
var json = JsonConvert.SerializeObject(this, Formatting.None);
|
|
var hash = SHA256.HashData(System.Text.Encoding.UTF8.GetBytes(json));
|
|
return BitConverter.ToString(hash).ToUpperInvariant().Replace("-", "", StringComparison.OrdinalIgnoreCase);
|
|
});
|
|
}
|
|
|
|
[JsonIgnore]
|
|
public Lazy<string> DataHash { get; }
|
|
} |