Major API rework for paradigm change (#10)
* 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>
This commit is contained in:
20
MareSynchronosAPI/Data/HashableDataBase.cs
Normal file
20
MareSynchronosAPI/Data/HashableDataBase.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
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; }
|
||||
}
|
||||
Reference in New Issue
Block a user