mirror of
https://github.com/azaion/admin.git
synced 2026-04-22 07:06:34 +00:00
add queue offsets to user
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
<PackageReference Include="FluentValidation" Version="11.10.0" />
|
||||
<PackageReference Include="linq2db" Version="5.4.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||
<PackageReference Include="Npgsql" Version="8.0.5" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Azaion.Common.Extensions;
|
||||
using LinqToDB;
|
||||
using LinqToDB.Mapping;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Azaion.Common.Database;
|
||||
|
||||
@@ -28,7 +29,12 @@ public static class AzaionDbSchemaHolder
|
||||
.HasDataType(DataType.Guid)
|
||||
.Property(x => x.Role)
|
||||
.HasDataType(DataType.Text)
|
||||
.HasConversion(v => v.ToString(), v => (RoleEnum)Enum.Parse(typeof(RoleEnum), v));
|
||||
.HasConversion(v => v.ToString(), v => (RoleEnum)Enum.Parse(typeof(RoleEnum), v))
|
||||
.Property(x => x.UserConfig)
|
||||
.HasConversion(
|
||||
v => v == null ? null : JsonConvert.SerializeObject(v),
|
||||
p => string.IsNullOrEmpty(p) ? new UserConfig() : JsonConvert.DeserializeObject<UserConfig>(p))
|
||||
.IsNullable();
|
||||
|
||||
|
||||
builder.Build();
|
||||
|
||||
@@ -8,5 +8,19 @@ public class User
|
||||
public string? Hardware { get; set; }
|
||||
public RoleEnum Role { get; set; }
|
||||
|
||||
public UserConfig? UserConfig { get; set; } = null!;
|
||||
|
||||
public static string GetCacheKey(string email) => $"{nameof(User)}.{email}";
|
||||
}
|
||||
|
||||
public class UserConfig
|
||||
{
|
||||
public UserQueueOffsets? QueueConfig { get; set; } = new();
|
||||
}
|
||||
|
||||
public class UserQueueOffsets
|
||||
{
|
||||
public int AnnotationsOffset { get; set; }
|
||||
public int AnnotationsConfirmOffset { get; set; }
|
||||
public int AnnotationsCommandsOffset { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user