move shared content to shared project
This commit is contained in:
@@ -0,0 +1,217 @@
|
||||
using System.Security.Claims;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Text.Encodings.Web;
|
||||
using MareSynchronosServer;
|
||||
using MareSynchronosServer.Metrics;
|
||||
using MareSynchronosShared.Data;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using ISystemClock = Microsoft.AspNetCore.Authentication.ISystemClock;
|
||||
|
||||
namespace MareSynchronosShared.Authentication
|
||||
{
|
||||
public class FailedAuthorization : IDisposable
|
||||
{
|
||||
private int failedAttempts = 1;
|
||||
public int FailedAttempts => failedAttempts;
|
||||
public Task ResetTask { get; set; }
|
||||
public CancellationTokenSource? ResetCts { get; set; }
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
try
|
||||
{
|
||||
ResetCts?.Cancel();
|
||||
ResetCts?.Dispose();
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
public void IncreaseFailedAttempts()
|
||||
{
|
||||
Interlocked.Increment(ref failedAttempts);
|
||||
}
|
||||
}
|
||||
|
||||
public class SecretKeyAuthenticationHandler : AuthenticationHandler<AuthenticationSchemeOptions>
|
||||
{
|
||||
private readonly IHttpContextAccessor _accessor;
|
||||
private readonly MareDbContext _mareDbContext;
|
||||
private readonly IConfiguration _configuration;
|
||||
public const string AuthScheme = "SecretKeyAuth";
|
||||
private const string unauthorized = "Unauthorized";
|
||||
public static readonly Dictionary<string, string> Authentications = new();
|
||||
private static readonly Dictionary<string, FailedAuthorization> FailedAuthorizations = new();
|
||||
private static readonly object authDictLock = new();
|
||||
private static readonly object failedAuthLock = new();
|
||||
private readonly int failedAttemptsForTempBan;
|
||||
private readonly int tempBanMinutes;
|
||||
|
||||
public static void ClearUnauthorizedUsers()
|
||||
{
|
||||
lock (authDictLock)
|
||||
{
|
||||
foreach (var item in Authentications.ToArray())
|
||||
{
|
||||
if (item.Value == unauthorized)
|
||||
{
|
||||
Authentications[item.Key] = string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void RemoveAuthentication(string uid)
|
||||
{
|
||||
lock (authDictLock)
|
||||
{
|
||||
var auth = Authentications.Where(u => u.Value == uid);
|
||||
if (auth.Any())
|
||||
{
|
||||
Authentications.Remove(auth.First().Key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override async Task<AuthenticateResult> HandleAuthenticateAsync()
|
||||
{
|
||||
MareMetrics.AuthenticationRequests.Inc();
|
||||
|
||||
if (!Request.Headers.ContainsKey("Authorization"))
|
||||
{
|
||||
MareMetrics.AuthenticationFailures.Inc();
|
||||
return AuthenticateResult.Fail("Failed Authorization");
|
||||
}
|
||||
|
||||
var authHeader = Request.Headers["Authorization"].ToString();
|
||||
|
||||
if (string.IsNullOrEmpty(authHeader))
|
||||
{
|
||||
MareMetrics.AuthenticationFailures.Inc();
|
||||
return AuthenticateResult.Fail("Failed Authorization");
|
||||
}
|
||||
|
||||
var ip = _accessor.GetIpAddress();
|
||||
|
||||
lock (failedAuthLock)
|
||||
{
|
||||
if (FailedAuthorizations.TryGetValue(ip, out var failedAuth) && failedAuth.FailedAttempts > failedAttemptsForTempBan)
|
||||
{
|
||||
MareMetrics.AuthenticationFailures.Inc();
|
||||
|
||||
failedAuth.ResetCts?.Cancel();
|
||||
failedAuth.ResetCts?.Dispose();
|
||||
failedAuth.ResetCts = new CancellationTokenSource();
|
||||
var token = failedAuth.ResetCts.Token;
|
||||
failedAuth.ResetTask = Task.Run(async () =>
|
||||
{
|
||||
await Task.Delay(TimeSpan.FromMinutes(tempBanMinutes), token).ConfigureAwait(false);
|
||||
if (token.IsCancellationRequested) return;
|
||||
FailedAuthorization fauth;
|
||||
lock (failedAuthLock)
|
||||
{
|
||||
FailedAuthorizations.Remove(ip, out fauth);
|
||||
}
|
||||
fauth.Dispose();
|
||||
}, token);
|
||||
|
||||
Logger.LogWarning("TempBan {ip} for authorization spam", ip);
|
||||
return AuthenticateResult.Fail("Failed Authorization");
|
||||
}
|
||||
}
|
||||
|
||||
using var sha256 = SHA256.Create();
|
||||
var hashedHeader = BitConverter.ToString(sha256.ComputeHash(Encoding.UTF8.GetBytes(authHeader))).Replace("-", "");
|
||||
|
||||
string uid;
|
||||
lock (authDictLock)
|
||||
{
|
||||
if (Authentications.TryGetValue(hashedHeader, out uid))
|
||||
{
|
||||
if (uid == unauthorized)
|
||||
{
|
||||
MareMetrics.AuthenticationFailures.Inc();
|
||||
|
||||
lock (failedAuthLock)
|
||||
{
|
||||
Logger.LogWarning("Failed authorization from {ip}", ip);
|
||||
if (FailedAuthorizations.TryGetValue(ip, out var auth))
|
||||
{
|
||||
auth.IncreaseFailedAttempts();
|
||||
}
|
||||
else
|
||||
{
|
||||
FailedAuthorizations[ip] = new FailedAuthorization();
|
||||
}
|
||||
}
|
||||
|
||||
return AuthenticateResult.Fail("Failed Authorization");
|
||||
}
|
||||
|
||||
MareMetrics.AuthenticationCacheHits.Inc();
|
||||
}
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(uid))
|
||||
{
|
||||
uid = (await _mareDbContext.Auth.AsNoTracking()
|
||||
.FirstOrDefaultAsync(m => m.HashedKey == hashedHeader).ConfigureAwait(false))?.UserUID;
|
||||
|
||||
if (uid == null)
|
||||
{
|
||||
lock (authDictLock)
|
||||
{
|
||||
Authentications[hashedHeader] = unauthorized;
|
||||
}
|
||||
|
||||
Logger.LogWarning("Failed authorization from {ip}", ip);
|
||||
lock (failedAuthLock)
|
||||
{
|
||||
if (FailedAuthorizations.TryGetValue(ip, out var auth))
|
||||
{
|
||||
auth.IncreaseFailedAttempts();
|
||||
}
|
||||
else
|
||||
{
|
||||
FailedAuthorizations[ip] = new FailedAuthorization();
|
||||
}
|
||||
}
|
||||
|
||||
MareMetrics.AuthenticationFailures.Inc();
|
||||
return AuthenticateResult.Fail("Failed Authorization");
|
||||
}
|
||||
else
|
||||
{
|
||||
Authentications[hashedHeader] = uid;
|
||||
}
|
||||
}
|
||||
|
||||
var claims = new List<Claim> {
|
||||
new Claim(ClaimTypes.NameIdentifier, uid)
|
||||
};
|
||||
|
||||
var identity = new ClaimsIdentity(claims, nameof(SecretKeyAuthenticationHandler));
|
||||
var principal = new ClaimsPrincipal(identity);
|
||||
var ticket = new AuthenticationTicket(principal, Scheme.Name);
|
||||
|
||||
MareMetrics.AuthenticationSuccesses.Inc();
|
||||
|
||||
return AuthenticateResult.Success(ticket);
|
||||
}
|
||||
|
||||
public SecretKeyAuthenticationHandler(IOptionsMonitor<AuthenticationSchemeOptions> options, IHttpContextAccessor accessor,
|
||||
MareDbContext mareDbContext, IConfiguration configuration, ILoggerFactory logger, UrlEncoder encoder, ISystemClock clock) : base(options, logger, encoder, clock)
|
||||
{
|
||||
_accessor = accessor;
|
||||
_mareDbContext = mareDbContext;
|
||||
_configuration = configuration;
|
||||
failedAttemptsForTempBan = _configuration.GetValue<int>("FailedAuthForTempBan", 5);
|
||||
tempBanMinutes = _configuration.GetValue<int>("TempBanDurationInMinutes", 30);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
using MareSynchronosShared.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace MareSynchronosShared.Data;
|
||||
|
||||
public class MareDbContext : DbContext
|
||||
{
|
||||
public MareDbContext(DbContextOptions<MareDbContext> options) : base(options)
|
||||
{
|
||||
}
|
||||
|
||||
public DbSet<User> Users { get; set; }
|
||||
public DbSet<FileCache> Files { get; set; }
|
||||
public DbSet<ClientPair> ClientPairs { get; set; }
|
||||
public DbSet<ForbiddenUploadEntry> ForbiddenUploadEntries { get; set; }
|
||||
public DbSet<Banned> BannedUsers { get; set; }
|
||||
public DbSet<Auth> Auth { get; set; }
|
||||
public DbSet<LodeStoneAuth> LodeStoneAuth { get; set; }
|
||||
public DbSet<BannedRegistrations> BannedRegistrations { get; set; }
|
||||
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Entity<Auth>().ToTable("auth");
|
||||
modelBuilder.Entity<User>().ToTable("users");
|
||||
modelBuilder.Entity<User>().HasIndex(c => c.CharacterIdentification);
|
||||
modelBuilder.Entity<FileCache>().ToTable("file_caches");
|
||||
modelBuilder.Entity<FileCache>().HasIndex(c => c.UploaderUID);
|
||||
modelBuilder.Entity<ClientPair>().ToTable("client_pairs");
|
||||
modelBuilder.Entity<ClientPair>().HasKey(u => new { u.UserUID, u.OtherUserUID });
|
||||
modelBuilder.Entity<ClientPair>().HasIndex(c => c.UserUID);
|
||||
modelBuilder.Entity<ClientPair>().HasIndex(c => c.OtherUserUID);
|
||||
modelBuilder.Entity<ForbiddenUploadEntry>().ToTable("forbidden_upload_entries");
|
||||
modelBuilder.Entity<Banned>().ToTable("banned_users");
|
||||
modelBuilder.Entity<LodeStoneAuth>().ToTable("lodestone_auth");
|
||||
modelBuilder.Entity<BannedRegistrations>().ToTable("banned_registrations");
|
||||
}
|
||||
}
|
||||
30
MareSynchronosServer/MareSynchronosShared/Extensions.cs
Normal file
30
MareSynchronosServer/MareSynchronosShared/Extensions.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System.Linq;
|
||||
|
||||
namespace MareSynchronosServer
|
||||
{
|
||||
public static class Extensions
|
||||
{
|
||||
public static string GetIpAddress(this IHttpContextAccessor accessor)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(accessor.HttpContext.Request.Headers["CF-CONNECTING-IP"]))
|
||||
return accessor.HttpContext.Request.Headers["CF-CONNECTING-IP"];
|
||||
|
||||
if (!string.IsNullOrEmpty(accessor.HttpContext.Request.Headers["X-Forwarded-For"]))
|
||||
{
|
||||
return accessor.HttpContext.Request.Headers["X-Forwarded-For"];
|
||||
}
|
||||
|
||||
var ipAddress = accessor.HttpContext.GetServerVariable("HTTP_X_FORWARDED_FOR");
|
||||
|
||||
if (!string.IsNullOrEmpty(ipAddress))
|
||||
{
|
||||
var addresses = ipAddress.Split(',');
|
||||
if (addresses.Length != 0)
|
||||
return addresses.Last();
|
||||
}
|
||||
|
||||
return accessor.HttpContext.Connection.RemoteIpAddress.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<FrameworkReference Include="Microsoft.AspNetCore.App" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.Core" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.8" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.8">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.6" />
|
||||
<PackageReference Include="prometheus-net" Version="6.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,58 @@
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using MareSynchronosShared.Data;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Prometheus;
|
||||
|
||||
namespace MareSynchronosServer.Metrics
|
||||
{
|
||||
public class MareMetrics
|
||||
{
|
||||
public static readonly Counter InitializedConnections =
|
||||
Prometheus.Metrics.CreateCounter("mare_initialized_connections", "Initialized Connections");
|
||||
public static readonly Gauge Connections =
|
||||
Prometheus.Metrics.CreateGauge("mare_unauthorized_connections", "Unauthorized Connections");
|
||||
public static readonly Gauge AuthorizedConnections =
|
||||
Prometheus.Metrics.CreateGauge("mare_authorized_connections", "Authorized Connections");
|
||||
public static readonly Gauge AvailableWorkerThreads = Prometheus.Metrics.CreateGauge("mare_available_threadpool", "Available Threadpool Workers");
|
||||
public static readonly Gauge AvailableIOWorkerThreads = Prometheus.Metrics.CreateGauge("mare_available_threadpool_io", "Available Threadpool IO Workers");
|
||||
|
||||
public static readonly Gauge UsersRegistered = Prometheus.Metrics.CreateGauge("mare_users_registered", "Total Registrations");
|
||||
|
||||
public static readonly Gauge Pairs = Prometheus.Metrics.CreateGauge("mare_pairs", "Total Pairs");
|
||||
public static readonly Gauge PairsPaused = Prometheus.Metrics.CreateGauge("mare_pairs_paused", "Total Paused Pairs");
|
||||
|
||||
public static readonly Gauge FilesTotal = Prometheus.Metrics.CreateGauge("mare_files", "Total uploaded files");
|
||||
public static readonly Gauge FilesTotalSize =
|
||||
Prometheus.Metrics.CreateGauge("mare_files_size", "Total uploaded files (bytes)");
|
||||
|
||||
public static readonly Counter UserPushData = Prometheus.Metrics.CreateCounter("mare_user_push", "Users pushing data");
|
||||
public static readonly Counter UserPushDataTo =
|
||||
Prometheus.Metrics.CreateCounter("mare_user_push_to", "Users Receiving Data");
|
||||
|
||||
public static readonly Counter UserDownloadedFiles =
|
||||
Prometheus.Metrics.CreateCounter("mare_user_downloaded_files", "Total Downloaded Files by Users");
|
||||
public static readonly Counter UserDownloadedFilesSize =
|
||||
Prometheus.Metrics.CreateCounter("mare_user_downloaded_files_size", "Total Downloaded Files Size by Users");
|
||||
|
||||
public static readonly Gauge
|
||||
CPUUsage = Prometheus.Metrics.CreateGauge("mare_cpu_usage", "Total calculated CPU usage in %");
|
||||
public static readonly Gauge RAMUsage =
|
||||
Prometheus.Metrics.CreateGauge("mare_ram_usage", "Total calculated RAM usage in bytes for Mare + MSSQL");
|
||||
public static readonly Gauge NetworkOut = Prometheus.Metrics.CreateGauge("mare_network_out", "Network out in byte/s");
|
||||
public static readonly Gauge NetworkIn = Prometheus.Metrics.CreateGauge("mare_network_in", "Network in in byte/s");
|
||||
public static readonly Counter AuthenticationRequests = Prometheus.Metrics.CreateCounter("mare_auth_requests", "Mare Authentication Requests");
|
||||
public static readonly Counter AuthenticationCacheHits = Prometheus.Metrics.CreateCounter("mare_auth_requests_cachehit", "Mare Authentication Requests Cache Hits");
|
||||
public static readonly Counter AuthenticationFailures = Prometheus.Metrics.CreateCounter("mare_auth_requests_fail", "Mare Authentication Requests Failed");
|
||||
public static readonly Counter AuthenticationSuccesses = Prometheus.Metrics.CreateCounter("mare_auth_requests_success", "Mare Authentication Requests Success");
|
||||
|
||||
public static void InitializeMetrics(MareDbContext dbContext, IConfiguration configuration)
|
||||
{
|
||||
UsersRegistered.IncTo(dbContext.Users.Count());
|
||||
Pairs.IncTo(dbContext.ClientPairs.Count());
|
||||
PairsPaused.IncTo(dbContext.ClientPairs.Count(p => p.IsPaused));
|
||||
FilesTotal.IncTo(dbContext.Files.Count());
|
||||
FilesTotalSize.IncTo(Directory.EnumerateFiles(configuration["CacheDirectory"]).Sum(f => new FileInfo(f).Length));
|
||||
}
|
||||
}
|
||||
}
|
||||
241
MareSynchronosServer/MareSynchronosShared/Migrations/20220731210149_InitialCreate.Designer.cs
generated
Normal file
241
MareSynchronosServer/MareSynchronosShared/Migrations/20220731210149_InitialCreate.Designer.cs
generated
Normal file
@@ -0,0 +1,241 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using MareSynchronosShared.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MareSynchronosServer.Migrations
|
||||
{
|
||||
[DbContext(typeof(MareDbContext))]
|
||||
[Migration("20220731210149_InitialCreate")]
|
||||
partial class InitialCreate
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "6.0.6")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.Auth", b =>
|
||||
{
|
||||
b.Property<string>("HashedKey")
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("character varying(64)")
|
||||
.HasColumnName("hashed_key");
|
||||
|
||||
b.Property<string>("UserUID")
|
||||
.HasColumnType("character varying(10)")
|
||||
.HasColumnName("user_uid");
|
||||
|
||||
b.HasKey("HashedKey")
|
||||
.HasName("pk_auth");
|
||||
|
||||
b.HasIndex("UserUID")
|
||||
.HasDatabaseName("ix_auth_user_uid");
|
||||
|
||||
b.ToTable("Auth", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.Banned", b =>
|
||||
{
|
||||
b.Property<string>("CharacterIdentification")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("character_identification");
|
||||
|
||||
b.Property<string>("Reason")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("reason");
|
||||
|
||||
b.Property<byte[]>("Timestamp")
|
||||
.IsConcurrencyToken()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("bytea")
|
||||
.HasColumnName("timestamp");
|
||||
|
||||
b.HasKey("CharacterIdentification")
|
||||
.HasName("pk_banned_users");
|
||||
|
||||
b.ToTable("BannedUsers", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.ClientPair", b =>
|
||||
{
|
||||
b.Property<string>("UserUID")
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("character varying(10)")
|
||||
.HasColumnName("user_uid");
|
||||
|
||||
b.Property<string>("OtherUserUID")
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("character varying(10)")
|
||||
.HasColumnName("other_user_uid");
|
||||
|
||||
b.Property<bool>("AllowReceivingMessages")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("allow_receiving_messages");
|
||||
|
||||
b.Property<bool>("IsPaused")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("is_paused");
|
||||
|
||||
b.Property<byte[]>("Timestamp")
|
||||
.IsConcurrencyToken()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("bytea")
|
||||
.HasColumnName("timestamp");
|
||||
|
||||
b.HasKey("UserUID", "OtherUserUID")
|
||||
.HasName("pk_client_pairs");
|
||||
|
||||
b.HasIndex("OtherUserUID")
|
||||
.HasDatabaseName("ix_client_pairs_other_user_uid");
|
||||
|
||||
b.HasIndex("UserUID")
|
||||
.HasDatabaseName("ix_client_pairs_user_uid");
|
||||
|
||||
b.ToTable("ClientPairs", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.FileCache", b =>
|
||||
{
|
||||
b.Property<string>("Hash")
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("character varying(40)")
|
||||
.HasColumnName("hash");
|
||||
|
||||
b.Property<byte[]>("Timestamp")
|
||||
.IsConcurrencyToken()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("bytea")
|
||||
.HasColumnName("timestamp");
|
||||
|
||||
b.Property<bool>("Uploaded")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("uploaded");
|
||||
|
||||
b.Property<string>("UploaderUID")
|
||||
.HasColumnType("character varying(10)")
|
||||
.HasColumnName("uploader_uid");
|
||||
|
||||
b.HasKey("Hash")
|
||||
.HasName("pk_file_caches");
|
||||
|
||||
b.HasIndex("UploaderUID")
|
||||
.HasDatabaseName("ix_file_caches_uploader_uid");
|
||||
|
||||
b.ToTable("FileCaches", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.ForbiddenUploadEntry", b =>
|
||||
{
|
||||
b.Property<string>("Hash")
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("character varying(40)")
|
||||
.HasColumnName("hash");
|
||||
|
||||
b.Property<string>("ForbiddenBy")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("forbidden_by");
|
||||
|
||||
b.Property<byte[]>("Timestamp")
|
||||
.IsConcurrencyToken()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("bytea")
|
||||
.HasColumnName("timestamp");
|
||||
|
||||
b.HasKey("Hash")
|
||||
.HasName("pk_forbidden_upload_entries");
|
||||
|
||||
b.ToTable("ForbiddenUploadEntries", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.User", b =>
|
||||
{
|
||||
b.Property<string>("UID")
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("character varying(10)")
|
||||
.HasColumnName("uid");
|
||||
|
||||
b.Property<string>("CharacterIdentification")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("character_identification");
|
||||
|
||||
b.Property<bool>("IsAdmin")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("is_admin");
|
||||
|
||||
b.Property<bool>("IsModerator")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("is_moderator");
|
||||
|
||||
b.Property<DateTime>("LastLoggedIn")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("last_logged_in");
|
||||
|
||||
b.Property<byte[]>("Timestamp")
|
||||
.IsConcurrencyToken()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("bytea")
|
||||
.HasColumnName("timestamp");
|
||||
|
||||
b.HasKey("UID")
|
||||
.HasName("pk_users");
|
||||
|
||||
b.HasIndex("CharacterIdentification")
|
||||
.HasDatabaseName("ix_users_character_identification");
|
||||
|
||||
b.ToTable("Users", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.Auth", b =>
|
||||
{
|
||||
b.HasOne("MareSynchronosServer.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserUID")
|
||||
.HasConstraintName("fk_auth_users_user_uid");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.ClientPair", b =>
|
||||
{
|
||||
b.HasOne("MareSynchronosServer.Models.User", "OtherUser")
|
||||
.WithMany()
|
||||
.HasForeignKey("OtherUserUID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_client_pairs_users_other_user_uid");
|
||||
|
||||
b.HasOne("MareSynchronosServer.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserUID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_client_pairs_users_user_uid");
|
||||
|
||||
b.Navigation("OtherUser");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.FileCache", b =>
|
||||
{
|
||||
b.HasOne("MareSynchronosServer.Models.User", "Uploader")
|
||||
.WithMany()
|
||||
.HasForeignKey("UploaderUID")
|
||||
.HasConstraintName("fk_file_caches_users_uploader_uid");
|
||||
|
||||
b.Navigation("Uploader");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MareSynchronosServer.Migrations
|
||||
{
|
||||
public partial class InitialCreate : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "BannedUsers",
|
||||
columns: table => new
|
||||
{
|
||||
character_identification = table.Column<string>(type: "text", nullable: false),
|
||||
reason = table.Column<string>(type: "text", nullable: true),
|
||||
timestamp = table.Column<byte[]>(type: "bytea", rowVersion: true, nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_banned_users", x => x.character_identification);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ForbiddenUploadEntries",
|
||||
columns: table => new
|
||||
{
|
||||
hash = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
|
||||
forbidden_by = table.Column<string>(type: "text", nullable: true),
|
||||
timestamp = table.Column<byte[]>(type: "bytea", rowVersion: true, nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_forbidden_upload_entries", x => x.hash);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Users",
|
||||
columns: table => new
|
||||
{
|
||||
uid = table.Column<string>(type: "character varying(10)", maxLength: 10, nullable: false),
|
||||
character_identification = table.Column<string>(type: "text", nullable: true),
|
||||
timestamp = table.Column<byte[]>(type: "bytea", rowVersion: true, nullable: true),
|
||||
is_moderator = table.Column<bool>(type: "boolean", nullable: false),
|
||||
is_admin = table.Column<bool>(type: "boolean", nullable: false),
|
||||
last_logged_in = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_users", x => x.uid);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Auth",
|
||||
columns: table => new
|
||||
{
|
||||
hashed_key = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false),
|
||||
user_uid = table.Column<string>(type: "character varying(10)", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_auth", x => x.hashed_key);
|
||||
table.ForeignKey(
|
||||
name: "fk_auth_users_user_uid",
|
||||
column: x => x.user_uid,
|
||||
principalTable: "Users",
|
||||
principalColumn: "uid");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ClientPairs",
|
||||
columns: table => new
|
||||
{
|
||||
user_uid = table.Column<string>(type: "character varying(10)", maxLength: 10, nullable: false),
|
||||
other_user_uid = table.Column<string>(type: "character varying(10)", maxLength: 10, nullable: false),
|
||||
is_paused = table.Column<bool>(type: "boolean", nullable: false),
|
||||
allow_receiving_messages = table.Column<bool>(type: "boolean", nullable: false),
|
||||
timestamp = table.Column<byte[]>(type: "bytea", rowVersion: true, nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_client_pairs", x => new { x.user_uid, x.other_user_uid });
|
||||
table.ForeignKey(
|
||||
name: "fk_client_pairs_users_other_user_uid",
|
||||
column: x => x.other_user_uid,
|
||||
principalTable: "Users",
|
||||
principalColumn: "uid",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "fk_client_pairs_users_user_uid",
|
||||
column: x => x.user_uid,
|
||||
principalTable: "Users",
|
||||
principalColumn: "uid",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "FileCaches",
|
||||
columns: table => new
|
||||
{
|
||||
hash = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
|
||||
uploader_uid = table.Column<string>(type: "character varying(10)", nullable: true),
|
||||
uploaded = table.Column<bool>(type: "boolean", nullable: false),
|
||||
timestamp = table.Column<byte[]>(type: "bytea", rowVersion: true, nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_file_caches", x => x.hash);
|
||||
table.ForeignKey(
|
||||
name: "fk_file_caches_users_uploader_uid",
|
||||
column: x => x.uploader_uid,
|
||||
principalTable: "Users",
|
||||
principalColumn: "uid");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_auth_user_uid",
|
||||
table: "Auth",
|
||||
column: "user_uid");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_client_pairs_other_user_uid",
|
||||
table: "ClientPairs",
|
||||
column: "other_user_uid");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_client_pairs_user_uid",
|
||||
table: "ClientPairs",
|
||||
column: "user_uid");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_file_caches_uploader_uid",
|
||||
table: "FileCaches",
|
||||
column: "uploader_uid");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_users_character_identification",
|
||||
table: "Users",
|
||||
column: "character_identification");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Auth");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "BannedUsers");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ClientPairs");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "FileCaches");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ForbiddenUploadEntries");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Users");
|
||||
}
|
||||
}
|
||||
}
|
||||
241
MareSynchronosServer/MareSynchronosShared/Migrations/20220731211419_RenameLowerSnakeCase.Designer.cs
generated
Normal file
241
MareSynchronosServer/MareSynchronosShared/Migrations/20220731211419_RenameLowerSnakeCase.Designer.cs
generated
Normal file
@@ -0,0 +1,241 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using MareSynchronosShared.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MareSynchronosServer.Migrations
|
||||
{
|
||||
[DbContext(typeof(MareDbContext))]
|
||||
[Migration("20220731211419_RenameLowerSnakeCase")]
|
||||
partial class RenameLowerSnakeCase
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "6.0.6")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.Auth", b =>
|
||||
{
|
||||
b.Property<string>("HashedKey")
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("character varying(64)")
|
||||
.HasColumnName("hashed_key");
|
||||
|
||||
b.Property<string>("UserUID")
|
||||
.HasColumnType("character varying(10)")
|
||||
.HasColumnName("user_uid");
|
||||
|
||||
b.HasKey("HashedKey")
|
||||
.HasName("pk_auth");
|
||||
|
||||
b.HasIndex("UserUID")
|
||||
.HasDatabaseName("ix_auth_user_uid");
|
||||
|
||||
b.ToTable("auth", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.Banned", b =>
|
||||
{
|
||||
b.Property<string>("CharacterIdentification")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("character_identification");
|
||||
|
||||
b.Property<string>("Reason")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("reason");
|
||||
|
||||
b.Property<byte[]>("Timestamp")
|
||||
.IsConcurrencyToken()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("bytea")
|
||||
.HasColumnName("timestamp");
|
||||
|
||||
b.HasKey("CharacterIdentification")
|
||||
.HasName("pk_banned_users");
|
||||
|
||||
b.ToTable("banned_users", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.ClientPair", b =>
|
||||
{
|
||||
b.Property<string>("UserUID")
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("character varying(10)")
|
||||
.HasColumnName("user_uid");
|
||||
|
||||
b.Property<string>("OtherUserUID")
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("character varying(10)")
|
||||
.HasColumnName("other_user_uid");
|
||||
|
||||
b.Property<bool>("AllowReceivingMessages")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("allow_receiving_messages");
|
||||
|
||||
b.Property<bool>("IsPaused")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("is_paused");
|
||||
|
||||
b.Property<byte[]>("Timestamp")
|
||||
.IsConcurrencyToken()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("bytea")
|
||||
.HasColumnName("timestamp");
|
||||
|
||||
b.HasKey("UserUID", "OtherUserUID")
|
||||
.HasName("pk_client_pairs");
|
||||
|
||||
b.HasIndex("OtherUserUID")
|
||||
.HasDatabaseName("ix_client_pairs_other_user_uid");
|
||||
|
||||
b.HasIndex("UserUID")
|
||||
.HasDatabaseName("ix_client_pairs_user_uid");
|
||||
|
||||
b.ToTable("client_pairs", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.FileCache", b =>
|
||||
{
|
||||
b.Property<string>("Hash")
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("character varying(40)")
|
||||
.HasColumnName("hash");
|
||||
|
||||
b.Property<byte[]>("Timestamp")
|
||||
.IsConcurrencyToken()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("bytea")
|
||||
.HasColumnName("timestamp");
|
||||
|
||||
b.Property<bool>("Uploaded")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("uploaded");
|
||||
|
||||
b.Property<string>("UploaderUID")
|
||||
.HasColumnType("character varying(10)")
|
||||
.HasColumnName("uploader_uid");
|
||||
|
||||
b.HasKey("Hash")
|
||||
.HasName("pk_file_caches");
|
||||
|
||||
b.HasIndex("UploaderUID")
|
||||
.HasDatabaseName("ix_file_caches_uploader_uid");
|
||||
|
||||
b.ToTable("file_caches", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.ForbiddenUploadEntry", b =>
|
||||
{
|
||||
b.Property<string>("Hash")
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("character varying(40)")
|
||||
.HasColumnName("hash");
|
||||
|
||||
b.Property<string>("ForbiddenBy")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("forbidden_by");
|
||||
|
||||
b.Property<byte[]>("Timestamp")
|
||||
.IsConcurrencyToken()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("bytea")
|
||||
.HasColumnName("timestamp");
|
||||
|
||||
b.HasKey("Hash")
|
||||
.HasName("pk_forbidden_upload_entries");
|
||||
|
||||
b.ToTable("forbidden_upload_entries", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.User", b =>
|
||||
{
|
||||
b.Property<string>("UID")
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("character varying(10)")
|
||||
.HasColumnName("uid");
|
||||
|
||||
b.Property<string>("CharacterIdentification")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("character_identification");
|
||||
|
||||
b.Property<bool>("IsAdmin")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("is_admin");
|
||||
|
||||
b.Property<bool>("IsModerator")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("is_moderator");
|
||||
|
||||
b.Property<DateTime>("LastLoggedIn")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("last_logged_in");
|
||||
|
||||
b.Property<byte[]>("Timestamp")
|
||||
.IsConcurrencyToken()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("bytea")
|
||||
.HasColumnName("timestamp");
|
||||
|
||||
b.HasKey("UID")
|
||||
.HasName("pk_users");
|
||||
|
||||
b.HasIndex("CharacterIdentification")
|
||||
.HasDatabaseName("ix_users_character_identification");
|
||||
|
||||
b.ToTable("users", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.Auth", b =>
|
||||
{
|
||||
b.HasOne("MareSynchronosServer.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserUID")
|
||||
.HasConstraintName("fk_auth_users_user_temp_id");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.ClientPair", b =>
|
||||
{
|
||||
b.HasOne("MareSynchronosServer.Models.User", "OtherUser")
|
||||
.WithMany()
|
||||
.HasForeignKey("OtherUserUID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_client_pairs_users_other_user_temp_id1");
|
||||
|
||||
b.HasOne("MareSynchronosServer.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserUID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_client_pairs_users_user_temp_id2");
|
||||
|
||||
b.Navigation("OtherUser");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.FileCache", b =>
|
||||
{
|
||||
b.HasOne("MareSynchronosServer.Models.User", "Uploader")
|
||||
.WithMany()
|
||||
.HasForeignKey("UploaderUID")
|
||||
.HasConstraintName("fk_file_caches_users_uploader_uid");
|
||||
|
||||
b.Navigation("Uploader");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MareSynchronosServer.Migrations
|
||||
{
|
||||
public partial class RenameLowerSnakeCase : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "fk_auth_users_user_uid",
|
||||
table: "Auth");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "fk_client_pairs_users_other_user_uid",
|
||||
table: "ClientPairs");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "fk_client_pairs_users_user_uid",
|
||||
table: "ClientPairs");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
name: "Users",
|
||||
newName: "users");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
name: "Auth",
|
||||
newName: "auth");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
name: "ForbiddenUploadEntries",
|
||||
newName: "forbidden_upload_entries");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
name: "FileCaches",
|
||||
newName: "file_caches");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
name: "ClientPairs",
|
||||
newName: "client_pairs");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
name: "BannedUsers",
|
||||
newName: "banned_users");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "fk_auth_users_user_temp_id",
|
||||
table: "auth",
|
||||
column: "user_uid",
|
||||
principalTable: "users",
|
||||
principalColumn: "uid");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "fk_client_pairs_users_other_user_temp_id1",
|
||||
table: "client_pairs",
|
||||
column: "other_user_uid",
|
||||
principalTable: "users",
|
||||
principalColumn: "uid",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "fk_client_pairs_users_user_temp_id2",
|
||||
table: "client_pairs",
|
||||
column: "user_uid",
|
||||
principalTable: "users",
|
||||
principalColumn: "uid",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "fk_auth_users_user_temp_id",
|
||||
table: "auth");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "fk_client_pairs_users_other_user_temp_id1",
|
||||
table: "client_pairs");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "fk_client_pairs_users_user_temp_id2",
|
||||
table: "client_pairs");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
name: "users",
|
||||
newName: "Users");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
name: "auth",
|
||||
newName: "Auth");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
name: "forbidden_upload_entries",
|
||||
newName: "ForbiddenUploadEntries");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
name: "file_caches",
|
||||
newName: "FileCaches");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
name: "client_pairs",
|
||||
newName: "ClientPairs");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
name: "banned_users",
|
||||
newName: "BannedUsers");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "fk_auth_users_user_uid",
|
||||
table: "Auth",
|
||||
column: "user_uid",
|
||||
principalTable: "Users",
|
||||
principalColumn: "uid");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "fk_client_pairs_users_other_user_uid",
|
||||
table: "ClientPairs",
|
||||
column: "other_user_uid",
|
||||
principalTable: "Users",
|
||||
principalColumn: "uid",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "fk_client_pairs_users_user_uid",
|
||||
table: "ClientPairs",
|
||||
column: "user_uid",
|
||||
principalTable: "Users",
|
||||
principalColumn: "uid",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
||||
283
MareSynchronosServer/MareSynchronosShared/Migrations/20220801121419_AddLodestoneAuth.Designer.cs
generated
Normal file
283
MareSynchronosServer/MareSynchronosShared/Migrations/20220801121419_AddLodestoneAuth.Designer.cs
generated
Normal file
@@ -0,0 +1,283 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using MareSynchronosShared.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MareSynchronosServer.Migrations
|
||||
{
|
||||
[DbContext(typeof(MareDbContext))]
|
||||
[Migration("20220801121419_AddLodestoneAuth")]
|
||||
partial class AddLodestoneAuth
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "6.0.6")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.Auth", b =>
|
||||
{
|
||||
b.Property<string>("HashedKey")
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("character varying(64)")
|
||||
.HasColumnName("hashed_key");
|
||||
|
||||
b.Property<string>("UserUID")
|
||||
.HasColumnType("character varying(10)")
|
||||
.HasColumnName("user_uid");
|
||||
|
||||
b.HasKey("HashedKey")
|
||||
.HasName("pk_auth");
|
||||
|
||||
b.HasIndex("UserUID")
|
||||
.HasDatabaseName("ix_auth_user_uid");
|
||||
|
||||
b.ToTable("auth", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.Banned", b =>
|
||||
{
|
||||
b.Property<string>("CharacterIdentification")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("character_identification");
|
||||
|
||||
b.Property<string>("Reason")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("reason");
|
||||
|
||||
b.Property<byte[]>("Timestamp")
|
||||
.IsConcurrencyToken()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("bytea")
|
||||
.HasColumnName("timestamp");
|
||||
|
||||
b.HasKey("CharacterIdentification")
|
||||
.HasName("pk_banned_users");
|
||||
|
||||
b.ToTable("banned_users", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.ClientPair", b =>
|
||||
{
|
||||
b.Property<string>("UserUID")
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("character varying(10)")
|
||||
.HasColumnName("user_uid");
|
||||
|
||||
b.Property<string>("OtherUserUID")
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("character varying(10)")
|
||||
.HasColumnName("other_user_uid");
|
||||
|
||||
b.Property<bool>("AllowReceivingMessages")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("allow_receiving_messages");
|
||||
|
||||
b.Property<bool>("IsPaused")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("is_paused");
|
||||
|
||||
b.Property<byte[]>("Timestamp")
|
||||
.IsConcurrencyToken()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("bytea")
|
||||
.HasColumnName("timestamp");
|
||||
|
||||
b.HasKey("UserUID", "OtherUserUID")
|
||||
.HasName("pk_client_pairs");
|
||||
|
||||
b.HasIndex("OtherUserUID")
|
||||
.HasDatabaseName("ix_client_pairs_other_user_uid");
|
||||
|
||||
b.HasIndex("UserUID")
|
||||
.HasDatabaseName("ix_client_pairs_user_uid");
|
||||
|
||||
b.ToTable("client_pairs", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.FileCache", b =>
|
||||
{
|
||||
b.Property<string>("Hash")
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("character varying(40)")
|
||||
.HasColumnName("hash");
|
||||
|
||||
b.Property<byte[]>("Timestamp")
|
||||
.IsConcurrencyToken()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("bytea")
|
||||
.HasColumnName("timestamp");
|
||||
|
||||
b.Property<bool>("Uploaded")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("uploaded");
|
||||
|
||||
b.Property<string>("UploaderUID")
|
||||
.HasColumnType("character varying(10)")
|
||||
.HasColumnName("uploader_uid");
|
||||
|
||||
b.HasKey("Hash")
|
||||
.HasName("pk_file_caches");
|
||||
|
||||
b.HasIndex("UploaderUID")
|
||||
.HasDatabaseName("ix_file_caches_uploader_uid");
|
||||
|
||||
b.ToTable("file_caches", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.ForbiddenUploadEntry", b =>
|
||||
{
|
||||
b.Property<string>("Hash")
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("character varying(40)")
|
||||
.HasColumnName("hash");
|
||||
|
||||
b.Property<string>("ForbiddenBy")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("forbidden_by");
|
||||
|
||||
b.Property<byte[]>("Timestamp")
|
||||
.IsConcurrencyToken()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("bytea")
|
||||
.HasColumnName("timestamp");
|
||||
|
||||
b.HasKey("Hash")
|
||||
.HasName("pk_forbidden_upload_entries");
|
||||
|
||||
b.ToTable("forbidden_upload_entries", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.LodeStoneAuth", b =>
|
||||
{
|
||||
b.Property<decimal>("DiscordId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("numeric(20,0)")
|
||||
.HasColumnName("discord_id");
|
||||
|
||||
b.Property<string>("HashedLodestoneId")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("hashed_lodestone_id");
|
||||
|
||||
b.Property<string>("LodestoneAuthString")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("lodestone_auth_string");
|
||||
|
||||
b.Property<DateTime>("StartedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("started_at");
|
||||
|
||||
b.Property<string>("UserUID")
|
||||
.HasColumnType("character varying(10)")
|
||||
.HasColumnName("user_uid");
|
||||
|
||||
b.HasKey("DiscordId")
|
||||
.HasName("pk_lodestone_auth");
|
||||
|
||||
b.HasIndex("UserUID")
|
||||
.HasDatabaseName("ix_lodestone_auth_user_uid");
|
||||
|
||||
b.ToTable("lodestone_auth", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.User", b =>
|
||||
{
|
||||
b.Property<string>("UID")
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("character varying(10)")
|
||||
.HasColumnName("uid");
|
||||
|
||||
b.Property<string>("CharacterIdentification")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("character_identification");
|
||||
|
||||
b.Property<bool>("IsAdmin")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("is_admin");
|
||||
|
||||
b.Property<bool>("IsModerator")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("is_moderator");
|
||||
|
||||
b.Property<DateTime>("LastLoggedIn")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("last_logged_in");
|
||||
|
||||
b.Property<byte[]>("Timestamp")
|
||||
.IsConcurrencyToken()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("bytea")
|
||||
.HasColumnName("timestamp");
|
||||
|
||||
b.HasKey("UID")
|
||||
.HasName("pk_users");
|
||||
|
||||
b.HasIndex("CharacterIdentification")
|
||||
.HasDatabaseName("ix_users_character_identification");
|
||||
|
||||
b.ToTable("users", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.Auth", b =>
|
||||
{
|
||||
b.HasOne("MareSynchronosServer.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserUID")
|
||||
.HasConstraintName("fk_auth_users_user_temp_id");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.ClientPair", b =>
|
||||
{
|
||||
b.HasOne("MareSynchronosServer.Models.User", "OtherUser")
|
||||
.WithMany()
|
||||
.HasForeignKey("OtherUserUID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_client_pairs_users_other_user_temp_id1");
|
||||
|
||||
b.HasOne("MareSynchronosServer.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserUID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_client_pairs_users_user_temp_id2");
|
||||
|
||||
b.Navigation("OtherUser");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.FileCache", b =>
|
||||
{
|
||||
b.HasOne("MareSynchronosServer.Models.User", "Uploader")
|
||||
.WithMany()
|
||||
.HasForeignKey("UploaderUID")
|
||||
.HasConstraintName("fk_file_caches_users_uploader_uid");
|
||||
|
||||
b.Navigation("Uploader");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.LodeStoneAuth", b =>
|
||||
{
|
||||
b.HasOne("MareSynchronosServer.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserUID")
|
||||
.HasConstraintName("fk_lodestone_auth_users_user_uid");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MareSynchronosServer.Migrations
|
||||
{
|
||||
public partial class AddLodestoneAuth : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "lodestone_auth",
|
||||
columns: table => new
|
||||
{
|
||||
discord_id = table.Column<decimal>(type: "numeric(20,0)", nullable: false),
|
||||
hashed_lodestone_id = table.Column<string>(type: "text", nullable: true),
|
||||
lodestone_auth_string = table.Column<string>(type: "text", nullable: true),
|
||||
user_uid = table.Column<string>(type: "character varying(10)", nullable: true),
|
||||
started_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_lodestone_auth", x => x.discord_id);
|
||||
table.ForeignKey(
|
||||
name: "fk_lodestone_auth_users_user_uid",
|
||||
column: x => x.user_uid,
|
||||
principalTable: "users",
|
||||
principalColumn: "uid");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_lodestone_auth_user_uid",
|
||||
table: "lodestone_auth",
|
||||
column: "user_uid");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "lodestone_auth");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,283 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using MareSynchronosShared.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MareSynchronosServer.Migrations
|
||||
{
|
||||
[DbContext(typeof(MareDbContext))]
|
||||
[Migration("20220801122103_AddNullableLodestoneAuthProperties")]
|
||||
partial class AddNullableLodestoneAuthProperties
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "6.0.6")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.Auth", b =>
|
||||
{
|
||||
b.Property<string>("HashedKey")
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("character varying(64)")
|
||||
.HasColumnName("hashed_key");
|
||||
|
||||
b.Property<string>("UserUID")
|
||||
.HasColumnType("character varying(10)")
|
||||
.HasColumnName("user_uid");
|
||||
|
||||
b.HasKey("HashedKey")
|
||||
.HasName("pk_auth");
|
||||
|
||||
b.HasIndex("UserUID")
|
||||
.HasDatabaseName("ix_auth_user_uid");
|
||||
|
||||
b.ToTable("auth", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.Banned", b =>
|
||||
{
|
||||
b.Property<string>("CharacterIdentification")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("character_identification");
|
||||
|
||||
b.Property<string>("Reason")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("reason");
|
||||
|
||||
b.Property<byte[]>("Timestamp")
|
||||
.IsConcurrencyToken()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("bytea")
|
||||
.HasColumnName("timestamp");
|
||||
|
||||
b.HasKey("CharacterIdentification")
|
||||
.HasName("pk_banned_users");
|
||||
|
||||
b.ToTable("banned_users", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.ClientPair", b =>
|
||||
{
|
||||
b.Property<string>("UserUID")
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("character varying(10)")
|
||||
.HasColumnName("user_uid");
|
||||
|
||||
b.Property<string>("OtherUserUID")
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("character varying(10)")
|
||||
.HasColumnName("other_user_uid");
|
||||
|
||||
b.Property<bool>("AllowReceivingMessages")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("allow_receiving_messages");
|
||||
|
||||
b.Property<bool>("IsPaused")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("is_paused");
|
||||
|
||||
b.Property<byte[]>("Timestamp")
|
||||
.IsConcurrencyToken()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("bytea")
|
||||
.HasColumnName("timestamp");
|
||||
|
||||
b.HasKey("UserUID", "OtherUserUID")
|
||||
.HasName("pk_client_pairs");
|
||||
|
||||
b.HasIndex("OtherUserUID")
|
||||
.HasDatabaseName("ix_client_pairs_other_user_uid");
|
||||
|
||||
b.HasIndex("UserUID")
|
||||
.HasDatabaseName("ix_client_pairs_user_uid");
|
||||
|
||||
b.ToTable("client_pairs", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.FileCache", b =>
|
||||
{
|
||||
b.Property<string>("Hash")
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("character varying(40)")
|
||||
.HasColumnName("hash");
|
||||
|
||||
b.Property<byte[]>("Timestamp")
|
||||
.IsConcurrencyToken()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("bytea")
|
||||
.HasColumnName("timestamp");
|
||||
|
||||
b.Property<bool>("Uploaded")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("uploaded");
|
||||
|
||||
b.Property<string>("UploaderUID")
|
||||
.HasColumnType("character varying(10)")
|
||||
.HasColumnName("uploader_uid");
|
||||
|
||||
b.HasKey("Hash")
|
||||
.HasName("pk_file_caches");
|
||||
|
||||
b.HasIndex("UploaderUID")
|
||||
.HasDatabaseName("ix_file_caches_uploader_uid");
|
||||
|
||||
b.ToTable("file_caches", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.ForbiddenUploadEntry", b =>
|
||||
{
|
||||
b.Property<string>("Hash")
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("character varying(40)")
|
||||
.HasColumnName("hash");
|
||||
|
||||
b.Property<string>("ForbiddenBy")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("forbidden_by");
|
||||
|
||||
b.Property<byte[]>("Timestamp")
|
||||
.IsConcurrencyToken()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("bytea")
|
||||
.HasColumnName("timestamp");
|
||||
|
||||
b.HasKey("Hash")
|
||||
.HasName("pk_forbidden_upload_entries");
|
||||
|
||||
b.ToTable("forbidden_upload_entries", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.LodeStoneAuth", b =>
|
||||
{
|
||||
b.Property<decimal>("DiscordId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("numeric(20,0)")
|
||||
.HasColumnName("discord_id");
|
||||
|
||||
b.Property<string>("HashedLodestoneId")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("hashed_lodestone_id");
|
||||
|
||||
b.Property<string>("LodestoneAuthString")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("lodestone_auth_string");
|
||||
|
||||
b.Property<DateTime?>("StartedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("started_at");
|
||||
|
||||
b.Property<string>("UserUID")
|
||||
.HasColumnType("character varying(10)")
|
||||
.HasColumnName("user_uid");
|
||||
|
||||
b.HasKey("DiscordId")
|
||||
.HasName("pk_lodestone_auth");
|
||||
|
||||
b.HasIndex("UserUID")
|
||||
.HasDatabaseName("ix_lodestone_auth_user_uid");
|
||||
|
||||
b.ToTable("lodestone_auth", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.User", b =>
|
||||
{
|
||||
b.Property<string>("UID")
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("character varying(10)")
|
||||
.HasColumnName("uid");
|
||||
|
||||
b.Property<string>("CharacterIdentification")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("character_identification");
|
||||
|
||||
b.Property<bool>("IsAdmin")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("is_admin");
|
||||
|
||||
b.Property<bool>("IsModerator")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("is_moderator");
|
||||
|
||||
b.Property<DateTime>("LastLoggedIn")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("last_logged_in");
|
||||
|
||||
b.Property<byte[]>("Timestamp")
|
||||
.IsConcurrencyToken()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("bytea")
|
||||
.HasColumnName("timestamp");
|
||||
|
||||
b.HasKey("UID")
|
||||
.HasName("pk_users");
|
||||
|
||||
b.HasIndex("CharacterIdentification")
|
||||
.HasDatabaseName("ix_users_character_identification");
|
||||
|
||||
b.ToTable("users", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.Auth", b =>
|
||||
{
|
||||
b.HasOne("MareSynchronosServer.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserUID")
|
||||
.HasConstraintName("fk_auth_users_user_temp_id");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.ClientPair", b =>
|
||||
{
|
||||
b.HasOne("MareSynchronosServer.Models.User", "OtherUser")
|
||||
.WithMany()
|
||||
.HasForeignKey("OtherUserUID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_client_pairs_users_other_user_temp_id1");
|
||||
|
||||
b.HasOne("MareSynchronosServer.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserUID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_client_pairs_users_user_temp_id2");
|
||||
|
||||
b.Navigation("OtherUser");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.FileCache", b =>
|
||||
{
|
||||
b.HasOne("MareSynchronosServer.Models.User", "Uploader")
|
||||
.WithMany()
|
||||
.HasForeignKey("UploaderUID")
|
||||
.HasConstraintName("fk_file_caches_users_uploader_uid");
|
||||
|
||||
b.Navigation("Uploader");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.LodeStoneAuth", b =>
|
||||
{
|
||||
b.HasOne("MareSynchronosServer.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserUID")
|
||||
.HasConstraintName("fk_lodestone_auth_users_user_uid");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MareSynchronosServer.Migrations
|
||||
{
|
||||
public partial class AddNullableLodestoneAuthProperties : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<DateTime>(
|
||||
name: "started_at",
|
||||
table: "lodestone_auth",
|
||||
type: "timestamp with time zone",
|
||||
nullable: true,
|
||||
oldClrType: typeof(DateTime),
|
||||
oldType: "timestamp with time zone");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<DateTime>(
|
||||
name: "started_at",
|
||||
table: "lodestone_auth",
|
||||
type: "timestamp with time zone",
|
||||
nullable: false,
|
||||
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
||||
oldClrType: typeof(DateTime),
|
||||
oldType: "timestamp with time zone",
|
||||
oldNullable: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
295
MareSynchronosServer/MareSynchronosShared/Migrations/20220806103053_AddBannedRegistrations.Designer.cs
generated
Normal file
295
MareSynchronosServer/MareSynchronosShared/Migrations/20220806103053_AddBannedRegistrations.Designer.cs
generated
Normal file
@@ -0,0 +1,295 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using MareSynchronosShared.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MareSynchronosServer.Migrations
|
||||
{
|
||||
[DbContext(typeof(MareDbContext))]
|
||||
[Migration("20220806103053_AddBannedRegistrations")]
|
||||
partial class AddBannedRegistrations
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "6.0.6")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.Auth", b =>
|
||||
{
|
||||
b.Property<string>("HashedKey")
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("character varying(64)")
|
||||
.HasColumnName("hashed_key");
|
||||
|
||||
b.Property<string>("UserUID")
|
||||
.HasColumnType("character varying(10)")
|
||||
.HasColumnName("user_uid");
|
||||
|
||||
b.HasKey("HashedKey")
|
||||
.HasName("pk_auth");
|
||||
|
||||
b.HasIndex("UserUID")
|
||||
.HasDatabaseName("ix_auth_user_uid");
|
||||
|
||||
b.ToTable("auth", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.Banned", b =>
|
||||
{
|
||||
b.Property<string>("CharacterIdentification")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("character_identification");
|
||||
|
||||
b.Property<string>("Reason")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("reason");
|
||||
|
||||
b.Property<byte[]>("Timestamp")
|
||||
.IsConcurrencyToken()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("bytea")
|
||||
.HasColumnName("timestamp");
|
||||
|
||||
b.HasKey("CharacterIdentification")
|
||||
.HasName("pk_banned_users");
|
||||
|
||||
b.ToTable("banned_users", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.BannedRegistrations", b =>
|
||||
{
|
||||
b.Property<string>("DiscordIdOrLodestoneAuth")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("discord_id_or_lodestone_auth");
|
||||
|
||||
b.HasKey("DiscordIdOrLodestoneAuth")
|
||||
.HasName("pk_banned_registrations");
|
||||
|
||||
b.ToTable("banned_registrations", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.ClientPair", b =>
|
||||
{
|
||||
b.Property<string>("UserUID")
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("character varying(10)")
|
||||
.HasColumnName("user_uid");
|
||||
|
||||
b.Property<string>("OtherUserUID")
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("character varying(10)")
|
||||
.HasColumnName("other_user_uid");
|
||||
|
||||
b.Property<bool>("AllowReceivingMessages")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("allow_receiving_messages");
|
||||
|
||||
b.Property<bool>("IsPaused")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("is_paused");
|
||||
|
||||
b.Property<byte[]>("Timestamp")
|
||||
.IsConcurrencyToken()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("bytea")
|
||||
.HasColumnName("timestamp");
|
||||
|
||||
b.HasKey("UserUID", "OtherUserUID")
|
||||
.HasName("pk_client_pairs");
|
||||
|
||||
b.HasIndex("OtherUserUID")
|
||||
.HasDatabaseName("ix_client_pairs_other_user_uid");
|
||||
|
||||
b.HasIndex("UserUID")
|
||||
.HasDatabaseName("ix_client_pairs_user_uid");
|
||||
|
||||
b.ToTable("client_pairs", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.FileCache", b =>
|
||||
{
|
||||
b.Property<string>("Hash")
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("character varying(40)")
|
||||
.HasColumnName("hash");
|
||||
|
||||
b.Property<byte[]>("Timestamp")
|
||||
.IsConcurrencyToken()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("bytea")
|
||||
.HasColumnName("timestamp");
|
||||
|
||||
b.Property<bool>("Uploaded")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("uploaded");
|
||||
|
||||
b.Property<string>("UploaderUID")
|
||||
.HasColumnType("character varying(10)")
|
||||
.HasColumnName("uploader_uid");
|
||||
|
||||
b.HasKey("Hash")
|
||||
.HasName("pk_file_caches");
|
||||
|
||||
b.HasIndex("UploaderUID")
|
||||
.HasDatabaseName("ix_file_caches_uploader_uid");
|
||||
|
||||
b.ToTable("file_caches", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.ForbiddenUploadEntry", b =>
|
||||
{
|
||||
b.Property<string>("Hash")
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("character varying(40)")
|
||||
.HasColumnName("hash");
|
||||
|
||||
b.Property<string>("ForbiddenBy")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("forbidden_by");
|
||||
|
||||
b.Property<byte[]>("Timestamp")
|
||||
.IsConcurrencyToken()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("bytea")
|
||||
.HasColumnName("timestamp");
|
||||
|
||||
b.HasKey("Hash")
|
||||
.HasName("pk_forbidden_upload_entries");
|
||||
|
||||
b.ToTable("forbidden_upload_entries", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.LodeStoneAuth", b =>
|
||||
{
|
||||
b.Property<decimal>("DiscordId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("numeric(20,0)")
|
||||
.HasColumnName("discord_id");
|
||||
|
||||
b.Property<string>("HashedLodestoneId")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("hashed_lodestone_id");
|
||||
|
||||
b.Property<string>("LodestoneAuthString")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("lodestone_auth_string");
|
||||
|
||||
b.Property<DateTime?>("StartedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("started_at");
|
||||
|
||||
b.Property<string>("UserUID")
|
||||
.HasColumnType("character varying(10)")
|
||||
.HasColumnName("user_uid");
|
||||
|
||||
b.HasKey("DiscordId")
|
||||
.HasName("pk_lodestone_auth");
|
||||
|
||||
b.HasIndex("UserUID")
|
||||
.HasDatabaseName("ix_lodestone_auth_user_uid");
|
||||
|
||||
b.ToTable("lodestone_auth", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.User", b =>
|
||||
{
|
||||
b.Property<string>("UID")
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("character varying(10)")
|
||||
.HasColumnName("uid");
|
||||
|
||||
b.Property<string>("CharacterIdentification")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("character_identification");
|
||||
|
||||
b.Property<bool>("IsAdmin")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("is_admin");
|
||||
|
||||
b.Property<bool>("IsModerator")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("is_moderator");
|
||||
|
||||
b.Property<DateTime>("LastLoggedIn")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("last_logged_in");
|
||||
|
||||
b.Property<byte[]>("Timestamp")
|
||||
.IsConcurrencyToken()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("bytea")
|
||||
.HasColumnName("timestamp");
|
||||
|
||||
b.HasKey("UID")
|
||||
.HasName("pk_users");
|
||||
|
||||
b.HasIndex("CharacterIdentification")
|
||||
.HasDatabaseName("ix_users_character_identification");
|
||||
|
||||
b.ToTable("users", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.Auth", b =>
|
||||
{
|
||||
b.HasOne("MareSynchronosServer.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserUID")
|
||||
.HasConstraintName("fk_auth_users_user_temp_id");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.ClientPair", b =>
|
||||
{
|
||||
b.HasOne("MareSynchronosServer.Models.User", "OtherUser")
|
||||
.WithMany()
|
||||
.HasForeignKey("OtherUserUID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_client_pairs_users_other_user_temp_id1");
|
||||
|
||||
b.HasOne("MareSynchronosServer.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserUID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_client_pairs_users_user_temp_id2");
|
||||
|
||||
b.Navigation("OtherUser");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.FileCache", b =>
|
||||
{
|
||||
b.HasOne("MareSynchronosServer.Models.User", "Uploader")
|
||||
.WithMany()
|
||||
.HasForeignKey("UploaderUID")
|
||||
.HasConstraintName("fk_file_caches_users_uploader_uid");
|
||||
|
||||
b.Navigation("Uploader");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.LodeStoneAuth", b =>
|
||||
{
|
||||
b.HasOne("MareSynchronosServer.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserUID")
|
||||
.HasConstraintName("fk_lodestone_auth_users_user_uid");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MareSynchronosServer.Migrations
|
||||
{
|
||||
public partial class AddBannedRegistrations : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "banned_registrations",
|
||||
columns: table => new
|
||||
{
|
||||
discord_id_or_lodestone_auth = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_banned_registrations", x => x.discord_id_or_lodestone_auth);
|
||||
});
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "banned_registrations");
|
||||
}
|
||||
}
|
||||
}
|
||||
302
MareSynchronosServer/MareSynchronosShared/Migrations/20220816170426_SetMaxLimitForStrings.Designer.cs
generated
Normal file
302
MareSynchronosServer/MareSynchronosShared/Migrations/20220816170426_SetMaxLimitForStrings.Designer.cs
generated
Normal file
@@ -0,0 +1,302 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using MareSynchronosShared.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MareSynchronosServer.Migrations
|
||||
{
|
||||
[DbContext(typeof(MareDbContext))]
|
||||
[Migration("20220816170426_SetMaxLimitForStrings")]
|
||||
partial class SetMaxLimitForStrings
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "6.0.8")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.Auth", b =>
|
||||
{
|
||||
b.Property<string>("HashedKey")
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("character varying(64)")
|
||||
.HasColumnName("hashed_key");
|
||||
|
||||
b.Property<string>("UserUID")
|
||||
.HasColumnType("character varying(10)")
|
||||
.HasColumnName("user_uid");
|
||||
|
||||
b.HasKey("HashedKey")
|
||||
.HasName("pk_auth");
|
||||
|
||||
b.HasIndex("UserUID")
|
||||
.HasDatabaseName("ix_auth_user_uid");
|
||||
|
||||
b.ToTable("auth", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.Banned", b =>
|
||||
{
|
||||
b.Property<string>("CharacterIdentification")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)")
|
||||
.HasColumnName("character_identification");
|
||||
|
||||
b.Property<string>("Reason")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("reason");
|
||||
|
||||
b.Property<byte[]>("Timestamp")
|
||||
.IsConcurrencyToken()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("bytea")
|
||||
.HasColumnName("timestamp");
|
||||
|
||||
b.HasKey("CharacterIdentification")
|
||||
.HasName("pk_banned_users");
|
||||
|
||||
b.ToTable("banned_users", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.BannedRegistrations", b =>
|
||||
{
|
||||
b.Property<string>("DiscordIdOrLodestoneAuth")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)")
|
||||
.HasColumnName("discord_id_or_lodestone_auth");
|
||||
|
||||
b.HasKey("DiscordIdOrLodestoneAuth")
|
||||
.HasName("pk_banned_registrations");
|
||||
|
||||
b.ToTable("banned_registrations", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.ClientPair", b =>
|
||||
{
|
||||
b.Property<string>("UserUID")
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("character varying(10)")
|
||||
.HasColumnName("user_uid");
|
||||
|
||||
b.Property<string>("OtherUserUID")
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("character varying(10)")
|
||||
.HasColumnName("other_user_uid");
|
||||
|
||||
b.Property<bool>("AllowReceivingMessages")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("allow_receiving_messages");
|
||||
|
||||
b.Property<bool>("IsPaused")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("is_paused");
|
||||
|
||||
b.Property<byte[]>("Timestamp")
|
||||
.IsConcurrencyToken()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("bytea")
|
||||
.HasColumnName("timestamp");
|
||||
|
||||
b.HasKey("UserUID", "OtherUserUID")
|
||||
.HasName("pk_client_pairs");
|
||||
|
||||
b.HasIndex("OtherUserUID")
|
||||
.HasDatabaseName("ix_client_pairs_other_user_uid");
|
||||
|
||||
b.HasIndex("UserUID")
|
||||
.HasDatabaseName("ix_client_pairs_user_uid");
|
||||
|
||||
b.ToTable("client_pairs", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.FileCache", b =>
|
||||
{
|
||||
b.Property<string>("Hash")
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("character varying(40)")
|
||||
.HasColumnName("hash");
|
||||
|
||||
b.Property<byte[]>("Timestamp")
|
||||
.IsConcurrencyToken()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("bytea")
|
||||
.HasColumnName("timestamp");
|
||||
|
||||
b.Property<bool>("Uploaded")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("uploaded");
|
||||
|
||||
b.Property<string>("UploaderUID")
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("character varying(10)")
|
||||
.HasColumnName("uploader_uid");
|
||||
|
||||
b.HasKey("Hash")
|
||||
.HasName("pk_file_caches");
|
||||
|
||||
b.HasIndex("UploaderUID")
|
||||
.HasDatabaseName("ix_file_caches_uploader_uid");
|
||||
|
||||
b.ToTable("file_caches", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.ForbiddenUploadEntry", b =>
|
||||
{
|
||||
b.Property<string>("Hash")
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("character varying(40)")
|
||||
.HasColumnName("hash");
|
||||
|
||||
b.Property<string>("ForbiddenBy")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)")
|
||||
.HasColumnName("forbidden_by");
|
||||
|
||||
b.Property<byte[]>("Timestamp")
|
||||
.IsConcurrencyToken()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("bytea")
|
||||
.HasColumnName("timestamp");
|
||||
|
||||
b.HasKey("Hash")
|
||||
.HasName("pk_forbidden_upload_entries");
|
||||
|
||||
b.ToTable("forbidden_upload_entries", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.LodeStoneAuth", b =>
|
||||
{
|
||||
b.Property<decimal>("DiscordId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("numeric(20,0)")
|
||||
.HasColumnName("discord_id");
|
||||
|
||||
b.Property<string>("HashedLodestoneId")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)")
|
||||
.HasColumnName("hashed_lodestone_id");
|
||||
|
||||
b.Property<string>("LodestoneAuthString")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)")
|
||||
.HasColumnName("lodestone_auth_string");
|
||||
|
||||
b.Property<DateTime?>("StartedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("started_at");
|
||||
|
||||
b.Property<string>("UserUID")
|
||||
.HasColumnType("character varying(10)")
|
||||
.HasColumnName("user_uid");
|
||||
|
||||
b.HasKey("DiscordId")
|
||||
.HasName("pk_lodestone_auth");
|
||||
|
||||
b.HasIndex("UserUID")
|
||||
.HasDatabaseName("ix_lodestone_auth_user_uid");
|
||||
|
||||
b.ToTable("lodestone_auth", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.User", b =>
|
||||
{
|
||||
b.Property<string>("UID")
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("character varying(10)")
|
||||
.HasColumnName("uid");
|
||||
|
||||
b.Property<string>("CharacterIdentification")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)")
|
||||
.HasColumnName("character_identification");
|
||||
|
||||
b.Property<bool>("IsAdmin")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("is_admin");
|
||||
|
||||
b.Property<bool>("IsModerator")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("is_moderator");
|
||||
|
||||
b.Property<DateTime>("LastLoggedIn")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("last_logged_in");
|
||||
|
||||
b.Property<byte[]>("Timestamp")
|
||||
.IsConcurrencyToken()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("bytea")
|
||||
.HasColumnName("timestamp");
|
||||
|
||||
b.HasKey("UID")
|
||||
.HasName("pk_users");
|
||||
|
||||
b.HasIndex("CharacterIdentification")
|
||||
.HasDatabaseName("ix_users_character_identification");
|
||||
|
||||
b.ToTable("users", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.Auth", b =>
|
||||
{
|
||||
b.HasOne("MareSynchronosServer.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserUID")
|
||||
.HasConstraintName("fk_auth_users_user_temp_id");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.ClientPair", b =>
|
||||
{
|
||||
b.HasOne("MareSynchronosServer.Models.User", "OtherUser")
|
||||
.WithMany()
|
||||
.HasForeignKey("OtherUserUID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_client_pairs_users_other_user_temp_id1");
|
||||
|
||||
b.HasOne("MareSynchronosServer.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserUID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_client_pairs_users_user_temp_id2");
|
||||
|
||||
b.Navigation("OtherUser");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.FileCache", b =>
|
||||
{
|
||||
b.HasOne("MareSynchronosServer.Models.User", "Uploader")
|
||||
.WithMany()
|
||||
.HasForeignKey("UploaderUID")
|
||||
.HasConstraintName("fk_file_caches_users_uploader_uid");
|
||||
|
||||
b.Navigation("Uploader");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.LodeStoneAuth", b =>
|
||||
{
|
||||
b.HasOne("MareSynchronosServer.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserUID")
|
||||
.HasConstraintName("fk_lodestone_auth_users_user_uid");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MareSynchronosServer.Migrations
|
||||
{
|
||||
public partial class SetMaxLimitForStrings : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "character_identification",
|
||||
table: "users",
|
||||
type: "character varying(100)",
|
||||
maxLength: 100,
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "lodestone_auth_string",
|
||||
table: "lodestone_auth",
|
||||
type: "character varying(100)",
|
||||
maxLength: 100,
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "hashed_lodestone_id",
|
||||
table: "lodestone_auth",
|
||||
type: "character varying(100)",
|
||||
maxLength: 100,
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "forbidden_by",
|
||||
table: "forbidden_upload_entries",
|
||||
type: "character varying(100)",
|
||||
maxLength: 100,
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "character_identification",
|
||||
table: "banned_users",
|
||||
type: "character varying(100)",
|
||||
maxLength: 100,
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "discord_id_or_lodestone_auth",
|
||||
table: "banned_registrations",
|
||||
type: "character varying(100)",
|
||||
maxLength: 100,
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "character_identification",
|
||||
table: "users",
|
||||
type: "text",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(100)",
|
||||
oldMaxLength: 100,
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "lodestone_auth_string",
|
||||
table: "lodestone_auth",
|
||||
type: "text",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(100)",
|
||||
oldMaxLength: 100,
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "hashed_lodestone_id",
|
||||
table: "lodestone_auth",
|
||||
type: "text",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(100)",
|
||||
oldMaxLength: 100,
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "forbidden_by",
|
||||
table: "forbidden_upload_entries",
|
||||
type: "text",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(100)",
|
||||
oldMaxLength: 100,
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "character_identification",
|
||||
table: "banned_users",
|
||||
type: "text",
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(100)",
|
||||
oldMaxLength: 100);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "discord_id_or_lodestone_auth",
|
||||
table: "banned_registrations",
|
||||
type: "text",
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(100)",
|
||||
oldMaxLength: 100);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,300 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using MareSynchronosShared.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MareSynchronosServer.Migrations
|
||||
{
|
||||
[DbContext(typeof(MareDbContext))]
|
||||
partial class MareDbContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "6.0.8")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.Auth", b =>
|
||||
{
|
||||
b.Property<string>("HashedKey")
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("character varying(64)")
|
||||
.HasColumnName("hashed_key");
|
||||
|
||||
b.Property<string>("UserUID")
|
||||
.HasColumnType("character varying(10)")
|
||||
.HasColumnName("user_uid");
|
||||
|
||||
b.HasKey("HashedKey")
|
||||
.HasName("pk_auth");
|
||||
|
||||
b.HasIndex("UserUID")
|
||||
.HasDatabaseName("ix_auth_user_uid");
|
||||
|
||||
b.ToTable("auth", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.Banned", b =>
|
||||
{
|
||||
b.Property<string>("CharacterIdentification")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)")
|
||||
.HasColumnName("character_identification");
|
||||
|
||||
b.Property<string>("Reason")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("reason");
|
||||
|
||||
b.Property<byte[]>("Timestamp")
|
||||
.IsConcurrencyToken()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("bytea")
|
||||
.HasColumnName("timestamp");
|
||||
|
||||
b.HasKey("CharacterIdentification")
|
||||
.HasName("pk_banned_users");
|
||||
|
||||
b.ToTable("banned_users", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.BannedRegistrations", b =>
|
||||
{
|
||||
b.Property<string>("DiscordIdOrLodestoneAuth")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)")
|
||||
.HasColumnName("discord_id_or_lodestone_auth");
|
||||
|
||||
b.HasKey("DiscordIdOrLodestoneAuth")
|
||||
.HasName("pk_banned_registrations");
|
||||
|
||||
b.ToTable("banned_registrations", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.ClientPair", b =>
|
||||
{
|
||||
b.Property<string>("UserUID")
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("character varying(10)")
|
||||
.HasColumnName("user_uid");
|
||||
|
||||
b.Property<string>("OtherUserUID")
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("character varying(10)")
|
||||
.HasColumnName("other_user_uid");
|
||||
|
||||
b.Property<bool>("AllowReceivingMessages")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("allow_receiving_messages");
|
||||
|
||||
b.Property<bool>("IsPaused")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("is_paused");
|
||||
|
||||
b.Property<byte[]>("Timestamp")
|
||||
.IsConcurrencyToken()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("bytea")
|
||||
.HasColumnName("timestamp");
|
||||
|
||||
b.HasKey("UserUID", "OtherUserUID")
|
||||
.HasName("pk_client_pairs");
|
||||
|
||||
b.HasIndex("OtherUserUID")
|
||||
.HasDatabaseName("ix_client_pairs_other_user_uid");
|
||||
|
||||
b.HasIndex("UserUID")
|
||||
.HasDatabaseName("ix_client_pairs_user_uid");
|
||||
|
||||
b.ToTable("client_pairs", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.FileCache", b =>
|
||||
{
|
||||
b.Property<string>("Hash")
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("character varying(40)")
|
||||
.HasColumnName("hash");
|
||||
|
||||
b.Property<byte[]>("Timestamp")
|
||||
.IsConcurrencyToken()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("bytea")
|
||||
.HasColumnName("timestamp");
|
||||
|
||||
b.Property<bool>("Uploaded")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("uploaded");
|
||||
|
||||
b.Property<string>("UploaderUID")
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("character varying(10)")
|
||||
.HasColumnName("uploader_uid");
|
||||
|
||||
b.HasKey("Hash")
|
||||
.HasName("pk_file_caches");
|
||||
|
||||
b.HasIndex("UploaderUID")
|
||||
.HasDatabaseName("ix_file_caches_uploader_uid");
|
||||
|
||||
b.ToTable("file_caches", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.ForbiddenUploadEntry", b =>
|
||||
{
|
||||
b.Property<string>("Hash")
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("character varying(40)")
|
||||
.HasColumnName("hash");
|
||||
|
||||
b.Property<string>("ForbiddenBy")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)")
|
||||
.HasColumnName("forbidden_by");
|
||||
|
||||
b.Property<byte[]>("Timestamp")
|
||||
.IsConcurrencyToken()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("bytea")
|
||||
.HasColumnName("timestamp");
|
||||
|
||||
b.HasKey("Hash")
|
||||
.HasName("pk_forbidden_upload_entries");
|
||||
|
||||
b.ToTable("forbidden_upload_entries", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.LodeStoneAuth", b =>
|
||||
{
|
||||
b.Property<decimal>("DiscordId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("numeric(20,0)")
|
||||
.HasColumnName("discord_id");
|
||||
|
||||
b.Property<string>("HashedLodestoneId")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)")
|
||||
.HasColumnName("hashed_lodestone_id");
|
||||
|
||||
b.Property<string>("LodestoneAuthString")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)")
|
||||
.HasColumnName("lodestone_auth_string");
|
||||
|
||||
b.Property<DateTime?>("StartedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("started_at");
|
||||
|
||||
b.Property<string>("UserUID")
|
||||
.HasColumnType("character varying(10)")
|
||||
.HasColumnName("user_uid");
|
||||
|
||||
b.HasKey("DiscordId")
|
||||
.HasName("pk_lodestone_auth");
|
||||
|
||||
b.HasIndex("UserUID")
|
||||
.HasDatabaseName("ix_lodestone_auth_user_uid");
|
||||
|
||||
b.ToTable("lodestone_auth", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.User", b =>
|
||||
{
|
||||
b.Property<string>("UID")
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("character varying(10)")
|
||||
.HasColumnName("uid");
|
||||
|
||||
b.Property<string>("CharacterIdentification")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)")
|
||||
.HasColumnName("character_identification");
|
||||
|
||||
b.Property<bool>("IsAdmin")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("is_admin");
|
||||
|
||||
b.Property<bool>("IsModerator")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("is_moderator");
|
||||
|
||||
b.Property<DateTime>("LastLoggedIn")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("last_logged_in");
|
||||
|
||||
b.Property<byte[]>("Timestamp")
|
||||
.IsConcurrencyToken()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("bytea")
|
||||
.HasColumnName("timestamp");
|
||||
|
||||
b.HasKey("UID")
|
||||
.HasName("pk_users");
|
||||
|
||||
b.HasIndex("CharacterIdentification")
|
||||
.HasDatabaseName("ix_users_character_identification");
|
||||
|
||||
b.ToTable("users", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.Auth", b =>
|
||||
{
|
||||
b.HasOne("MareSynchronosServer.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserUID")
|
||||
.HasConstraintName("fk_auth_users_user_temp_id");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.ClientPair", b =>
|
||||
{
|
||||
b.HasOne("MareSynchronosServer.Models.User", "OtherUser")
|
||||
.WithMany()
|
||||
.HasForeignKey("OtherUserUID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_client_pairs_users_other_user_temp_id1");
|
||||
|
||||
b.HasOne("MareSynchronosServer.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserUID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_client_pairs_users_user_temp_id2");
|
||||
|
||||
b.Navigation("OtherUser");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.FileCache", b =>
|
||||
{
|
||||
b.HasOne("MareSynchronosServer.Models.User", "Uploader")
|
||||
.WithMany()
|
||||
.HasForeignKey("UploaderUID")
|
||||
.HasConstraintName("fk_file_caches_users_uploader_uid");
|
||||
|
||||
b.Navigation("Uploader");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MareSynchronosServer.Models.LodeStoneAuth", b =>
|
||||
{
|
||||
b.HasOne("MareSynchronosServer.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserUID")
|
||||
.HasConstraintName("fk_lodestone_auth_users_user_uid");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
14
MareSynchronosServer/MareSynchronosShared/Models/Auth.cs
Normal file
14
MareSynchronosServer/MareSynchronosShared/Models/Auth.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MareSynchronosShared.Models
|
||||
{
|
||||
public class Auth
|
||||
{
|
||||
[Key]
|
||||
[MaxLength(64)]
|
||||
public string HashedKey { get; set; }
|
||||
|
||||
public string UserUID { get; set; }
|
||||
public User User { get; set; }
|
||||
}
|
||||
}
|
||||
14
MareSynchronosServer/MareSynchronosShared/Models/Banned.cs
Normal file
14
MareSynchronosServer/MareSynchronosShared/Models/Banned.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MareSynchronosShared.Models
|
||||
{
|
||||
public class Banned
|
||||
{
|
||||
[Key]
|
||||
[MaxLength(100)]
|
||||
public string CharacterIdentification { get; set; }
|
||||
public string Reason { get; set; }
|
||||
[Timestamp]
|
||||
public byte[] Timestamp { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MareSynchronosShared.Models
|
||||
{
|
||||
public class BannedRegistrations
|
||||
{
|
||||
[Key]
|
||||
[MaxLength(100)]
|
||||
public string DiscordIdOrLodestoneAuth { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MareSynchronosShared.Models
|
||||
{
|
||||
public class ClientPair
|
||||
{
|
||||
[MaxLength(10)]
|
||||
public string UserUID { get; set; }
|
||||
public User User { get; set; }
|
||||
[MaxLength(10)]
|
||||
public string OtherUserUID { get; set; }
|
||||
public User OtherUser { get; set; }
|
||||
public bool IsPaused { get; set; }
|
||||
public bool AllowReceivingMessages { get; set; } = false;
|
||||
[Timestamp]
|
||||
public byte[] Timestamp { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MareSynchronosShared.Models
|
||||
{
|
||||
public class FileCache
|
||||
{
|
||||
[Key]
|
||||
[MaxLength(40)]
|
||||
public string Hash { get; set; }
|
||||
[MaxLength(10)]
|
||||
public string UploaderUID { get; set; }
|
||||
public User Uploader { get; set; }
|
||||
public bool Uploaded { get; set; }
|
||||
[Timestamp]
|
||||
public byte[] Timestamp { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MareSynchronosShared.Models
|
||||
{
|
||||
public class ForbiddenUploadEntry
|
||||
{
|
||||
[Key]
|
||||
[MaxLength(40)]
|
||||
public string Hash { get; set; }
|
||||
[MaxLength(100)]
|
||||
public string ForbiddenBy { get; set; }
|
||||
[Timestamp]
|
||||
public byte[] Timestamp { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MareSynchronosShared.Models
|
||||
{
|
||||
public class LodeStoneAuth
|
||||
{
|
||||
[Key]
|
||||
public ulong DiscordId { get; set; }
|
||||
[MaxLength(100)]
|
||||
public string HashedLodestoneId { get; set; }
|
||||
[MaxLength(100)]
|
||||
public string? LodestoneAuthString { get; set; }
|
||||
public User? User { get; set; }
|
||||
public DateTime? StartedAt { get; set; }
|
||||
}
|
||||
}
|
||||
21
MareSynchronosServer/MareSynchronosShared/Models/User.cs
Normal file
21
MareSynchronosServer/MareSynchronosShared/Models/User.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MareSynchronosShared.Models
|
||||
{
|
||||
public class User
|
||||
{
|
||||
[Key]
|
||||
[MaxLength(10)]
|
||||
public string UID { get; set; }
|
||||
[MaxLength(100)]
|
||||
public string CharacterIdentification { get; set; }
|
||||
[Timestamp]
|
||||
public byte[] Timestamp { get; set; }
|
||||
|
||||
public bool IsModerator { get; set; } = false;
|
||||
|
||||
public bool IsAdmin { get; set; } = false;
|
||||
|
||||
public DateTime LastLoggedIn { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user