mirror of
https://github.com/CyberL1/Minecraft-Realms-Emulator.git
synced 2026-09-15 19:25:48 -04:00
Compare commits
46
Commits
master
...
8addf1ceeb
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8addf1ceeb | ||
|
|
eeb3868f3e | ||
|
|
4ddc039936 | ||
|
|
56facce0cd | ||
|
|
da624684f3 | ||
|
|
a7d477fdaa | ||
|
|
611e9cda58 | ||
|
|
293b903ee0 | ||
|
|
75271ef4eb | ||
|
|
ddf2c8a3b9 | ||
|
|
151fb10cb6 | ||
|
|
f46844f9bf | ||
|
|
3a88a9b165 | ||
|
|
b6b6e977e4 | ||
|
|
0cdcb95b52 | ||
|
|
0e8a12b70c | ||
|
|
a376860d58 | ||
|
|
dd9fa3d2f4 | ||
|
|
68cd8eea94 | ||
|
|
97ad8f4fe2 | ||
|
|
8369b573f0 | ||
|
|
9710088026 | ||
|
|
05cf59a5a0 | ||
|
|
2ca2e0402a | ||
|
|
a3f743d28d | ||
|
|
b32840aaf2 | ||
|
|
9e80e7627f | ||
|
|
225b4194e6 | ||
|
|
e89df7cda5 | ||
|
|
4a79746602 | ||
|
|
326a9b1883 | ||
|
|
ee0b4a17b5 | ||
|
|
4af883579f | ||
|
|
2f1afe7cc7 | ||
|
|
f5701d2cdd | ||
|
|
6d228214f9 | ||
|
|
0c39c6169d | ||
|
|
448dff82eb | ||
|
|
78a55af111 | ||
|
|
28125b6221 | ||
|
|
3272a86983 | ||
|
|
a7936700fb | ||
|
|
c9d735cb83 | ||
|
|
57cddfb3e1 | ||
|
|
254375deb3 | ||
|
|
277836b233 |
@@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace Core.Attributes;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Method)]
|
||||
public class HasRealmAccessAttribute(bool isOwner = false) : Attribute
|
||||
{
|
||||
public bool IsOwner { get; } = isOwner;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Core.Controllers;
|
||||
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class FeatureController : ControllerBase
|
||||
{
|
||||
[HttpGet("v1")]
|
||||
public ActionResult GetFeatureFlags()
|
||||
{
|
||||
string[] featureFlags = ["realms_in_aks"];
|
||||
return Ok(featureFlags);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using Core.Enums;
|
||||
using Core.Models;
|
||||
using Core.Responses;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Core.Controllers;
|
||||
|
||||
[Route("[controller]")]
|
||||
[ApiController]
|
||||
public class McoController : Controller
|
||||
{
|
||||
[HttpGet("available")]
|
||||
public ActionResult<bool> GetAvailable()
|
||||
{
|
||||
return Ok(true);
|
||||
}
|
||||
|
||||
[HttpGet("client/compatible")]
|
||||
public ActionResult<string> GetClientCompatible()
|
||||
{
|
||||
return Ok(nameof(CompatibleVersionResponse.COMPATIBLE));
|
||||
}
|
||||
|
||||
[HttpPost("tos/agreed")]
|
||||
public ActionResult PostTosAgreed()
|
||||
{
|
||||
return Ok();
|
||||
}
|
||||
|
||||
[HttpGet("v1/news")]
|
||||
public ActionResult GetNews()
|
||||
{
|
||||
var newsResponse = new News { NewsLink = AppConfig.NewsLink };
|
||||
return Ok(newsResponse);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using Core.Responses;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Core.Controllers;
|
||||
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class NotificationsController : ControllerBase
|
||||
{
|
||||
[HttpGet]
|
||||
public ActionResult<NotificationList> GetNotifications()
|
||||
{
|
||||
var notifications = new NotificationList { Notifications = [] };
|
||||
|
||||
return Ok(notifications);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
using Core.Enums;
|
||||
using Core.Responses;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Region = Core.Enums.Region;
|
||||
|
||||
namespace Core.Controllers;
|
||||
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class RegionsController : ControllerBase
|
||||
{
|
||||
[HttpPost("ping/stat")]
|
||||
public ActionResult PostPing()
|
||||
{
|
||||
return Ok();
|
||||
}
|
||||
|
||||
[HttpGet("preferredRegions")]
|
||||
public ActionResult<RegionDataArray> GetPreferredRegions()
|
||||
{
|
||||
var regionDataList = new RegionDataArray { RegionDataList = [] };
|
||||
|
||||
foreach (var region in Enum.GetNames<Region>())
|
||||
regionDataList.RegionDataList.Add(new Models.Region
|
||||
{
|
||||
RegionName = region,
|
||||
ServiceQuality = ServiceQuality.Great
|
||||
});
|
||||
|
||||
return Ok(regionDataList);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using Core.Attributes;
|
||||
using Core.Data;
|
||||
using Core.Entities;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Core.Controllers;
|
||||
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class SubscriptionsController(DataContext context) : ControllerBase
|
||||
{
|
||||
[HttpGet("{wId}")]
|
||||
[HasRealmAccess(true)]
|
||||
public async Task<ActionResult<Subscription>> Get(int wId)
|
||||
{
|
||||
var realm = await context.Realms.Include(realm => realm.Subscription).FirstAsync(w => w.Id == wId);
|
||||
|
||||
var subscriptionResponse = new Responses.Subscription
|
||||
{
|
||||
StartDate = ((DateTimeOffset)realm.Subscription.StartDate).ToUnixTimeMilliseconds(),
|
||||
DaysLeft = realm.Subscription.DaysLeft,
|
||||
SubscriptionType = realm.Subscription.Type
|
||||
};
|
||||
|
||||
return Ok(subscriptionResponse);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using Core.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Core.Controllers;
|
||||
|
||||
[Route("[controller]")]
|
||||
[ApiController]
|
||||
public class TrialController : Controller
|
||||
{
|
||||
[HttpGet]
|
||||
public ActionResult GetTrial()
|
||||
{
|
||||
return Ok(AppConfig.Trial);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,243 @@
|
||||
using System.Text.Json;
|
||||
using Core.Attributes;
|
||||
using Core.Data;
|
||||
using Core.Enums;
|
||||
using Core.Models;
|
||||
using Core.Requests;
|
||||
using Core.Responses;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using AppConfig = Core.Models.AppConfig;
|
||||
using Player = Core.Entities.Player;
|
||||
using Realm = Core.Entities.Realm;
|
||||
using RealmRegionSelectionPreference = Core.Entities.RealmRegionSelectionPreference;
|
||||
using Region = Core.Enums.Region;
|
||||
using Slot = Core.Entities.Slot;
|
||||
using SlotOptions = Core.Entities.SlotOptions;
|
||||
using Subscription = Core.Entities.Subscription;
|
||||
|
||||
namespace Core.Controllers;
|
||||
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class WorldsController(DataContext context, CookiePlayerData playerData) : ControllerBase
|
||||
{
|
||||
[HttpGet]
|
||||
public async Task<ActionResult<RealmsList>> GetRealms()
|
||||
{
|
||||
var realms = await context.Realms.Include(realm => realm.Subscription).Include(realm => realm.ActiveSlot)
|
||||
.ThenInclude(slot => slot.Options).Include(realm => realm.Players)
|
||||
.Include(realm => realm.RegionSelectionPreference)
|
||||
.ToListAsync();
|
||||
|
||||
var servers = new RealmsList { Servers = [] };
|
||||
|
||||
if (realms.All(realm => realm.Players.First().Uuid != playerData.Uuid))
|
||||
{
|
||||
await using var transaction = await context.Database.BeginTransactionAsync();
|
||||
|
||||
var subscription = new Subscription
|
||||
{
|
||||
SubscriptionId = Guid.NewGuid().ToString(),
|
||||
StartDate = DateTime.UtcNow,
|
||||
Type = nameof(SubscriptionType.NORMAL)
|
||||
};
|
||||
|
||||
context.Subscriptions.Add(subscription);
|
||||
await context.SaveChangesAsync();
|
||||
|
||||
var owner = new Player
|
||||
{
|
||||
Uuid = playerData.Uuid,
|
||||
Name = playerData.Name,
|
||||
Operator = false,
|
||||
Accepted = false
|
||||
};
|
||||
|
||||
context.Players.Add(owner);
|
||||
await context.SaveChangesAsync();
|
||||
|
||||
var primarySlot = new Slot
|
||||
{
|
||||
SlotId = 1
|
||||
};
|
||||
|
||||
context.Slots.Add(primarySlot);
|
||||
await context.SaveChangesAsync();
|
||||
|
||||
var primarySlotOptions = new SlotOptions
|
||||
{
|
||||
SlotId = primarySlot.Id,
|
||||
SpawnProtection = 16,
|
||||
Difficulty = SlotOptionsDifficulty.Normal,
|
||||
GameMode = SlotOptionsGameMode.Survival,
|
||||
Version = playerData.Version
|
||||
};
|
||||
|
||||
context.SlotOptions.Add(primarySlotOptions);
|
||||
await context.SaveChangesAsync();
|
||||
|
||||
var regionSelectionPreference = new RealmRegionSelectionPreference
|
||||
{
|
||||
RegionSelectionPreference = RegionSelectionPreference.AutomaticOwner,
|
||||
PreferredRegion = nameof(Region.WestEurope)
|
||||
};
|
||||
|
||||
var realm = new Realm
|
||||
{
|
||||
Name = "",
|
||||
Description = "",
|
||||
State = nameof(RealmState.UNINITIALIZED),
|
||||
Players = [owner],
|
||||
Slots = [primarySlot],
|
||||
WorldType = nameof(WorldType.NORMAL),
|
||||
ActiveSlotId = primarySlot.Id,
|
||||
RegionSelectionPreference = regionSelectionPreference
|
||||
};
|
||||
|
||||
context.Realms.Add(realm);
|
||||
await context.SaveChangesAsync();
|
||||
|
||||
subscription.RealmId = realm.Id;
|
||||
|
||||
context.Subscriptions.Update(subscription);
|
||||
await context.SaveChangesAsync();
|
||||
|
||||
await transaction.CommitAsync();
|
||||
realms.Add(realm);
|
||||
}
|
||||
|
||||
foreach (var realm in realms)
|
||||
{
|
||||
var server = new Responses.Realm
|
||||
{
|
||||
Id = realm.Id,
|
||||
RemoteSubscriptionId = realm.Subscription.SubscriptionId.Replace("-", ""),
|
||||
Name = realm.Name,
|
||||
Motd = realm.Description,
|
||||
State = realm.State,
|
||||
Owner = realm.Players.First().Name,
|
||||
OwnerUUID = realm.Players.First().Uuid.Replace("-", ""),
|
||||
Expired = realm.Subscription.Ended,
|
||||
ExpiredTrial = false,
|
||||
DaysLeft = realm.Subscription.Ended ? -1 : 0,
|
||||
WorldType = realm.WorldType,
|
||||
IsHardcore = realm.ActiveSlot.Settings.Contains("hardcore"),
|
||||
GameMode = (int)realm.ActiveSlot.Options.GameMode,
|
||||
ActiveSlot = -1,
|
||||
ActiveVersion = realm.ActiveSlot.Options.Version,
|
||||
Compatibility = nameof(RealmCompatibility.UNVERIFIABLE)
|
||||
};
|
||||
|
||||
if (playerData.Uuid == server.OwnerUUID.Replace("-", ""))
|
||||
{
|
||||
server.ExpiredTrial = AppConfig.Trial && realm.Subscription.Ended;
|
||||
server.DaysLeft = realm.Subscription.DaysLeft;
|
||||
server.ActiveSlot = realm.ActiveSlot.SlotId;
|
||||
}
|
||||
|
||||
// TODO: Improve this
|
||||
server.Compatibility = playerData.Version == realm.ActiveSlot.Options.Version
|
||||
? nameof(RealmCompatibility.COMPATIBLE)
|
||||
: nameof(RealmCompatibility.INCOMPATIBLE);
|
||||
|
||||
servers.Servers.Add(server);
|
||||
}
|
||||
|
||||
return Ok(servers);
|
||||
}
|
||||
|
||||
[HttpPost("{realmId:int}/initialize")]
|
||||
[HasRealmAccess(true)]
|
||||
public async Task<ActionResult<Realm>> PostInitialize(int realmId, RealmInitialize body)
|
||||
{
|
||||
var realm = await context.Realms.Include(realm => realm.Subscription).FirstAsync(realm => realm.Id == realmId);
|
||||
|
||||
if (realm.State != nameof(RealmState.UNINITIALIZED)) return StatusCode(409, ApiError.WorldAlreadyInitialized);
|
||||
|
||||
realm.Name = body.Name;
|
||||
|
||||
if (body.Description != null && body.Description.Trim() != string.Empty)
|
||||
realm.Description = body.Description;
|
||||
|
||||
realm.Subscription.StartDate = DateTime.UtcNow;
|
||||
|
||||
realm.State = nameof(RealmState.OPEN);
|
||||
|
||||
await context.SaveChangesAsync();
|
||||
return Ok();
|
||||
}
|
||||
|
||||
[HttpGet("{realmId:int}")]
|
||||
[HasRealmAccess(true)]
|
||||
public async Task<ActionResult<Realm>> GetOwnRealm(int realmId)
|
||||
{
|
||||
var realm = await context.Realms.Include(realm => realm.Players).Include(realm => realm.Subscription)
|
||||
.Include(realm => realm.RegionSelectionPreference).Include(realm => realm.Slots)
|
||||
.ThenInclude(slot => slot.Options).Include(realm => realm.ActiveSlot).ThenInclude(slot => slot.Options)
|
||||
.FirstAsync(realm => realm.Id == realmId);
|
||||
|
||||
var realmResponse = new Responses.Realm
|
||||
{
|
||||
Id = realm.Id,
|
||||
RemoteSubscriptionId = realm.Subscription.SubscriptionId.Replace("-", ""),
|
||||
Name = realm.Name,
|
||||
Motd = realm.Description,
|
||||
State = realm.State,
|
||||
Owner = realm.Players.First().Name,
|
||||
OwnerUUID = realm.Players.First().Uuid.Replace("-", ""),
|
||||
Players = realm.Players.FindAll(player => player.Uuid != realm.Players.First().Uuid)
|
||||
.SelectMany<Player, Responses.Player>(player =>
|
||||
[
|
||||
new Responses.Player
|
||||
{
|
||||
Uuid = player.Uuid.Replace("-", ""),
|
||||
Name = player.Name,
|
||||
Operator = player.Operator,
|
||||
Accepted = player.Accepted
|
||||
}
|
||||
]),
|
||||
Slots = realm.Slots.SelectMany<Slot, Responses.Slot>(slot =>
|
||||
[
|
||||
new Responses.Slot
|
||||
{
|
||||
SlotId = slot.SlotId,
|
||||
Options = JsonSerializer.Serialize(new Responses.SlotOptions
|
||||
{
|
||||
SpawnProtection = slot.Options.SpawnProtection,
|
||||
ForceGeeMode = slot.Options.ForceGameMode,
|
||||
Difficulty = (int)slot.Options.Difficulty,
|
||||
GameMode = (int)slot.Options.GameMode,
|
||||
SlotName = slot.Options.SlotName,
|
||||
Version = slot.Options.Version,
|
||||
Compatibility = playerData.Version == slot.Options.Version
|
||||
? nameof(RealmCompatibility.COMPATIBLE)
|
||||
: nameof(RealmCompatibility.INCOMPATIBLE)
|
||||
}),
|
||||
Settings = slot.Settings
|
||||
}
|
||||
]),
|
||||
Expired = realm.Subscription.Ended,
|
||||
ExpiredTrial = AppConfig.Trial && realm.Subscription.Ended,
|
||||
DaysLeft = realm.Subscription.DaysLeft,
|
||||
WorldType = realm.WorldType,
|
||||
IsHardcore = realm.ActiveSlot.Settings.Contains("hardcore"),
|
||||
GameMode = (int)realm.ActiveSlot.Options.GameMode,
|
||||
ActiveSlot = realm.ActiveSlot.SlotId,
|
||||
ActiveVersion = realm.ActiveSlot.Options.Version,
|
||||
Compatibility = nameof(RealmCompatibility.UNVERIFIABLE),
|
||||
RegionSelectionPreference = new Models.RealmRegionSelectionPreference
|
||||
{
|
||||
RegionSelectionPreference = realm.RegionSelectionPreference.RegionSelectionPreference,
|
||||
PreferredRegion = realm.RegionSelectionPreference.PreferredRegion
|
||||
}
|
||||
};
|
||||
|
||||
// TODO: Improve this
|
||||
realmResponse.Compatibility = playerData.Version == realm.ActiveSlot.Options.Version
|
||||
? nameof(RealmCompatibility.COMPATIBLE)
|
||||
: nameof(RealmCompatibility.INCOMPATIBLE);
|
||||
|
||||
return Ok(realmResponse);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.9"/>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="10.0.9">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.0.2"/>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,45 @@
|
||||
using Core.Entities;
|
||||
using Core.Enums;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Core.Data;
|
||||
|
||||
public class DataContext(DbContextOptions<DataContext> options) : DbContext(options)
|
||||
{
|
||||
public DbSet<AppConfig> AppConfig { get; set; }
|
||||
public DbSet<Player> Players { get; set; }
|
||||
public DbSet<Realm> Realms { get; set; }
|
||||
public DbSet<Slot> Slots { get; set; }
|
||||
public DbSet<SlotOptions> SlotOptions { get; set; }
|
||||
public DbSet<Subscription> Subscriptions { get; set; }
|
||||
public DbSet<RealmRegionSelectionPreference> RegionSelectionPreferences { get; set; }
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Entity<Realm>().HasOne(realm => realm.Subscription).WithOne(subscription => subscription.Realm)
|
||||
.HasForeignKey<Subscription>(subscription => subscription.RealmId).OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
modelBuilder.Entity<Player>().HasOne(player => player.Realm).WithMany(realm => realm.Players)
|
||||
.HasForeignKey(player => player.RealmId).OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
modelBuilder.Entity<Slot>().HasOne(slot => slot.Realm).WithMany(realm => realm.Slots)
|
||||
.HasForeignKey(slot => slot.RealmId).OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
modelBuilder.Entity<Realm>().HasOne(realm => realm.ActiveSlot).WithOne()
|
||||
.HasForeignKey<Realm>(realm => realm.ActiveSlotId).OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
modelBuilder.Entity<Slot>().HasOne(slot => slot.Options).WithOne(options => options.Slot)
|
||||
.HasForeignKey<SlotOptions>(options => options.SlotId).OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
modelBuilder.Entity<Slot>().Property(slot => slot.Settings).HasDefaultValueSql("'{}'");
|
||||
|
||||
modelBuilder.Entity<Realm>().HasOne(realm => realm.RegionSelectionPreference)
|
||||
.WithOne(regionSelectionPreference => regionSelectionPreference.Realm).OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
modelBuilder.Entity<RealmRegionSelectionPreference>()
|
||||
.Property(preference => preference.RegionSelectionPreference)
|
||||
.HasDefaultValue(RegionSelectionPreference.AutomaticOwner);
|
||||
|
||||
modelBuilder.Entity<SlotOptions>().Property(options => options.SlotName).HasDefaultValueSql("''");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Core.Entities;
|
||||
|
||||
[PrimaryKey("Key")]
|
||||
public class AppConfig
|
||||
{
|
||||
public required string Key { get; set; }
|
||||
|
||||
[Column(TypeName = "jsonb")] public required dynamic Value { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Core.Entities;
|
||||
|
||||
public class Player
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public required string Uuid { get; set; }
|
||||
public required string Name { get; set; }
|
||||
public required bool Operator { get; set; }
|
||||
public required bool Accepted { get; set; }
|
||||
[JsonIgnore] public int? RealmId { get; set; }
|
||||
[JsonIgnore] public Realm Realm { get; set; } = null!;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Core.Entities;
|
||||
|
||||
public class Realm
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[JsonIgnore] public Subscription Subscription { get; set; } = null!;
|
||||
public required string Name { get; set; }
|
||||
public required string Description { get; set; }
|
||||
public required string State { get; set; }
|
||||
public required List<Player> Players { get; set; }
|
||||
public required List<Slot> Slots { get; set; }
|
||||
public required string WorldType { get; set; }
|
||||
[JsonIgnore] public required int ActiveSlotId { get; set; }
|
||||
[JsonIgnore] public Slot ActiveSlot { get; set; } = null!;
|
||||
[JsonIgnore] public Realm? ParentWorld { get; set; }
|
||||
[JsonIgnore] public required RealmRegionSelectionPreference RegionSelectionPreference { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using Core.Enums;
|
||||
|
||||
namespace Core.Entities;
|
||||
|
||||
public class RealmRegionSelectionPreference
|
||||
{
|
||||
[JsonIgnore] public int Id { get; set; }
|
||||
[JsonIgnore] public int RealmId { get; set; }
|
||||
[JsonIgnore] public Realm Realm { get; set; } = null!;
|
||||
public required RegionSelectionPreference RegionSelectionPreference { get; set; }
|
||||
public required string PreferredRegion { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Core.Entities;
|
||||
|
||||
public class Slot
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public required int SlotId { get; set; }
|
||||
public SlotOptions Options { get; set; } = null!;
|
||||
public List<string> Settings { get; set; } = [];
|
||||
[JsonIgnore] public int? RealmId { get; set; }
|
||||
[JsonIgnore] public Realm Realm { get; set; } = null!;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using Core.Enums;
|
||||
|
||||
namespace Core.Entities;
|
||||
|
||||
public class SlotOptions
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int SpawnProtection { get; set; }
|
||||
public bool ForceGameMode { get; set; }
|
||||
public SlotOptionsDifficulty Difficulty { get; set; }
|
||||
public SlotOptionsGameMode GameMode { get; set; }
|
||||
public string SlotName { get; set; } = null!;
|
||||
public required string Version { get; set; }
|
||||
[JsonIgnore] public int SlotId { get; set; }
|
||||
[JsonIgnore] public Slot Slot { get; set; } = null!;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Core.Entities;
|
||||
|
||||
public class Subscription
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public required string SubscriptionId { get; set; }
|
||||
public required DateTime StartDate { get; set; }
|
||||
public required string Type { get; set; }
|
||||
[JsonIgnore] public int? RealmId { get; set; }
|
||||
|
||||
[JsonIgnore] public Realm Realm { get; set; } = null!;
|
||||
|
||||
// Helper fields
|
||||
public int DaysLeft => (StartDate.AddDays(30) - DateTime.Today).Days;
|
||||
public bool Ended => DaysLeft < 0;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Core.Enums;
|
||||
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum CompatibleVersionResponse
|
||||
{
|
||||
COMPATIBLE,
|
||||
OUTDATED,
|
||||
OTHER
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Core.Enums;
|
||||
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum RealmCompatibility
|
||||
{
|
||||
UNVERIFIABLE,
|
||||
INCOMPATIBLE,
|
||||
RELEASE_TYPE_INCOMPATIBLE,
|
||||
NEEDS_DOWNGRADE,
|
||||
NEEDS_UPGRADE,
|
||||
COMPATIBLE
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Core.Enums;
|
||||
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum RealmState
|
||||
{
|
||||
OPEN,
|
||||
CLOSED,
|
||||
UNINITIALIZED
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Core.Enums;
|
||||
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum Region
|
||||
{
|
||||
AustraliaEast,
|
||||
AustraliaSoutheast,
|
||||
BrazilSouth,
|
||||
CentralIndia,
|
||||
CentralUs,
|
||||
EastAsia,
|
||||
EastUs,
|
||||
EastUs2,
|
||||
FranceCentral,
|
||||
JapanEast,
|
||||
JapanWest,
|
||||
KoreaCentral,
|
||||
NorthCentralUs,
|
||||
NorthEurope,
|
||||
SouthCentralUs,
|
||||
SoutheastAsia,
|
||||
SwedenCentral,
|
||||
UAENorth,
|
||||
UKSouth,
|
||||
WestCentralUs,
|
||||
WestEurope,
|
||||
WestUs,
|
||||
WestUs2
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace Core.Enums;
|
||||
|
||||
public enum RegionSelectionPreference
|
||||
{
|
||||
AutomaticOwner,
|
||||
AutomaticPlayer,
|
||||
Manual
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace Core.Enums;
|
||||
|
||||
public enum ServiceQuality
|
||||
{
|
||||
Great = 1,
|
||||
Good,
|
||||
Okay,
|
||||
Poor
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace Core.Enums;
|
||||
|
||||
public enum SlotOptionsDifficulty
|
||||
{
|
||||
Peaceful,
|
||||
Easy,
|
||||
Normal,
|
||||
Hard
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace Core.Enums;
|
||||
|
||||
public enum SlotOptionsGameMode
|
||||
{
|
||||
Survival,
|
||||
Creative,
|
||||
Adventure
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Core.Enums;
|
||||
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum SubscriptionType
|
||||
{
|
||||
NORMAL,
|
||||
RECURRING
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Core.Enums;
|
||||
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum WorldType
|
||||
{
|
||||
NORMAL,
|
||||
MINIGAME,
|
||||
ADVENTUREMAP,
|
||||
EXPERIENCE,
|
||||
INSPIRATION,
|
||||
UNKNOWN
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
using System.Text.Json;
|
||||
using Core.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Core.Helpers;
|
||||
|
||||
public class AppConfig
|
||||
{
|
||||
private static readonly AppConfig AppConfigTyped = new();
|
||||
|
||||
public static void InitializeAppConfig(IServiceProvider serviceProvider)
|
||||
{
|
||||
using var scope = serviceProvider.CreateScope();
|
||||
var db = scope.ServiceProvider.GetRequiredService<DataContext>();
|
||||
|
||||
db.Database.Migrate();
|
||||
|
||||
var appConfigModel = new Models.AppConfig();
|
||||
var properties = appConfigModel.GetType().GetProperties();
|
||||
|
||||
var defaultConfig = properties.Select(property => new Entities.AppConfig
|
||||
{
|
||||
Key = property.Name,
|
||||
Value = JsonSerializer.Serialize(property.GetValue(appConfigModel))
|
||||
});
|
||||
|
||||
foreach (var config in defaultConfig)
|
||||
db.Database.ExecuteSqlInterpolated(
|
||||
$"""INSERT INTO "AppConfig" ("Key", "Value") VALUES ({config.Key}, {config.Value}::jsonb) ON CONFLICT ("Key") DO NOTHING""");
|
||||
|
||||
var dbConfigs = db.AppConfig.ToDictionary(p => p.Key, p => p.Value);
|
||||
|
||||
foreach (var property in properties)
|
||||
if (dbConfigs.TryGetValue(property.Name, out var dbJsonValue) && dbJsonValue != null)
|
||||
{
|
||||
var deserializedValue = JsonSerializer.Deserialize(dbJsonValue, property.PropertyType);
|
||||
property.SetValue(AppConfigTyped, deserializedValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using Core.Models;
|
||||
|
||||
namespace Core.Middlewares;
|
||||
|
||||
public class AuthorizationMiddleware(RequestDelegate next)
|
||||
{
|
||||
public Task Invoke(HttpContext httpContext, CookiePlayerData playerData)
|
||||
{
|
||||
var cookieHeader = httpContext.Request.Headers.Cookie.ToString();
|
||||
|
||||
if (cookieHeader.Trim() == "")
|
||||
{
|
||||
httpContext.Response.StatusCode = 401;
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
var hasSid = httpContext.Request.Cookies.ContainsKey("sid");
|
||||
var hasUser = httpContext.Request.Cookies.ContainsKey("user");
|
||||
var hasVersion = httpContext.Request.Cookies.ContainsKey("version");
|
||||
|
||||
if (!(hasSid && hasUser && hasVersion))
|
||||
{
|
||||
httpContext.Response.StatusCode = 401;
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
playerData.Uuid = httpContext.Request.Cookies["sid"]!.Split(":")[2];
|
||||
playerData.Name = httpContext.Request.Cookies["user"]!;
|
||||
playerData.Version = httpContext.Request.Cookies["version"]!;
|
||||
|
||||
return next(httpContext);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
using Core.Attributes;
|
||||
using Core.Data;
|
||||
using Core.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Core.Middlewares;
|
||||
|
||||
public class CheckRealmAccessMiddleware(RequestDelegate next)
|
||||
{
|
||||
public async Task InvokeAsync(HttpContext httpContext, DataContext db, CookiePlayerData playerData)
|
||||
{
|
||||
var attribute = httpContext.GetEndpoint()?.Metadata.GetMetadata<HasRealmAccessAttribute>();
|
||||
|
||||
var realmIdValue = httpContext.GetRouteData().Values["realmId"];
|
||||
|
||||
if (attribute == null || realmIdValue == null)
|
||||
{
|
||||
await next(httpContext);
|
||||
return;
|
||||
}
|
||||
|
||||
var realmId = int.Parse(realmIdValue.ToString()!);
|
||||
var realm = await db.Realms.Include(realm => realm.Players).FirstOrDefaultAsync(realm => realm.Id == realmId);
|
||||
|
||||
if (realm == null)
|
||||
{
|
||||
httpContext.Response.StatusCode = 404;
|
||||
await httpContext.Response.WriteAsJsonAsync(ApiError.WorldNotFound);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (realm.Players.All(player => player.Uuid != playerData.Uuid))
|
||||
{
|
||||
httpContext.Response.StatusCode = 403;
|
||||
await httpContext.Response.WriteAsJsonAsync(ApiError.NotAWorldMember);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (attribute.IsOwner && realm.Players.First().Uuid.Replace("-", "") != playerData.Uuid)
|
||||
{
|
||||
httpContext.Response.StatusCode = 403;
|
||||
await httpContext.Response.WriteAsJsonAsync(ApiError.NotOwner);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
await next(httpContext);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
// <auto-generated />
|
||||
using Core.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 Core.Migrations
|
||||
{
|
||||
[DbContext(typeof(DataContext))]
|
||||
[Migration("20260613101031_AppConfig_Init")]
|
||||
partial class AppConfig_Init
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "10.0.9")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Core.Entities.AppConfig", b =>
|
||||
{
|
||||
b.Property<string>("Key")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Value")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.HasKey("Key");
|
||||
|
||||
b.ToTable("AppConfig");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
+6
-6
@@ -2,24 +2,24 @@
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Migrations
|
||||
namespace Core.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Configuration : Migration
|
||||
public partial class AppConfig_Init : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Configuration",
|
||||
name: "AppConfig",
|
||||
columns: table => new
|
||||
{
|
||||
Key = table.Column<string>(type: "text", nullable: false),
|
||||
Value = table.Column<string>(type: "text", nullable: false)
|
||||
Value = table.Column<string>(type: "jsonb", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Configuration", x => x.Key);
|
||||
table.PrimaryKey("PK_AppConfig", x => x.Key);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Minecraft_Realms_Emulator.Migrations
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Configuration");
|
||||
name: "AppConfig");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
// <auto-generated />
|
||||
using Core.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 Core.Migrations
|
||||
{
|
||||
[DbContext(typeof(DataContext))]
|
||||
[Migration("20260614142844_Players_Init")]
|
||||
partial class Players_Init
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "10.0.9")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Core.Entities.AppConfig", b =>
|
||||
{
|
||||
b.Property<string>("Key")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<object>("Value")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.HasKey("Key");
|
||||
|
||||
b.ToTable("AppConfig");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Player", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<bool>("Accepted")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("Operator")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Uuid")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Players");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
+9
-7
@@ -3,26 +3,28 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Migrations
|
||||
namespace Core.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class SeenNotifications : Migration
|
||||
public partial class Players_Init : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "SeenNotifications",
|
||||
name: "Players",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
PlayerUUID = table.Column<string>(type: "text", nullable: false),
|
||||
NotificationUUID = table.Column<string>(type: "text", nullable: false)
|
||||
Uuid = table.Column<string>(type: "text", nullable: false),
|
||||
Name = table.Column<string>(type: "text", nullable: false),
|
||||
Operator = table.Column<bool>(type: "boolean", nullable: false),
|
||||
Accepted = table.Column<bool>(type: "boolean", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_SeenNotifications", x => x.Id);
|
||||
table.PrimaryKey("PK_Players", x => x.Id);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -30,7 +32,7 @@ namespace Minecraft_Realms_Emulator.Migrations
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "SeenNotifications");
|
||||
name: "Players");
|
||||
}
|
||||
}
|
||||
}
|
||||
+125
-125
@@ -1,64 +1,44 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using System.Text.Json;
|
||||
using Core.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Migrations
|
||||
namespace Core.Migrations
|
||||
{
|
||||
[DbContext(typeof(DataContext))]
|
||||
[Migration("20240218160304_Connections_Id")]
|
||||
partial class Connections_Id
|
||||
[Migration("20260614143145_Realms_Init")]
|
||||
partial class Realms_Init
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.1")
|
||||
.HasAnnotation("ProductVersion", "10.0.9")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Backup", b =>
|
||||
modelBuilder.Entity("Core.Entities.AppConfig", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("BackupId")
|
||||
.IsRequired()
|
||||
b.Property<string>("Key")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("LastModifiedDate")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<JsonDocument>("Metadata")
|
||||
b.Property<object>("Value")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<int>("Size")
|
||||
.HasColumnType("integer");
|
||||
b.HasKey("Key");
|
||||
|
||||
b.Property<int>("WorldId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WorldId");
|
||||
|
||||
b.ToTable("Backups");
|
||||
b.ToTable("AppConfig");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Connection", b =>
|
||||
modelBuilder.Entity("Core.Entities.Player", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
@@ -66,24 +46,31 @@ namespace Minecraft_Realms_Emulator.Migrations
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Address")
|
||||
b.Property<bool>("Accepted")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("PendingUpdate")
|
||||
b.Property<bool>("Operator")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("WorldId")
|
||||
b.Property<int?>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Uuid")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WorldId");
|
||||
b.HasIndex("RealmId");
|
||||
|
||||
b.ToTable("Connections");
|
||||
b.ToTable("Players");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Subscription", b =>
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
@@ -91,127 +78,140 @@ namespace Minecraft_Realms_Emulator.Migrations
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("StartDate")
|
||||
b.Property<int>("ActiveSlotId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("SubscriptionType")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("WorldId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WorldId");
|
||||
|
||||
b.ToTable("Subscriptions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.World", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ActiveSlot")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("DaysLeft")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("Expired")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("ExpiredTrial")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("MaxPlayers")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("Member")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int?>("MinigameId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("MinigameImage")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("MinigameName")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Motd")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Owner")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("OwnerUUID")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string[]>("Players")
|
||||
.IsRequired()
|
||||
.HasColumnType("text[]");
|
||||
|
||||
b.Property<string>("RemoteSubscriptionId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<JsonDocument[]>("Slots")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb[]");
|
||||
b.Property<int>("OwnerId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("ParentWorldId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("State")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SubscriptionId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("WorldType")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Worlds");
|
||||
b.HasIndex("ActiveSlotId");
|
||||
|
||||
b.HasIndex("OwnerId");
|
||||
|
||||
b.HasIndex("ParentWorldId");
|
||||
|
||||
b.HasIndex("SubscriptionId");
|
||||
|
||||
b.ToTable("Realms");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Backup", b =>
|
||||
modelBuilder.Entity("Core.Entities.Slot", b =>
|
||||
{
|
||||
b.HasOne("Minecraft_Realms_Emulator.Entities.World", "World")
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("SlotId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RealmId");
|
||||
|
||||
b.ToTable("Slot");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Subscription", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("DaysLeft")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("SubscriptionId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Subscription");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Player", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Realm", null)
|
||||
.WithMany("Players")
|
||||
.HasForeignKey("RealmId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Slot", "ActiveSlot")
|
||||
.WithMany()
|
||||
.HasForeignKey("WorldId")
|
||||
.HasForeignKey("ActiveSlotId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("World");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Connection", b =>
|
||||
{
|
||||
b.HasOne("Minecraft_Realms_Emulator.Entities.World", "World")
|
||||
b.HasOne("Core.Entities.Player", "Owner")
|
||||
.WithMany()
|
||||
.HasForeignKey("WorldId")
|
||||
.HasForeignKey("OwnerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("World");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Subscription", b =>
|
||||
{
|
||||
b.HasOne("Minecraft_Realms_Emulator.Entities.World", "World")
|
||||
b.HasOne("Core.Entities.Realm", "ParentWorld")
|
||||
.WithMany()
|
||||
.HasForeignKey("WorldId")
|
||||
.HasForeignKey("ParentWorldId");
|
||||
|
||||
b.HasOne("Core.Entities.Subscription", "Subscription")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubscriptionId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("World");
|
||||
b.Navigation("ActiveSlot");
|
||||
|
||||
b.Navigation("Owner");
|
||||
|
||||
b.Navigation("ParentWorld");
|
||||
|
||||
b.Navigation("Subscription");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Slot", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Realm", null)
|
||||
.WithMany("Slots")
|
||||
.HasForeignKey("RealmId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.Navigation("Players");
|
||||
|
||||
b.Navigation("Slots");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Core.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Realms_Init : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "RealmId",
|
||||
table: "Players",
|
||||
type: "integer",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Subscription",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
SubscriptionId = table.Column<string>(type: "text", nullable: false),
|
||||
DaysLeft = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Subscription", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Realms",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
SubscriptionId = table.Column<int>(type: "integer", nullable: false),
|
||||
Name = table.Column<string>(type: "text", nullable: false),
|
||||
Description = table.Column<string>(type: "text", nullable: false),
|
||||
State = table.Column<string>(type: "text", nullable: false),
|
||||
OwnerId = table.Column<int>(type: "integer", nullable: false),
|
||||
WorldType = table.Column<string>(type: "text", nullable: false),
|
||||
ActiveSlotId = table.Column<int>(type: "integer", nullable: false),
|
||||
ParentWorldId = table.Column<int>(type: "integer", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Realms", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Realms_Players_OwnerId",
|
||||
column: x => x.OwnerId,
|
||||
principalTable: "Players",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_Realms_Realms_ParentWorldId",
|
||||
column: x => x.ParentWorldId,
|
||||
principalTable: "Realms",
|
||||
principalColumn: "Id");
|
||||
table.ForeignKey(
|
||||
name: "FK_Realms_Subscription_SubscriptionId",
|
||||
column: x => x.SubscriptionId,
|
||||
principalTable: "Subscription",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Slot",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
SlotId = table.Column<int>(type: "integer", nullable: false),
|
||||
RealmId = table.Column<int>(type: "integer", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Slot", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Slot_Realms_RealmId",
|
||||
column: x => x.RealmId,
|
||||
principalTable: "Realms",
|
||||
principalColumn: "Id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Players_RealmId",
|
||||
table: "Players",
|
||||
column: "RealmId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Realms_ActiveSlotId",
|
||||
table: "Realms",
|
||||
column: "ActiveSlotId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Realms_OwnerId",
|
||||
table: "Realms",
|
||||
column: "OwnerId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Realms_ParentWorldId",
|
||||
table: "Realms",
|
||||
column: "ParentWorldId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Realms_SubscriptionId",
|
||||
table: "Realms",
|
||||
column: "SubscriptionId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Slot_RealmId",
|
||||
table: "Slot",
|
||||
column: "RealmId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Players_Realms_RealmId",
|
||||
table: "Players",
|
||||
column: "RealmId",
|
||||
principalTable: "Realms",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Realms_Slot_ActiveSlotId",
|
||||
table: "Realms",
|
||||
column: "ActiveSlotId",
|
||||
principalTable: "Slot",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Players_Realms_RealmId",
|
||||
table: "Players");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Realms_Slot_ActiveSlotId",
|
||||
table: "Realms");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Slot");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Realms");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Subscription");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Players_RealmId",
|
||||
table: "Players");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "RealmId",
|
||||
table: "Players");
|
||||
}
|
||||
}
|
||||
}
|
||||
+294
@@ -0,0 +1,294 @@
|
||||
// <auto-generated />
|
||||
using Core.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 Core.Migrations
|
||||
{
|
||||
[DbContext(typeof(DataContext))]
|
||||
[Migration("20260614143809_Slots_Init")]
|
||||
partial class Slots_Init
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "10.0.9")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Core.Entities.AppConfig", b =>
|
||||
{
|
||||
b.Property<string>("Key")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<object>("Value")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.HasKey("Key");
|
||||
|
||||
b.ToTable("AppConfig");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Player", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<bool>("Accepted")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("Operator")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int?>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Uuid")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RealmId");
|
||||
|
||||
b.ToTable("Players");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ActiveSlotId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("OwnerId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("ParentWorldId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("State")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SubscriptionId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("WorldType")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ActiveSlotId");
|
||||
|
||||
b.HasIndex("OwnerId");
|
||||
|
||||
b.HasIndex("ParentWorldId");
|
||||
|
||||
b.HasIndex("SubscriptionId");
|
||||
|
||||
b.ToTable("Realms");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Slot", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("OptionsId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("SettingsId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("SlotId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OptionsId");
|
||||
|
||||
b.HasIndex("RealmId");
|
||||
|
||||
b.HasIndex("SettingsId");
|
||||
|
||||
b.ToTable("Slots");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.SlotOptions", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Difficulty")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("ForceGamemode")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("Gamemode")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("SlotName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SpawnProtection")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Version")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("SlotOptions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Subscription", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("DaysLeft")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("SubscriptionId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Subscription");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.WorldSettings", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<bool>("Hardcore")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("WorldSettings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Player", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Realm", null)
|
||||
.WithMany("Players")
|
||||
.HasForeignKey("RealmId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Slot", "ActiveSlot")
|
||||
.WithMany()
|
||||
.HasForeignKey("ActiveSlotId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Core.Entities.Player", "Owner")
|
||||
.WithMany()
|
||||
.HasForeignKey("OwnerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Core.Entities.Realm", "ParentWorld")
|
||||
.WithMany()
|
||||
.HasForeignKey("ParentWorldId");
|
||||
|
||||
b.HasOne("Core.Entities.Subscription", "Subscription")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubscriptionId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("ActiveSlot");
|
||||
|
||||
b.Navigation("Owner");
|
||||
|
||||
b.Navigation("ParentWorld");
|
||||
|
||||
b.Navigation("Subscription");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Slot", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.SlotOptions", "Options")
|
||||
.WithMany()
|
||||
.HasForeignKey("OptionsId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Core.Entities.Realm", null)
|
||||
.WithMany("Slots")
|
||||
.HasForeignKey("RealmId");
|
||||
|
||||
b.HasOne("Core.Entities.WorldSettings", "Settings")
|
||||
.WithMany()
|
||||
.HasForeignKey("SettingsId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Options");
|
||||
|
||||
b.Navigation("Settings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.Navigation("Players");
|
||||
|
||||
b.Navigation("Slots");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,202 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Core.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Slots_Init : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Realms_Slot_ActiveSlotId",
|
||||
table: "Realms");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Slot_Realms_RealmId",
|
||||
table: "Slot");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_Slot",
|
||||
table: "Slot");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
name: "Slot",
|
||||
newName: "Slots");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_Slot_RealmId",
|
||||
table: "Slots",
|
||||
newName: "IX_Slots_RealmId");
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "OptionsId",
|
||||
table: "Slots",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "SettingsId",
|
||||
table: "Slots",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_Slots",
|
||||
table: "Slots",
|
||||
column: "Id");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "SlotOptions",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
SpawnProtection = table.Column<int>(type: "integer", nullable: false),
|
||||
ForceGamemode = table.Column<bool>(type: "boolean", nullable: false),
|
||||
Difficulty = table.Column<int>(type: "integer", nullable: false),
|
||||
Gamemode = table.Column<int>(type: "integer", nullable: false),
|
||||
SlotName = table.Column<string>(type: "text", nullable: false),
|
||||
Version = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_SlotOptions", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "WorldSettings",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Hardcore = table.Column<bool>(type: "boolean", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_WorldSettings", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Slots_OptionsId",
|
||||
table: "Slots",
|
||||
column: "OptionsId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Slots_SettingsId",
|
||||
table: "Slots",
|
||||
column: "SettingsId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Realms_Slots_ActiveSlotId",
|
||||
table: "Realms",
|
||||
column: "ActiveSlotId",
|
||||
principalTable: "Slots",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Slots_Realms_RealmId",
|
||||
table: "Slots",
|
||||
column: "RealmId",
|
||||
principalTable: "Realms",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Slots_SlotOptions_OptionsId",
|
||||
table: "Slots",
|
||||
column: "OptionsId",
|
||||
principalTable: "SlotOptions",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Slots_WorldSettings_SettingsId",
|
||||
table: "Slots",
|
||||
column: "SettingsId",
|
||||
principalTable: "WorldSettings",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Realms_Slots_ActiveSlotId",
|
||||
table: "Realms");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Slots_Realms_RealmId",
|
||||
table: "Slots");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Slots_SlotOptions_OptionsId",
|
||||
table: "Slots");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Slots_WorldSettings_SettingsId",
|
||||
table: "Slots");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "SlotOptions");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "WorldSettings");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_Slots",
|
||||
table: "Slots");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Slots_OptionsId",
|
||||
table: "Slots");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Slots_SettingsId",
|
||||
table: "Slots");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "OptionsId",
|
||||
table: "Slots");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "SettingsId",
|
||||
table: "Slots");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
name: "Slots",
|
||||
newName: "Slot");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_Slots_RealmId",
|
||||
table: "Slot",
|
||||
newName: "IX_Slot_RealmId");
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_Slot",
|
||||
table: "Slot",
|
||||
column: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Realms_Slot_ActiveSlotId",
|
||||
table: "Realms",
|
||||
column: "ActiveSlotId",
|
||||
principalTable: "Slot",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Slot_Realms_RealmId",
|
||||
table: "Slot",
|
||||
column: "RealmId",
|
||||
principalTable: "Realms",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,294 @@
|
||||
// <auto-generated />
|
||||
using Core.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 Core.Migrations
|
||||
{
|
||||
[DbContext(typeof(DataContext))]
|
||||
[Migration("20260614143845_SlotOptions_Init")]
|
||||
partial class SlotOptions_Init
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "10.0.9")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Core.Entities.AppConfig", b =>
|
||||
{
|
||||
b.Property<string>("Key")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<object>("Value")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.HasKey("Key");
|
||||
|
||||
b.ToTable("AppConfig");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Player", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<bool>("Accepted")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("Operator")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int?>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Uuid")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RealmId");
|
||||
|
||||
b.ToTable("Players");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ActiveSlotId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("OwnerId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("ParentWorldId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("State")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SubscriptionId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("WorldType")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ActiveSlotId");
|
||||
|
||||
b.HasIndex("OwnerId");
|
||||
|
||||
b.HasIndex("ParentWorldId");
|
||||
|
||||
b.HasIndex("SubscriptionId");
|
||||
|
||||
b.ToTable("Realms");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Slot", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("OptionsId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("SettingsId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("SlotId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OptionsId");
|
||||
|
||||
b.HasIndex("RealmId");
|
||||
|
||||
b.HasIndex("SettingsId");
|
||||
|
||||
b.ToTable("Slots");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.SlotOptions", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Difficulty")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("ForceGamemode")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("Gamemode")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("SlotName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SpawnProtection")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Version")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("SlotOptions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Subscription", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("DaysLeft")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("SubscriptionId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Subscription");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.WorldSettings", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<bool>("Hardcore")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("WorldSettings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Player", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Realm", null)
|
||||
.WithMany("Players")
|
||||
.HasForeignKey("RealmId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Slot", "ActiveSlot")
|
||||
.WithMany()
|
||||
.HasForeignKey("ActiveSlotId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Core.Entities.Player", "Owner")
|
||||
.WithMany()
|
||||
.HasForeignKey("OwnerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Core.Entities.Realm", "ParentWorld")
|
||||
.WithMany()
|
||||
.HasForeignKey("ParentWorldId");
|
||||
|
||||
b.HasOne("Core.Entities.Subscription", "Subscription")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubscriptionId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("ActiveSlot");
|
||||
|
||||
b.Navigation("Owner");
|
||||
|
||||
b.Navigation("ParentWorld");
|
||||
|
||||
b.Navigation("Subscription");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Slot", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.SlotOptions", "Options")
|
||||
.WithMany()
|
||||
.HasForeignKey("OptionsId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Core.Entities.Realm", null)
|
||||
.WithMany("Slots")
|
||||
.HasForeignKey("RealmId");
|
||||
|
||||
b.HasOne("Core.Entities.WorldSettings", "Settings")
|
||||
.WithMany()
|
||||
.HasForeignKey("SettingsId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Options");
|
||||
|
||||
b.Navigation("Settings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.Navigation("Players");
|
||||
|
||||
b.Navigation("Slots");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Core.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class SlotOptions_Init : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
+179
-195
@@ -1,118 +1,44 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using System.Text.Json;
|
||||
using Core.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Migrations
|
||||
namespace Core.Migrations
|
||||
{
|
||||
[DbContext(typeof(DataContext))]
|
||||
[Migration("20240221131108_Players")]
|
||||
partial class Players
|
||||
[Migration("20260614143913_Subscriptions_Init")]
|
||||
partial class Subscriptions_Init
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.1")
|
||||
.HasAnnotation("ProductVersion", "10.0.9")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Backup", b =>
|
||||
modelBuilder.Entity("Core.Entities.AppConfig", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("BackupId")
|
||||
.IsRequired()
|
||||
b.Property<string>("Key")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("LastModifiedDate")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<JsonDocument>("Metadata")
|
||||
b.Property<object>("Value")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<int>("Size")
|
||||
.HasColumnType("integer");
|
||||
b.HasKey("Key");
|
||||
|
||||
b.Property<int>("WorldId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WorldId");
|
||||
|
||||
b.ToTable("Backups");
|
||||
b.ToTable("AppConfig");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Connection", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Address")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("PendingUpdate")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("WorldId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WorldId");
|
||||
|
||||
b.ToTable("Connections");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Invite", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("InvitationId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("RecipeintUUID")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("WorldId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WorldId");
|
||||
|
||||
b.ToTable("Invites");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Player", b =>
|
||||
modelBuilder.Entity("Core.Entities.Player", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
@@ -127,31 +53,24 @@ namespace Minecraft_Realms_Emulator.Migrations
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("Online")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("Operator")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Permission")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
b.Property<int?>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Uuid")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("WorldId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WorldId");
|
||||
b.HasIndex("RealmId");
|
||||
|
||||
b.ToTable("Players");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Subscription", b =>
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
@@ -159,150 +78,215 @@ namespace Minecraft_Realms_Emulator.Migrations
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("StartDate")
|
||||
b.Property<int>("ActiveSlotId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("SubscriptionType")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("WorldId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WorldId");
|
||||
|
||||
b.ToTable("Subscriptions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.World", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ActiveSlot")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("DaysLeft")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("Expired")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("ExpiredTrial")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("MaxPlayers")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("Member")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int?>("MinigameId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("MinigameImage")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("MinigameName")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Motd")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Owner")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("OwnerUUID")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("RemoteSubscriptionId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<JsonDocument[]>("Slots")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb[]");
|
||||
b.Property<int>("OwnerId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("ParentWorldId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("State")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SubscriptionId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("WorldType")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Worlds");
|
||||
b.HasIndex("ActiveSlotId");
|
||||
|
||||
b.HasIndex("OwnerId");
|
||||
|
||||
b.HasIndex("ParentWorldId");
|
||||
|
||||
b.HasIndex("SubscriptionId");
|
||||
|
||||
b.ToTable("Realms");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Backup", b =>
|
||||
modelBuilder.Entity("Core.Entities.Slot", b =>
|
||||
{
|
||||
b.HasOne("Minecraft_Realms_Emulator.Entities.World", "World")
|
||||
.WithMany()
|
||||
.HasForeignKey("WorldId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Navigation("World");
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("OptionsId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("SettingsId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("SlotId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OptionsId");
|
||||
|
||||
b.HasIndex("RealmId");
|
||||
|
||||
b.HasIndex("SettingsId");
|
||||
|
||||
b.ToTable("Slots");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Connection", b =>
|
||||
modelBuilder.Entity("Core.Entities.SlotOptions", b =>
|
||||
{
|
||||
b.HasOne("Minecraft_Realms_Emulator.Entities.World", "World")
|
||||
.WithMany()
|
||||
.HasForeignKey("WorldId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Navigation("World");
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Difficulty")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("ForceGamemode")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("Gamemode")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("SlotName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SpawnProtection")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Version")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("SlotOptions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Invite", b =>
|
||||
modelBuilder.Entity("Core.Entities.Subscription", b =>
|
||||
{
|
||||
b.HasOne("Minecraft_Realms_Emulator.Entities.World", "World")
|
||||
.WithMany()
|
||||
.HasForeignKey("WorldId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Navigation("World");
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("DaysLeft")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("SubscriptionId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Subscriptions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Player", b =>
|
||||
modelBuilder.Entity("Core.Entities.WorldSettings", b =>
|
||||
{
|
||||
b.HasOne("Minecraft_Realms_Emulator.Entities.World", "World")
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<bool>("Hardcore")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("WorldSettings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Player", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Realm", null)
|
||||
.WithMany("Players")
|
||||
.HasForeignKey("WorldId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("World");
|
||||
.HasForeignKey("RealmId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Subscription", b =>
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.HasOne("Minecraft_Realms_Emulator.Entities.World", "World")
|
||||
b.HasOne("Core.Entities.Slot", "ActiveSlot")
|
||||
.WithMany()
|
||||
.HasForeignKey("WorldId")
|
||||
.HasForeignKey("ActiveSlotId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("World");
|
||||
b.HasOne("Core.Entities.Player", "Owner")
|
||||
.WithMany()
|
||||
.HasForeignKey("OwnerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Core.Entities.Realm", "ParentWorld")
|
||||
.WithMany()
|
||||
.HasForeignKey("ParentWorldId");
|
||||
|
||||
b.HasOne("Core.Entities.Subscription", "Subscription")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubscriptionId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("ActiveSlot");
|
||||
|
||||
b.Navigation("Owner");
|
||||
|
||||
b.Navigation("ParentWorld");
|
||||
|
||||
b.Navigation("Subscription");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.World", b =>
|
||||
modelBuilder.Entity("Core.Entities.Slot", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.SlotOptions", "Options")
|
||||
.WithMany()
|
||||
.HasForeignKey("OptionsId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Core.Entities.Realm", null)
|
||||
.WithMany("Slots")
|
||||
.HasForeignKey("RealmId");
|
||||
|
||||
b.HasOne("Core.Entities.WorldSettings", "Settings")
|
||||
.WithMany()
|
||||
.HasForeignKey("SettingsId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Options");
|
||||
|
||||
b.Navigation("Settings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.Navigation("Players");
|
||||
|
||||
b.Navigation("Slots");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Core.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Subscriptions_Init : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Realms_Subscription_SubscriptionId",
|
||||
table: "Realms");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_Subscription",
|
||||
table: "Subscription");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
name: "Subscription",
|
||||
newName: "Subscriptions");
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_Subscriptions",
|
||||
table: "Subscriptions",
|
||||
column: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Realms_Subscriptions_SubscriptionId",
|
||||
table: "Realms",
|
||||
column: "SubscriptionId",
|
||||
principalTable: "Subscriptions",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Realms_Subscriptions_SubscriptionId",
|
||||
table: "Realms");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_Subscriptions",
|
||||
table: "Subscriptions");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
name: "Subscriptions",
|
||||
newName: "Subscription");
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_Subscription",
|
||||
table: "Subscription",
|
||||
column: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Realms_Subscription_SubscriptionId",
|
||||
table: "Realms",
|
||||
column: "SubscriptionId",
|
||||
principalTable: "Subscription",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,294 @@
|
||||
// <auto-generated />
|
||||
using Core.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 Core.Migrations
|
||||
{
|
||||
[DbContext(typeof(DataContext))]
|
||||
[Migration("20260614143954_WorldSettings_Init")]
|
||||
partial class WorldSettings_Init
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "10.0.9")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Core.Entities.AppConfig", b =>
|
||||
{
|
||||
b.Property<string>("Key")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<object>("Value")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.HasKey("Key");
|
||||
|
||||
b.ToTable("AppConfig");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Player", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<bool>("Accepted")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("Operator")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int?>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Uuid")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RealmId");
|
||||
|
||||
b.ToTable("Players");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ActiveSlotId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("OwnerId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("ParentWorldId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("State")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SubscriptionId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("WorldType")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ActiveSlotId");
|
||||
|
||||
b.HasIndex("OwnerId");
|
||||
|
||||
b.HasIndex("ParentWorldId");
|
||||
|
||||
b.HasIndex("SubscriptionId");
|
||||
|
||||
b.ToTable("Realms");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Slot", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("OptionsId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("SettingsId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("SlotId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OptionsId");
|
||||
|
||||
b.HasIndex("RealmId");
|
||||
|
||||
b.HasIndex("SettingsId");
|
||||
|
||||
b.ToTable("Slots");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.SlotOptions", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Difficulty")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("ForceGamemode")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("Gamemode")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("SlotName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SpawnProtection")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Version")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("SlotOptions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Subscription", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("DaysLeft")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("SubscriptionId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Subscriptions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.WorldSettings", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<bool>("Hardcore")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("WorldSettings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Player", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Realm", null)
|
||||
.WithMany("Players")
|
||||
.HasForeignKey("RealmId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Slot", "ActiveSlot")
|
||||
.WithMany()
|
||||
.HasForeignKey("ActiveSlotId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Core.Entities.Player", "Owner")
|
||||
.WithMany()
|
||||
.HasForeignKey("OwnerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Core.Entities.Realm", "ParentWorld")
|
||||
.WithMany()
|
||||
.HasForeignKey("ParentWorldId");
|
||||
|
||||
b.HasOne("Core.Entities.Subscription", "Subscription")
|
||||
.WithMany()
|
||||
.HasForeignKey("SubscriptionId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("ActiveSlot");
|
||||
|
||||
b.Navigation("Owner");
|
||||
|
||||
b.Navigation("ParentWorld");
|
||||
|
||||
b.Navigation("Subscription");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Slot", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.SlotOptions", "Options")
|
||||
.WithMany()
|
||||
.HasForeignKey("OptionsId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Core.Entities.Realm", null)
|
||||
.WithMany("Slots")
|
||||
.HasForeignKey("RealmId");
|
||||
|
||||
b.HasOne("Core.Entities.WorldSettings", "Settings")
|
||||
.WithMany()
|
||||
.HasForeignKey("SettingsId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Options");
|
||||
|
||||
b.Navigation("Settings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.Navigation("Players");
|
||||
|
||||
b.Navigation("Slots");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Core.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class WorldSettings_Init : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
+188
-198
@@ -1,132 +1,44 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using System.Text.Json;
|
||||
using Core.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Migrations
|
||||
namespace Core.Migrations
|
||||
{
|
||||
[DbContext(typeof(DataContext))]
|
||||
[Migration("20240317120329_Worlds_Subscription_field")]
|
||||
partial class Worlds_Subscription_field
|
||||
[Migration("20260615174236_Realms_Subscription_Relation")]
|
||||
partial class Realms_Subscription_Relation
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.1")
|
||||
.HasAnnotation("ProductVersion", "10.0.9")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Backup", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("BackupId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("LastModifiedDate")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<JsonDocument>("Metadata")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<int>("Size")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("WorldId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WorldId");
|
||||
|
||||
b.ToTable("Backups");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Configuration", b =>
|
||||
modelBuilder.Entity("Core.Entities.AppConfig", b =>
|
||||
{
|
||||
b.Property<string>("Key")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Value")
|
||||
b.Property<object>("Value")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.HasKey("Key");
|
||||
|
||||
b.ToTable("Configuration");
|
||||
b.ToTable("AppConfig");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Connection", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Address")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("PendingUpdate")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("WorldId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WorldId");
|
||||
|
||||
b.ToTable("Connections");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Invite", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("InvitationId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("RecipeintUUID")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("WorldId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WorldId");
|
||||
|
||||
b.ToTable("Invites");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Player", b =>
|
||||
modelBuilder.Entity("Core.Entities.Player", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
@@ -141,31 +53,24 @@ namespace Minecraft_Realms_Emulator.Migrations
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("Online")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("Operator")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Permission")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
b.Property<int?>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Uuid")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("WorldId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WorldId");
|
||||
b.HasIndex("RealmId");
|
||||
|
||||
b.ToTable("Players");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Subscription", b =>
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
@@ -173,139 +78,224 @@ namespace Minecraft_Realms_Emulator.Migrations
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("StartDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
b.Property<int>("ActiveSlotId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("SubscriptionType")
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("WorldId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WorldId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Subscriptions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.World", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ActiveSlot")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("MaxPlayers")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("Member")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int?>("MinigameId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("MinigameImage")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("MinigameName")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Motd")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Owner")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("OwnerUUID")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<JsonDocument[]>("Slots")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb[]");
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("OwnerId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("ParentWorldId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("State")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SubscriptionId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("WorldType")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Worlds");
|
||||
b.HasIndex("ActiveSlotId");
|
||||
|
||||
b.HasIndex("OwnerId");
|
||||
|
||||
b.HasIndex("ParentWorldId");
|
||||
|
||||
b.ToTable("Realms");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Backup", b =>
|
||||
modelBuilder.Entity("Core.Entities.Slot", b =>
|
||||
{
|
||||
b.HasOne("Minecraft_Realms_Emulator.Entities.World", "World")
|
||||
.WithMany()
|
||||
.HasForeignKey("WorldId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Navigation("World");
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("OptionsId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("SettingsId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("SlotId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OptionsId");
|
||||
|
||||
b.HasIndex("RealmId");
|
||||
|
||||
b.HasIndex("SettingsId");
|
||||
|
||||
b.ToTable("Slots");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Connection", b =>
|
||||
modelBuilder.Entity("Core.Entities.SlotOptions", b =>
|
||||
{
|
||||
b.HasOne("Minecraft_Realms_Emulator.Entities.World", "World")
|
||||
.WithMany()
|
||||
.HasForeignKey("WorldId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Navigation("World");
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Difficulty")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("ForceGamemode")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("Gamemode")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("SlotName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SpawnProtection")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Version")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("SlotOptions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Invite", b =>
|
||||
modelBuilder.Entity("Core.Entities.Subscription", b =>
|
||||
{
|
||||
b.HasOne("Minecraft_Realms_Emulator.Entities.World", "World")
|
||||
.WithMany()
|
||||
.HasForeignKey("WorldId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Navigation("World");
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("DaysLeft")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("SubscriptionId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RealmId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Subscriptions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Player", b =>
|
||||
modelBuilder.Entity("Core.Entities.WorldSettings", b =>
|
||||
{
|
||||
b.HasOne("Minecraft_Realms_Emulator.Entities.World", "World")
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<bool>("Hardcore")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("WorldSettings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Player", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Realm", null)
|
||||
.WithMany("Players")
|
||||
.HasForeignKey("WorldId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("World");
|
||||
.HasForeignKey("RealmId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Subscription", b =>
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.HasOne("Minecraft_Realms_Emulator.Entities.World", "World")
|
||||
.WithOne("Subscription")
|
||||
.HasForeignKey("Minecraft_Realms_Emulator.Entities.Subscription", "WorldId")
|
||||
b.HasOne("Core.Entities.Slot", "ActiveSlot")
|
||||
.WithMany()
|
||||
.HasForeignKey("ActiveSlotId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("World");
|
||||
b.HasOne("Core.Entities.Player", "Owner")
|
||||
.WithMany()
|
||||
.HasForeignKey("OwnerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Core.Entities.Realm", "ParentWorld")
|
||||
.WithMany()
|
||||
.HasForeignKey("ParentWorldId");
|
||||
|
||||
b.Navigation("ActiveSlot");
|
||||
|
||||
b.Navigation("Owner");
|
||||
|
||||
b.Navigation("ParentWorld");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.World", b =>
|
||||
modelBuilder.Entity("Core.Entities.Slot", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.SlotOptions", "Options")
|
||||
.WithMany()
|
||||
.HasForeignKey("OptionsId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Core.Entities.Realm", null)
|
||||
.WithMany("Slots")
|
||||
.HasForeignKey("RealmId");
|
||||
|
||||
b.HasOne("Core.Entities.WorldSettings", "Settings")
|
||||
.WithMany()
|
||||
.HasForeignKey("SettingsId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Options");
|
||||
|
||||
b.Navigation("Settings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Subscription", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Realm", "Realm")
|
||||
.WithOne("Subscription")
|
||||
.HasForeignKey("Core.Entities.Subscription", "RealmId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.Navigation("Realm");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.Navigation("Players");
|
||||
|
||||
b.Navigation("Subscription");
|
||||
b.Navigation("Slots");
|
||||
|
||||
b.Navigation("Subscription")
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Core.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Realms_Subscription_Relation : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Realms_Subscriptions_SubscriptionId",
|
||||
table: "Realms");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Realms_SubscriptionId",
|
||||
table: "Realms");
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "RealmId",
|
||||
table: "Subscriptions",
|
||||
type: "integer",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Subscriptions_RealmId",
|
||||
table: "Subscriptions",
|
||||
column: "RealmId",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Subscriptions_Realms_RealmId",
|
||||
table: "Subscriptions",
|
||||
column: "RealmId",
|
||||
principalTable: "Realms",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Subscriptions_Realms_RealmId",
|
||||
table: "Subscriptions");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Subscriptions_RealmId",
|
||||
table: "Subscriptions");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "RealmId",
|
||||
table: "Subscriptions");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Realms_SubscriptionId",
|
||||
table: "Realms",
|
||||
column: "SubscriptionId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Realms_Subscriptions_SubscriptionId",
|
||||
table: "Realms",
|
||||
column: "SubscriptionId",
|
||||
principalTable: "Subscriptions",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,290 @@
|
||||
// <auto-generated />
|
||||
using Core.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 Core.Migrations
|
||||
{
|
||||
[DbContext(typeof(DataContext))]
|
||||
[Migration("20260615182113_Realms_Remove_Owner")]
|
||||
partial class Realms_Remove_Owner
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "10.0.9")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Core.Entities.AppConfig", b =>
|
||||
{
|
||||
b.Property<string>("Key")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<object>("Value")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.HasKey("Key");
|
||||
|
||||
b.ToTable("AppConfig");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Player", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<bool>("Accepted")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("Operator")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int?>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Uuid")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RealmId");
|
||||
|
||||
b.ToTable("Players");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ActiveSlotId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("ParentWorldId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("State")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SubscriptionId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("WorldType")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ActiveSlotId");
|
||||
|
||||
b.HasIndex("ParentWorldId");
|
||||
|
||||
b.ToTable("Realms");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Slot", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("OptionsId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("SettingsId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("SlotId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OptionsId");
|
||||
|
||||
b.HasIndex("RealmId");
|
||||
|
||||
b.HasIndex("SettingsId");
|
||||
|
||||
b.ToTable("Slots");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.SlotOptions", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Difficulty")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("ForceGamemode")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("Gamemode")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("SlotName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SpawnProtection")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Version")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("SlotOptions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Subscription", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("DaysLeft")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("SubscriptionId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RealmId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Subscriptions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.WorldSettings", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<bool>("Hardcore")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("WorldSettings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Player", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Realm", null)
|
||||
.WithMany("Players")
|
||||
.HasForeignKey("RealmId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Slot", "ActiveSlot")
|
||||
.WithMany()
|
||||
.HasForeignKey("ActiveSlotId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Core.Entities.Realm", "ParentWorld")
|
||||
.WithMany()
|
||||
.HasForeignKey("ParentWorldId");
|
||||
|
||||
b.Navigation("ActiveSlot");
|
||||
|
||||
b.Navigation("ParentWorld");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Slot", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.SlotOptions", "Options")
|
||||
.WithMany()
|
||||
.HasForeignKey("OptionsId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Core.Entities.Realm", null)
|
||||
.WithMany("Slots")
|
||||
.HasForeignKey("RealmId");
|
||||
|
||||
b.HasOne("Core.Entities.WorldSettings", "Settings")
|
||||
.WithMany()
|
||||
.HasForeignKey("SettingsId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Options");
|
||||
|
||||
b.Navigation("Settings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Subscription", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Realm", "Realm")
|
||||
.WithOne("Subscription")
|
||||
.HasForeignKey("Core.Entities.Subscription", "RealmId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.Navigation("Realm");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.Navigation("Players");
|
||||
|
||||
b.Navigation("Slots");
|
||||
|
||||
b.Navigation("Subscription")
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Core.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Realms_Remove_Owner : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Realms_Players_OwnerId",
|
||||
table: "Realms");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Realms_OwnerId",
|
||||
table: "Realms");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "OwnerId",
|
||||
table: "Realms");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "OwnerId",
|
||||
table: "Realms",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Realms_OwnerId",
|
||||
table: "Realms",
|
||||
column: "OwnerId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Realms_Players_OwnerId",
|
||||
table: "Realms",
|
||||
column: "OwnerId",
|
||||
principalTable: "Players",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,293 @@
|
||||
// <auto-generated />
|
||||
using Core.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 Core.Migrations
|
||||
{
|
||||
[DbContext(typeof(DataContext))]
|
||||
[Migration("20260615193348_Realms_Players_Relation")]
|
||||
partial class Realms_Players_Relation
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "10.0.9")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Core.Entities.AppConfig", b =>
|
||||
{
|
||||
b.Property<string>("Key")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<object>("Value")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.HasKey("Key");
|
||||
|
||||
b.ToTable("AppConfig");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Player", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<bool>("Accepted")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("Operator")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int?>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Uuid")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RealmId");
|
||||
|
||||
b.ToTable("Players");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ActiveSlotId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("ParentWorldId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("State")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SubscriptionId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("WorldType")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ActiveSlotId");
|
||||
|
||||
b.HasIndex("ParentWorldId");
|
||||
|
||||
b.ToTable("Realms");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Slot", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("OptionsId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("SettingsId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("SlotId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OptionsId");
|
||||
|
||||
b.HasIndex("RealmId");
|
||||
|
||||
b.HasIndex("SettingsId");
|
||||
|
||||
b.ToTable("Slots");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.SlotOptions", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Difficulty")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("ForceGamemode")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("Gamemode")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("SlotName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SpawnProtection")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Version")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("SlotOptions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Subscription", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("DaysLeft")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("SubscriptionId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RealmId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Subscriptions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.WorldSettings", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<bool>("Hardcore")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("WorldSettings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Player", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Realm", "Realm")
|
||||
.WithMany("Players")
|
||||
.HasForeignKey("RealmId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.Navigation("Realm");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Slot", "ActiveSlot")
|
||||
.WithMany()
|
||||
.HasForeignKey("ActiveSlotId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Core.Entities.Realm", "ParentWorld")
|
||||
.WithMany()
|
||||
.HasForeignKey("ParentWorldId");
|
||||
|
||||
b.Navigation("ActiveSlot");
|
||||
|
||||
b.Navigation("ParentWorld");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Slot", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.SlotOptions", "Options")
|
||||
.WithMany()
|
||||
.HasForeignKey("OptionsId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Core.Entities.Realm", null)
|
||||
.WithMany("Slots")
|
||||
.HasForeignKey("RealmId");
|
||||
|
||||
b.HasOne("Core.Entities.WorldSettings", "Settings")
|
||||
.WithMany()
|
||||
.HasForeignKey("SettingsId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Options");
|
||||
|
||||
b.Navigation("Settings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Subscription", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Realm", "Realm")
|
||||
.WithOne("Subscription")
|
||||
.HasForeignKey("Core.Entities.Subscription", "RealmId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.Navigation("Realm");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.Navigation("Players");
|
||||
|
||||
b.Navigation("Slots");
|
||||
|
||||
b.Navigation("Subscription")
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Core.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Realms_Players_Relation : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Players_Realms_RealmId",
|
||||
table: "Players");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Players_Realms_RealmId",
|
||||
table: "Players",
|
||||
column: "RealmId",
|
||||
principalTable: "Realms",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Players_Realms_RealmId",
|
||||
table: "Players");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Players_Realms_RealmId",
|
||||
table: "Players",
|
||||
column: "RealmId",
|
||||
principalTable: "Realms",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,297 @@
|
||||
// <auto-generated />
|
||||
using Core.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 Core.Migrations
|
||||
{
|
||||
[DbContext(typeof(DataContext))]
|
||||
[Migration("20260615194300_Realms_Slots_Relation")]
|
||||
partial class Realms_Slots_Relation
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "10.0.9")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Core.Entities.AppConfig", b =>
|
||||
{
|
||||
b.Property<string>("Key")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<object>("Value")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.HasKey("Key");
|
||||
|
||||
b.ToTable("AppConfig");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Player", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<bool>("Accepted")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("Operator")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int?>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Uuid")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RealmId");
|
||||
|
||||
b.ToTable("Players");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ActiveSlotId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("ParentWorldId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("State")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SubscriptionId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("WorldType")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ActiveSlotId")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("ParentWorldId");
|
||||
|
||||
b.ToTable("Realms");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Slot", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("OptionsId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("SettingsId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("SlotId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OptionsId");
|
||||
|
||||
b.HasIndex("RealmId");
|
||||
|
||||
b.HasIndex("SettingsId");
|
||||
|
||||
b.ToTable("Slots");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.SlotOptions", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Difficulty")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("ForceGamemode")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("Gamemode")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("SlotName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SpawnProtection")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Version")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("SlotOptions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Subscription", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("DaysLeft")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("SubscriptionId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RealmId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Subscriptions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.WorldSettings", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<bool>("Hardcore")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("WorldSettings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Player", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Realm", "Realm")
|
||||
.WithMany("Players")
|
||||
.HasForeignKey("RealmId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.Navigation("Realm");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Slot", "ActiveSlot")
|
||||
.WithOne()
|
||||
.HasForeignKey("Core.Entities.Realm", "ActiveSlotId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Core.Entities.Realm", "ParentWorld")
|
||||
.WithMany()
|
||||
.HasForeignKey("ParentWorldId");
|
||||
|
||||
b.Navigation("ActiveSlot");
|
||||
|
||||
b.Navigation("ParentWorld");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Slot", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.SlotOptions", "Options")
|
||||
.WithMany()
|
||||
.HasForeignKey("OptionsId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Core.Entities.Realm", "Realm")
|
||||
.WithMany("Slots")
|
||||
.HasForeignKey("RealmId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.HasOne("Core.Entities.WorldSettings", "Settings")
|
||||
.WithMany()
|
||||
.HasForeignKey("SettingsId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Options");
|
||||
|
||||
b.Navigation("Realm");
|
||||
|
||||
b.Navigation("Settings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Subscription", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Realm", "Realm")
|
||||
.WithOne("Subscription")
|
||||
.HasForeignKey("Core.Entities.Subscription", "RealmId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.Navigation("Realm");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.Navigation("Players");
|
||||
|
||||
b.Navigation("Slots");
|
||||
|
||||
b.Navigation("Subscription")
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Core.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Realms_Slots_Relation : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Realms_Slots_ActiveSlotId",
|
||||
table: "Realms");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Slots_Realms_RealmId",
|
||||
table: "Slots");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Realms_ActiveSlotId",
|
||||
table: "Realms");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Realms_ActiveSlotId",
|
||||
table: "Realms",
|
||||
column: "ActiveSlotId",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Realms_Slots_ActiveSlotId",
|
||||
table: "Realms",
|
||||
column: "ActiveSlotId",
|
||||
principalTable: "Slots",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Slots_Realms_RealmId",
|
||||
table: "Slots",
|
||||
column: "RealmId",
|
||||
principalTable: "Realms",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Realms_Slots_ActiveSlotId",
|
||||
table: "Realms");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Slots_Realms_RealmId",
|
||||
table: "Slots");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Realms_ActiveSlotId",
|
||||
table: "Realms");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Realms_ActiveSlotId",
|
||||
table: "Realms",
|
||||
column: "ActiveSlotId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Realms_Slots_ActiveSlotId",
|
||||
table: "Realms",
|
||||
column: "ActiveSlotId",
|
||||
principalTable: "Slots",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Slots_Realms_RealmId",
|
||||
table: "Slots",
|
||||
column: "RealmId",
|
||||
principalTable: "Realms",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,314 @@
|
||||
// <auto-generated />
|
||||
using Core.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 Core.Migrations
|
||||
{
|
||||
[DbContext(typeof(DataContext))]
|
||||
[Migration("20260615195901_Slots_Options_Relation")]
|
||||
partial class Slots_Options_Relation
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "10.0.9")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Core.Entities.AppConfig", b =>
|
||||
{
|
||||
b.Property<string>("Key")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<object>("Value")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.HasKey("Key");
|
||||
|
||||
b.ToTable("AppConfig");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Player", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<bool>("Accepted")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("Operator")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int?>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Uuid")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RealmId");
|
||||
|
||||
b.ToTable("Players");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ActiveSlotId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("ParentWorldId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("State")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SubscriptionId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("WorldType")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ActiveSlotId")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("ParentWorldId");
|
||||
|
||||
b.ToTable("Realms");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Slot", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("SlotId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RealmId");
|
||||
|
||||
b.ToTable("Slots");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.SlotOptions", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Difficulty")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("ForceGamemode")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("Gamemode")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("SlotId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("SlotName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SpawnProtection")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Version")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SlotId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("SlotOptions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Subscription", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("DaysLeft")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("SubscriptionId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RealmId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Subscriptions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.WorldSettings", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<bool>("Hardcore")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("SlotId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SlotId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("WorldSettings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Player", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Realm", "Realm")
|
||||
.WithMany("Players")
|
||||
.HasForeignKey("RealmId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.Navigation("Realm");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Slot", "ActiveSlot")
|
||||
.WithOne()
|
||||
.HasForeignKey("Core.Entities.Realm", "ActiveSlotId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Core.Entities.Realm", "ParentWorld")
|
||||
.WithMany()
|
||||
.HasForeignKey("ParentWorldId");
|
||||
|
||||
b.Navigation("ActiveSlot");
|
||||
|
||||
b.Navigation("ParentWorld");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Slot", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Realm", "Realm")
|
||||
.WithMany("Slots")
|
||||
.HasForeignKey("RealmId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.Navigation("Realm");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.SlotOptions", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Slot", "Slot")
|
||||
.WithOne("Options")
|
||||
.HasForeignKey("Core.Entities.SlotOptions", "SlotId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Slot");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Subscription", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Realm", "Realm")
|
||||
.WithOne("Subscription")
|
||||
.HasForeignKey("Core.Entities.Subscription", "RealmId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.Navigation("Realm");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.WorldSettings", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Slot", "Slot")
|
||||
.WithOne("Settings")
|
||||
.HasForeignKey("Core.Entities.WorldSettings", "SlotId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Slot");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.Navigation("Players");
|
||||
|
||||
b.Navigation("Slots");
|
||||
|
||||
b.Navigation("Subscription")
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Slot", b =>
|
||||
{
|
||||
b.Navigation("Options")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Settings")
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Core.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Slots_Options_Relation : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Slots_SlotOptions_OptionsId",
|
||||
table: "Slots");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Slots_WorldSettings_SettingsId",
|
||||
table: "Slots");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Slots_OptionsId",
|
||||
table: "Slots");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Slots_SettingsId",
|
||||
table: "Slots");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "OptionsId",
|
||||
table: "Slots");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "SettingsId",
|
||||
table: "Slots");
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "SlotId",
|
||||
table: "WorldSettings",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "SlotId",
|
||||
table: "SlotOptions",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_WorldSettings_SlotId",
|
||||
table: "WorldSettings",
|
||||
column: "SlotId",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_SlotOptions_SlotId",
|
||||
table: "SlotOptions",
|
||||
column: "SlotId",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_SlotOptions_Slots_SlotId",
|
||||
table: "SlotOptions",
|
||||
column: "SlotId",
|
||||
principalTable: "Slots",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_WorldSettings_Slots_SlotId",
|
||||
table: "WorldSettings",
|
||||
column: "SlotId",
|
||||
principalTable: "Slots",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_SlotOptions_Slots_SlotId",
|
||||
table: "SlotOptions");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_WorldSettings_Slots_SlotId",
|
||||
table: "WorldSettings");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_WorldSettings_SlotId",
|
||||
table: "WorldSettings");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_SlotOptions_SlotId",
|
||||
table: "SlotOptions");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "SlotId",
|
||||
table: "WorldSettings");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "SlotId",
|
||||
table: "SlotOptions");
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "OptionsId",
|
||||
table: "Slots",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "SettingsId",
|
||||
table: "Slots",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Slots_OptionsId",
|
||||
table: "Slots",
|
||||
column: "OptionsId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Slots_SettingsId",
|
||||
table: "Slots",
|
||||
column: "SettingsId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Slots_SlotOptions_OptionsId",
|
||||
table: "Slots",
|
||||
column: "OptionsId",
|
||||
principalTable: "SlotOptions",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Slots_WorldSettings_SettingsId",
|
||||
table: "Slots",
|
||||
column: "SettingsId",
|
||||
principalTable: "WorldSettings",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,314 @@
|
||||
// <auto-generated />
|
||||
using Core.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 Core.Migrations
|
||||
{
|
||||
[DbContext(typeof(DataContext))]
|
||||
[Migration("20260615200104_Slots_Settings_Relation")]
|
||||
partial class Slots_Settings_Relation
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "10.0.9")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Core.Entities.AppConfig", b =>
|
||||
{
|
||||
b.Property<string>("Key")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<object>("Value")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.HasKey("Key");
|
||||
|
||||
b.ToTable("AppConfig");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Player", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<bool>("Accepted")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("Operator")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int?>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Uuid")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RealmId");
|
||||
|
||||
b.ToTable("Players");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ActiveSlotId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("ParentWorldId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("State")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SubscriptionId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("WorldType")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ActiveSlotId")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("ParentWorldId");
|
||||
|
||||
b.ToTable("Realms");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Slot", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("SlotId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RealmId");
|
||||
|
||||
b.ToTable("Slots");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.SlotOptions", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Difficulty")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("ForceGamemode")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("Gamemode")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("SlotId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("SlotName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SpawnProtection")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Version")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SlotId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("SlotOptions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Subscription", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("DaysLeft")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("SubscriptionId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RealmId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Subscriptions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.WorldSettings", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<bool>("Hardcore")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("SlotId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SlotId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("WorldSettings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Player", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Realm", "Realm")
|
||||
.WithMany("Players")
|
||||
.HasForeignKey("RealmId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.Navigation("Realm");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Slot", "ActiveSlot")
|
||||
.WithOne()
|
||||
.HasForeignKey("Core.Entities.Realm", "ActiveSlotId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Core.Entities.Realm", "ParentWorld")
|
||||
.WithMany()
|
||||
.HasForeignKey("ParentWorldId");
|
||||
|
||||
b.Navigation("ActiveSlot");
|
||||
|
||||
b.Navigation("ParentWorld");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Slot", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Realm", "Realm")
|
||||
.WithMany("Slots")
|
||||
.HasForeignKey("RealmId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.Navigation("Realm");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.SlotOptions", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Slot", "Slot")
|
||||
.WithOne("Options")
|
||||
.HasForeignKey("Core.Entities.SlotOptions", "SlotId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Slot");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Subscription", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Realm", "Realm")
|
||||
.WithOne("Subscription")
|
||||
.HasForeignKey("Core.Entities.Subscription", "RealmId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.Navigation("Realm");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.WorldSettings", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Slot", "Slot")
|
||||
.WithOne("Settings")
|
||||
.HasForeignKey("Core.Entities.WorldSettings", "SlotId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Slot");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.Navigation("Players");
|
||||
|
||||
b.Navigation("Slots");
|
||||
|
||||
b.Navigation("Subscription")
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Slot", b =>
|
||||
{
|
||||
b.Navigation("Options")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Settings")
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Core.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Slots_Settings_Relation : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,311 @@
|
||||
// <auto-generated />
|
||||
using Core.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 Core.Migrations
|
||||
{
|
||||
[DbContext(typeof(DataContext))]
|
||||
[Migration("20260615212747_Realms_Remove_SubscriptionId")]
|
||||
partial class Realms_Remove_SubscriptionId
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "10.0.9")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Core.Entities.AppConfig", b =>
|
||||
{
|
||||
b.Property<string>("Key")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<object>("Value")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.HasKey("Key");
|
||||
|
||||
b.ToTable("AppConfig");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Player", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<bool>("Accepted")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("Operator")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int?>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Uuid")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RealmId");
|
||||
|
||||
b.ToTable("Players");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ActiveSlotId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("ParentWorldId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("State")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("WorldType")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ActiveSlotId")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("ParentWorldId");
|
||||
|
||||
b.ToTable("Realms");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Slot", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("SlotId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RealmId");
|
||||
|
||||
b.ToTable("Slots");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.SlotOptions", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Difficulty")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("ForceGamemode")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("Gamemode")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("SlotId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("SlotName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SpawnProtection")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Version")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SlotId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("SlotOptions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Subscription", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("DaysLeft")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("SubscriptionId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RealmId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Subscriptions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.WorldSettings", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<bool>("Hardcore")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("SlotId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SlotId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("WorldSettings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Player", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Realm", "Realm")
|
||||
.WithMany("Players")
|
||||
.HasForeignKey("RealmId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.Navigation("Realm");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Slot", "ActiveSlot")
|
||||
.WithOne()
|
||||
.HasForeignKey("Core.Entities.Realm", "ActiveSlotId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Core.Entities.Realm", "ParentWorld")
|
||||
.WithMany()
|
||||
.HasForeignKey("ParentWorldId");
|
||||
|
||||
b.Navigation("ActiveSlot");
|
||||
|
||||
b.Navigation("ParentWorld");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Slot", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Realm", "Realm")
|
||||
.WithMany("Slots")
|
||||
.HasForeignKey("RealmId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.Navigation("Realm");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.SlotOptions", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Slot", "Slot")
|
||||
.WithOne("Options")
|
||||
.HasForeignKey("Core.Entities.SlotOptions", "SlotId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Slot");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Subscription", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Realm", "Realm")
|
||||
.WithOne("Subscription")
|
||||
.HasForeignKey("Core.Entities.Subscription", "RealmId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.Navigation("Realm");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.WorldSettings", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Slot", "Slot")
|
||||
.WithOne("Settings")
|
||||
.HasForeignKey("Core.Entities.WorldSettings", "SlotId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Slot");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.Navigation("Players");
|
||||
|
||||
b.Navigation("Slots");
|
||||
|
||||
b.Navigation("Subscription")
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Slot", b =>
|
||||
{
|
||||
b.Navigation("Options")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Settings")
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
+9
-9
@@ -2,28 +2,28 @@
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Migrations
|
||||
namespace Core.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class World_Remove_State_Column : Migration
|
||||
public partial class Realms_Remove_SubscriptionId : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "State",
|
||||
table: "Worlds");
|
||||
name: "SubscriptionId",
|
||||
table: "Realms");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "State",
|
||||
table: "Worlds",
|
||||
type: "text",
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "SubscriptionId",
|
||||
table: "Realms",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
defaultValue: 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
+197
-194
@@ -1,64 +1,31 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using System.Text.Json;
|
||||
using Core.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Migrations
|
||||
namespace Core.Migrations
|
||||
{
|
||||
[DbContext(typeof(DataContext))]
|
||||
[Migration("20240414062222_Configuration_Json")]
|
||||
partial class Configuration_Json
|
||||
[Migration("20260616142120_Subscription_StartDate_Type")]
|
||||
partial class Subscription_StartDate_Type
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.1")
|
||||
.HasAnnotation("ProductVersion", "10.0.9")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Backup", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("BackupId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("LastModifiedDate")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<JsonDocument>("Metadata")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<int>("Size")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("WorldId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WorldId");
|
||||
|
||||
b.ToTable("Backups");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Configuration", b =>
|
||||
modelBuilder.Entity("Core.Entities.AppConfig", b =>
|
||||
{
|
||||
b.Property<string>("Key")
|
||||
.HasColumnType("text");
|
||||
@@ -69,64 +36,10 @@ namespace Minecraft_Realms_Emulator.Migrations
|
||||
|
||||
b.HasKey("Key");
|
||||
|
||||
b.ToTable("Configuration");
|
||||
b.ToTable("AppConfig");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Connection", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Address")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("PendingUpdate")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("WorldId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WorldId");
|
||||
|
||||
b.ToTable("Connections");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Invite", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("InvitationId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("RecipeintUUID")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("WorldId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WorldId");
|
||||
|
||||
b.ToTable("Invites");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Player", b =>
|
||||
modelBuilder.Entity("Core.Entities.Player", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
@@ -141,31 +54,24 @@ namespace Minecraft_Realms_Emulator.Migrations
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("Online")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("Operator")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Permission")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
b.Property<int?>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Uuid")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("WorldId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WorldId");
|
||||
b.HasIndex("RealmId");
|
||||
|
||||
b.ToTable("Players");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Subscription", b =>
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
@@ -173,65 +79,19 @@ namespace Minecraft_Realms_Emulator.Migrations
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("StartDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
b.Property<int>("ActiveSlotId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("SubscriptionType")
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("WorldId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WorldId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Subscriptions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.World", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ActiveSlot")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("MaxPlayers")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("Member")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int?>("MinigameId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("MinigameImage")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("MinigameName")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Motd")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Owner")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("OwnerUUID")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<JsonDocument[]>("Slots")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb[]");
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("ParentWorldId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("State")
|
||||
.IsRequired()
|
||||
@@ -243,69 +103,212 @@ namespace Minecraft_Realms_Emulator.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Worlds");
|
||||
b.HasIndex("ActiveSlotId")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("ParentWorldId");
|
||||
|
||||
b.ToTable("Realms");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Backup", b =>
|
||||
modelBuilder.Entity("Core.Entities.Slot", b =>
|
||||
{
|
||||
b.HasOne("Minecraft_Realms_Emulator.Entities.World", "World")
|
||||
.WithMany()
|
||||
.HasForeignKey("WorldId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Navigation("World");
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("SlotId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RealmId");
|
||||
|
||||
b.ToTable("Slots");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Connection", b =>
|
||||
modelBuilder.Entity("Core.Entities.SlotOptions", b =>
|
||||
{
|
||||
b.HasOne("Minecraft_Realms_Emulator.Entities.World", "World")
|
||||
.WithMany()
|
||||
.HasForeignKey("WorldId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Navigation("World");
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Difficulty")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("ForceGamemode")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("Gamemode")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("SlotId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("SlotName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SpawnProtection")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Version")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SlotId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("SlotOptions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Invite", b =>
|
||||
modelBuilder.Entity("Core.Entities.Subscription", b =>
|
||||
{
|
||||
b.HasOne("Minecraft_Realms_Emulator.Entities.World", "World")
|
||||
.WithMany()
|
||||
.HasForeignKey("WorldId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Navigation("World");
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("StartDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("SubscriptionId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Type")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RealmId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Subscriptions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Player", b =>
|
||||
modelBuilder.Entity("Core.Entities.WorldSettings", b =>
|
||||
{
|
||||
b.HasOne("Minecraft_Realms_Emulator.Entities.World", "World")
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<bool>("Hardcore")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("SlotId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SlotId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("WorldSettings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Player", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Realm", "Realm")
|
||||
.WithMany("Players")
|
||||
.HasForeignKey("WorldId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
.HasForeignKey("RealmId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.Navigation("World");
|
||||
b.Navigation("Realm");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Subscription", b =>
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.HasOne("Minecraft_Realms_Emulator.Entities.World", "World")
|
||||
.WithOne("Subscription")
|
||||
.HasForeignKey("Minecraft_Realms_Emulator.Entities.Subscription", "WorldId")
|
||||
b.HasOne("Core.Entities.Slot", "ActiveSlot")
|
||||
.WithOne()
|
||||
.HasForeignKey("Core.Entities.Realm", "ActiveSlotId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Core.Entities.Realm", "ParentWorld")
|
||||
.WithMany()
|
||||
.HasForeignKey("ParentWorldId");
|
||||
|
||||
b.Navigation("ActiveSlot");
|
||||
|
||||
b.Navigation("ParentWorld");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Slot", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Realm", "Realm")
|
||||
.WithMany("Slots")
|
||||
.HasForeignKey("RealmId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.Navigation("Realm");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.SlotOptions", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Slot", "Slot")
|
||||
.WithOne("Options")
|
||||
.HasForeignKey("Core.Entities.SlotOptions", "SlotId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("World");
|
||||
b.Navigation("Slot");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.World", b =>
|
||||
modelBuilder.Entity("Core.Entities.Subscription", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Realm", "Realm")
|
||||
.WithOne("Subscription")
|
||||
.HasForeignKey("Core.Entities.Subscription", "RealmId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.Navigation("Realm");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.WorldSettings", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Slot", "Slot")
|
||||
.WithOne("Settings")
|
||||
.HasForeignKey("Core.Entities.WorldSettings", "SlotId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Slot");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.Navigation("Players");
|
||||
|
||||
b.Navigation("Subscription");
|
||||
b.Navigation("Slots");
|
||||
|
||||
b.Navigation("Subscription")
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Slot", b =>
|
||||
{
|
||||
b.Navigation("Options")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Settings")
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Core.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Subscription_StartDate_Type : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "DaysLeft",
|
||||
table: "Subscriptions");
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "StartDate",
|
||||
table: "Subscriptions",
|
||||
type: "timestamp with time zone",
|
||||
nullable: false,
|
||||
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "Type",
|
||||
table: "Subscriptions",
|
||||
type: "text",
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "StartDate",
|
||||
table: "Subscriptions");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Type",
|
||||
table: "Subscriptions");
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "DaysLeft",
|
||||
table: "Subscriptions",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,287 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Core.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 Core.Migrations
|
||||
{
|
||||
[DbContext(typeof(DataContext))]
|
||||
[Migration("20260616171720_Slots_Settings_Array")]
|
||||
partial class Slots_Settings_Array
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "10.0.9")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Core.Entities.AppConfig", b =>
|
||||
{
|
||||
b.Property<string>("Key")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<object>("Value")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.HasKey("Key");
|
||||
|
||||
b.ToTable("AppConfig");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Player", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<bool>("Accepted")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("Operator")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int?>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Uuid")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RealmId");
|
||||
|
||||
b.ToTable("Players");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ActiveSlotId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("ParentWorldId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("State")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("WorldType")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ActiveSlotId")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("ParentWorldId");
|
||||
|
||||
b.ToTable("Realms");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Slot", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.PrimitiveCollection<List<string>>("Settings")
|
||||
.IsRequired()
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("text[]")
|
||||
.HasDefaultValueSql("'{}'");
|
||||
|
||||
b.Property<int>("SlotId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RealmId");
|
||||
|
||||
b.ToTable("Slots");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.SlotOptions", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Difficulty")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("ForceGamemode")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("Gamemode")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("SlotId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("SlotName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SpawnProtection")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Version")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SlotId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("SlotOptions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Subscription", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("StartDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("SubscriptionId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Type")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RealmId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Subscriptions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Player", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Realm", "Realm")
|
||||
.WithMany("Players")
|
||||
.HasForeignKey("RealmId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.Navigation("Realm");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Slot", "ActiveSlot")
|
||||
.WithOne()
|
||||
.HasForeignKey("Core.Entities.Realm", "ActiveSlotId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Core.Entities.Realm", "ParentWorld")
|
||||
.WithMany()
|
||||
.HasForeignKey("ParentWorldId");
|
||||
|
||||
b.Navigation("ActiveSlot");
|
||||
|
||||
b.Navigation("ParentWorld");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Slot", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Realm", "Realm")
|
||||
.WithMany("Slots")
|
||||
.HasForeignKey("RealmId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.Navigation("Realm");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.SlotOptions", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Slot", "Slot")
|
||||
.WithOne("Options")
|
||||
.HasForeignKey("Core.Entities.SlotOptions", "SlotId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Slot");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Subscription", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Realm", "Realm")
|
||||
.WithOne("Subscription")
|
||||
.HasForeignKey("Core.Entities.Subscription", "RealmId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.Navigation("Realm");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.Navigation("Players");
|
||||
|
||||
b.Navigation("Slots");
|
||||
|
||||
b.Navigation("Subscription")
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Slot", b =>
|
||||
{
|
||||
b.Navigation("Options")
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Core.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Slots_Settings_Array : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "WorldSettings");
|
||||
|
||||
migrationBuilder.AddColumn<List<string>>(
|
||||
name: "Settings",
|
||||
table: "Slots",
|
||||
type: "text[]",
|
||||
nullable: false,
|
||||
defaultValueSql: "'{}'");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Settings",
|
||||
table: "Slots");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "WorldSettings",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
SlotId = table.Column<int>(type: "integer", nullable: false),
|
||||
Hardcore = table.Column<bool>(type: "boolean", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_WorldSettings", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_WorldSettings_Slots_SlotId",
|
||||
column: x => x.SlotId,
|
||||
principalTable: "Slots",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_WorldSettings_SlotId",
|
||||
table: "WorldSettings",
|
||||
column: "SlotId",
|
||||
unique: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
+210
-198
@@ -1,64 +1,32 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using System.Text.Json;
|
||||
using System.Collections.Generic;
|
||||
using Core.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Migrations
|
||||
namespace Core.Migrations
|
||||
{
|
||||
[DbContext(typeof(DataContext))]
|
||||
[Migration("20240421111457_Worlds_Version")]
|
||||
partial class Worlds_Version
|
||||
[Migration("20260616193828_RegionSelectionPreference_Init")]
|
||||
partial class RegionSelectionPreference_Init
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.4")
|
||||
.HasAnnotation("ProductVersion", "10.0.9")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Backup", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("BackupId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("LastModifiedDate")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<JsonDocument>("Metadata")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<int>("Size")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("WorldId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WorldId");
|
||||
|
||||
b.ToTable("Backups");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Configuration", b =>
|
||||
modelBuilder.Entity("Core.Entities.AppConfig", b =>
|
||||
{
|
||||
b.Property<string>("Key")
|
||||
.HasColumnType("text");
|
||||
@@ -69,64 +37,10 @@ namespace Minecraft_Realms_Emulator.Migrations
|
||||
|
||||
b.HasKey("Key");
|
||||
|
||||
b.ToTable("Configuration");
|
||||
b.ToTable("AppConfig");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Connection", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Address")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("PendingUpdate")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("WorldId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WorldId");
|
||||
|
||||
b.ToTable("Connections");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Invite", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("InvitationId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("RecipeintUUID")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("WorldId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WorldId");
|
||||
|
||||
b.ToTable("Invites");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Player", b =>
|
||||
modelBuilder.Entity("Core.Entities.Player", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
@@ -141,31 +55,24 @@ namespace Minecraft_Realms_Emulator.Migrations
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("Online")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("Operator")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Permission")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
b.Property<int?>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Uuid")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("WorldId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WorldId");
|
||||
b.HasIndex("RealmId");
|
||||
|
||||
b.ToTable("Players");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Subscription", b =>
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
@@ -173,69 +80,19 @@ namespace Minecraft_Realms_Emulator.Migrations
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("StartDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
b.Property<int>("ActiveSlotId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("SubscriptionType")
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("WorldId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WorldId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Subscriptions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.World", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ActiveSlot")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("ActiveVersion")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("MaxPlayers")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("Member")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int?>("MinigameId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("MinigameImage")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("MinigameName")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Motd")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Owner")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("OwnerUUID")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<JsonDocument[]>("Slots")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb[]");
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("ParentWorldId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("State")
|
||||
.IsRequired()
|
||||
@@ -247,69 +104,224 @@ namespace Minecraft_Realms_Emulator.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Worlds");
|
||||
b.HasIndex("ActiveSlotId")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("ParentWorldId");
|
||||
|
||||
b.ToTable("Realms");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Backup", b =>
|
||||
modelBuilder.Entity("Core.Entities.RealmRegionSelectionPreference", b =>
|
||||
{
|
||||
b.HasOne("Minecraft_Realms_Emulator.Entities.World", "World")
|
||||
.WithMany()
|
||||
.HasForeignKey("WorldId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Navigation("World");
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("PreferredRegion")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("RegionSelectionPreference")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasDefaultValue(0);
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RealmId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("RegionSelectionPreferences");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Connection", b =>
|
||||
modelBuilder.Entity("Core.Entities.Slot", b =>
|
||||
{
|
||||
b.HasOne("Minecraft_Realms_Emulator.Entities.World", "World")
|
||||
.WithMany()
|
||||
.HasForeignKey("WorldId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Navigation("World");
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.PrimitiveCollection<List<string>>("Settings")
|
||||
.IsRequired()
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("text[]")
|
||||
.HasDefaultValueSql("'{}'");
|
||||
|
||||
b.Property<int>("SlotId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RealmId");
|
||||
|
||||
b.ToTable("Slots");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Invite", b =>
|
||||
modelBuilder.Entity("Core.Entities.SlotOptions", b =>
|
||||
{
|
||||
b.HasOne("Minecraft_Realms_Emulator.Entities.World", "World")
|
||||
.WithMany()
|
||||
.HasForeignKey("WorldId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Navigation("World");
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Difficulty")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("ForceGamemode")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("Gamemode")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("SlotId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("SlotName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SpawnProtection")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Version")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SlotId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("SlotOptions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Player", b =>
|
||||
modelBuilder.Entity("Core.Entities.Subscription", b =>
|
||||
{
|
||||
b.HasOne("Minecraft_Realms_Emulator.Entities.World", "World")
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("StartDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("SubscriptionId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Type")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RealmId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Subscriptions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Player", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Realm", "Realm")
|
||||
.WithMany("Players")
|
||||
.HasForeignKey("WorldId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
.HasForeignKey("RealmId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.Navigation("World");
|
||||
b.Navigation("Realm");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Subscription", b =>
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.HasOne("Minecraft_Realms_Emulator.Entities.World", "World")
|
||||
.WithOne("Subscription")
|
||||
.HasForeignKey("Minecraft_Realms_Emulator.Entities.Subscription", "WorldId")
|
||||
b.HasOne("Core.Entities.Slot", "ActiveSlot")
|
||||
.WithOne()
|
||||
.HasForeignKey("Core.Entities.Realm", "ActiveSlotId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Core.Entities.Realm", "ParentWorld")
|
||||
.WithMany()
|
||||
.HasForeignKey("ParentWorldId");
|
||||
|
||||
b.Navigation("ActiveSlot");
|
||||
|
||||
b.Navigation("ParentWorld");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.RealmRegionSelectionPreference", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Realm", "Realm")
|
||||
.WithOne("RegionSelectionPreference")
|
||||
.HasForeignKey("Core.Entities.RealmRegionSelectionPreference", "RealmId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("World");
|
||||
b.Navigation("Realm");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.World", b =>
|
||||
modelBuilder.Entity("Core.Entities.Slot", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Realm", "Realm")
|
||||
.WithMany("Slots")
|
||||
.HasForeignKey("RealmId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.Navigation("Realm");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.SlotOptions", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Slot", "Slot")
|
||||
.WithOne("Options")
|
||||
.HasForeignKey("Core.Entities.SlotOptions", "SlotId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Slot");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Subscription", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Realm", "Realm")
|
||||
.WithOne("Subscription")
|
||||
.HasForeignKey("Core.Entities.Subscription", "RealmId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.Navigation("Realm");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.Navigation("Players");
|
||||
|
||||
b.Navigation("Subscription");
|
||||
b.Navigation("RegionSelectionPreference")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Slots");
|
||||
|
||||
b.Navigation("Subscription")
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Slot", b =>
|
||||
{
|
||||
b.Navigation("Options")
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
+21
-20
@@ -3,46 +3,47 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Migrations
|
||||
namespace Core.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Remove_Connections_Table : Migration
|
||||
public partial class RegionSelectionPreference_Init : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Connections");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Connections",
|
||||
name: "RegionSelectionPreferences",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
WorldId = table.Column<int>(type: "integer", nullable: false),
|
||||
Address = table.Column<string>(type: "text", nullable: false),
|
||||
PendingUpdate = table.Column<bool>(type: "boolean", nullable: false)
|
||||
RealmId = table.Column<int>(type: "integer", nullable: false),
|
||||
RegionSelectionPreference = table.Column<int>(type: "integer", nullable: false, defaultValue: 0),
|
||||
PreferredRegion = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Connections", x => x.Id);
|
||||
table.PrimaryKey("PK_RegionSelectionPreferences", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Connections_Worlds_WorldId",
|
||||
column: x => x.WorldId,
|
||||
principalTable: "Worlds",
|
||||
name: "FK_RegionSelectionPreferences_Realms_RealmId",
|
||||
column: x => x.RealmId,
|
||||
principalTable: "Realms",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Connections_WorldId",
|
||||
table: "Connections",
|
||||
column: "WorldId");
|
||||
name: "IX_RegionSelectionPreferences_RealmId",
|
||||
table: "RegionSelectionPreferences",
|
||||
column: "RealmId",
|
||||
unique: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "RegionSelectionPreferences");
|
||||
}
|
||||
}
|
||||
}
|
||||
+331
@@ -0,0 +1,331 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Core.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 Core.Migrations
|
||||
{
|
||||
[DbContext(typeof(DataContext))]
|
||||
[Migration("20260617045439_SlotOptions_SlotName_Default_Empty")]
|
||||
partial class SlotOptions_SlotName_Default_Empty
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "10.0.9")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Core.Entities.AppConfig", b =>
|
||||
{
|
||||
b.Property<string>("Key")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<object>("Value")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.HasKey("Key");
|
||||
|
||||
b.ToTable("AppConfig");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Player", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<bool>("Accepted")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("Operator")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int?>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Uuid")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RealmId");
|
||||
|
||||
b.ToTable("Players");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ActiveSlotId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("ParentWorldId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("State")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("WorldType")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ActiveSlotId")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("ParentWorldId");
|
||||
|
||||
b.ToTable("Realms");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.RealmRegionSelectionPreference", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("PreferredRegion")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("RegionSelectionPreference")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasDefaultValue(0);
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RealmId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("RegionSelectionPreferences");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Slot", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.PrimitiveCollection<List<string>>("Settings")
|
||||
.IsRequired()
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("text[]")
|
||||
.HasDefaultValueSql("'{}'");
|
||||
|
||||
b.Property<int>("SlotId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RealmId");
|
||||
|
||||
b.ToTable("Slots");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.SlotOptions", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Difficulty")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("ForceGamemode")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("Gamemode")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("SlotId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("SlotName")
|
||||
.IsRequired()
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("text")
|
||||
.HasDefaultValueSql("''");
|
||||
|
||||
b.Property<int>("SpawnProtection")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Version")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SlotId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("SlotOptions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Subscription", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("StartDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("SubscriptionId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Type")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RealmId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Subscriptions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Player", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Realm", "Realm")
|
||||
.WithMany("Players")
|
||||
.HasForeignKey("RealmId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.Navigation("Realm");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Slot", "ActiveSlot")
|
||||
.WithOne()
|
||||
.HasForeignKey("Core.Entities.Realm", "ActiveSlotId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Core.Entities.Realm", "ParentWorld")
|
||||
.WithMany()
|
||||
.HasForeignKey("ParentWorldId");
|
||||
|
||||
b.Navigation("ActiveSlot");
|
||||
|
||||
b.Navigation("ParentWorld");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.RealmRegionSelectionPreference", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Realm", "Realm")
|
||||
.WithOne("RegionSelectionPreference")
|
||||
.HasForeignKey("Core.Entities.RealmRegionSelectionPreference", "RealmId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Realm");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Slot", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Realm", "Realm")
|
||||
.WithMany("Slots")
|
||||
.HasForeignKey("RealmId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.Navigation("Realm");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.SlotOptions", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Slot", "Slot")
|
||||
.WithOne("Options")
|
||||
.HasForeignKey("Core.Entities.SlotOptions", "SlotId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Slot");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Subscription", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Realm", "Realm")
|
||||
.WithOne("Subscription")
|
||||
.HasForeignKey("Core.Entities.Subscription", "RealmId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.Navigation("Realm");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.Navigation("Players");
|
||||
|
||||
b.Navigation("RegionSelectionPreference")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Slots");
|
||||
|
||||
b.Navigation("Subscription")
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Slot", b =>
|
||||
{
|
||||
b.Navigation("Options")
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Core.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class SlotOptions_SlotName_Default_Empty : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "SlotName",
|
||||
table: "SlotOptions",
|
||||
type: "text",
|
||||
nullable: false,
|
||||
defaultValueSql: "''",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "SlotName",
|
||||
table: "SlotOptions",
|
||||
type: "text",
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text",
|
||||
oldDefaultValueSql: "''");
|
||||
}
|
||||
}
|
||||
}
|
||||
+212
-204
@@ -1,132 +1,46 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using System.Text.Json;
|
||||
using System.Collections.Generic;
|
||||
using Core.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Migrations
|
||||
namespace Core.Migrations
|
||||
{
|
||||
[DbContext(typeof(DataContext))]
|
||||
[Migration("20240315231009_Subscriptions_StartDate_Readable_Field")]
|
||||
partial class Subscriptions_StartDate_Readable_Field
|
||||
[Migration("20260617050726_SlotOptions_Gamemode_camelCase")]
|
||||
partial class SlotOptions_Gamemode_camelCase
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.1")
|
||||
.HasAnnotation("ProductVersion", "10.0.9")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Backup", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("BackupId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("LastModifiedDate")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<JsonDocument>("Metadata")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<int>("Size")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("WorldId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WorldId");
|
||||
|
||||
b.ToTable("Backups");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Configuration", b =>
|
||||
modelBuilder.Entity("Core.Entities.AppConfig", b =>
|
||||
{
|
||||
b.Property<string>("Key")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Value")
|
||||
b.Property<object>("Value")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.HasKey("Key");
|
||||
|
||||
b.ToTable("Configuration");
|
||||
b.ToTable("AppConfig");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Connection", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Address")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("PendingUpdate")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("WorldId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WorldId");
|
||||
|
||||
b.ToTable("Connections");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Invite", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("InvitationId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("RecipeintUUID")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("WorldId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WorldId");
|
||||
|
||||
b.ToTable("Invites");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Player", b =>
|
||||
modelBuilder.Entity("Core.Entities.Player", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
@@ -141,31 +55,24 @@ namespace Minecraft_Realms_Emulator.Migrations
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("Online")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("Operator")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Permission")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
b.Property<int?>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Uuid")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("WorldId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WorldId");
|
||||
b.HasIndex("RealmId");
|
||||
|
||||
b.ToTable("Players");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Subscription", b =>
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
@@ -173,77 +80,19 @@ namespace Minecraft_Realms_Emulator.Migrations
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("StartDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
b.Property<int>("ActiveSlotId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("SubscriptionType")
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("WorldId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WorldId");
|
||||
|
||||
b.ToTable("Subscriptions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.World", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ActiveSlot")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("DaysLeft")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("Expired")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("ExpiredTrial")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("MaxPlayers")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("Member")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int?>("MinigameId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("MinigameImage")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("MinigameName")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Motd")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Owner")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("OwnerUUID")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("RemoteSubscriptionId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<JsonDocument[]>("Slots")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb[]");
|
||||
b.Property<int?>("ParentWorldId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("State")
|
||||
.IsRequired()
|
||||
@@ -255,67 +104,226 @@ namespace Minecraft_Realms_Emulator.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Worlds");
|
||||
b.HasIndex("ActiveSlotId")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("ParentWorldId");
|
||||
|
||||
b.ToTable("Realms");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Backup", b =>
|
||||
modelBuilder.Entity("Core.Entities.RealmRegionSelectionPreference", b =>
|
||||
{
|
||||
b.HasOne("Minecraft_Realms_Emulator.Entities.World", "World")
|
||||
.WithMany()
|
||||
.HasForeignKey("WorldId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Navigation("World");
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("PreferredRegion")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("RegionSelectionPreference")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasDefaultValue(0);
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RealmId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("RegionSelectionPreferences");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Connection", b =>
|
||||
modelBuilder.Entity("Core.Entities.Slot", b =>
|
||||
{
|
||||
b.HasOne("Minecraft_Realms_Emulator.Entities.World", "World")
|
||||
.WithMany()
|
||||
.HasForeignKey("WorldId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Navigation("World");
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.PrimitiveCollection<List<string>>("Settings")
|
||||
.IsRequired()
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("text[]")
|
||||
.HasDefaultValueSql("'{}'");
|
||||
|
||||
b.Property<int>("SlotId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RealmId");
|
||||
|
||||
b.ToTable("Slots");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Invite", b =>
|
||||
modelBuilder.Entity("Core.Entities.SlotOptions", b =>
|
||||
{
|
||||
b.HasOne("Minecraft_Realms_Emulator.Entities.World", "World")
|
||||
.WithMany()
|
||||
.HasForeignKey("WorldId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Navigation("World");
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Difficulty")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("ForceGameMode")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("GameMode")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("SlotId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("SlotName")
|
||||
.IsRequired()
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("text")
|
||||
.HasDefaultValueSql("''");
|
||||
|
||||
b.Property<int>("SpawnProtection")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Version")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SlotId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("SlotOptions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Player", b =>
|
||||
modelBuilder.Entity("Core.Entities.Subscription", b =>
|
||||
{
|
||||
b.HasOne("Minecraft_Realms_Emulator.Entities.World", "World")
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("StartDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("SubscriptionId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Type")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RealmId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Subscriptions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Player", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Realm", "Realm")
|
||||
.WithMany("Players")
|
||||
.HasForeignKey("WorldId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
.HasForeignKey("RealmId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.Navigation("World");
|
||||
b.Navigation("Realm");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Subscription", b =>
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.HasOne("Minecraft_Realms_Emulator.Entities.World", "World")
|
||||
b.HasOne("Core.Entities.Slot", "ActiveSlot")
|
||||
.WithOne()
|
||||
.HasForeignKey("Core.Entities.Realm", "ActiveSlotId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Core.Entities.Realm", "ParentWorld")
|
||||
.WithMany()
|
||||
.HasForeignKey("WorldId")
|
||||
.HasForeignKey("ParentWorldId");
|
||||
|
||||
b.Navigation("ActiveSlot");
|
||||
|
||||
b.Navigation("ParentWorld");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.RealmRegionSelectionPreference", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Realm", "Realm")
|
||||
.WithOne("RegionSelectionPreference")
|
||||
.HasForeignKey("Core.Entities.RealmRegionSelectionPreference", "RealmId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("World");
|
||||
b.Navigation("Realm");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.World", b =>
|
||||
modelBuilder.Entity("Core.Entities.Slot", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Realm", "Realm")
|
||||
.WithMany("Slots")
|
||||
.HasForeignKey("RealmId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.Navigation("Realm");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.SlotOptions", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Slot", "Slot")
|
||||
.WithOne("Options")
|
||||
.HasForeignKey("Core.Entities.SlotOptions", "SlotId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Slot");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Subscription", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Realm", "Realm")
|
||||
.WithOne("Subscription")
|
||||
.HasForeignKey("Core.Entities.Subscription", "RealmId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.Navigation("Realm");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.Navigation("Players");
|
||||
|
||||
b.Navigation("RegionSelectionPreference")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Slots");
|
||||
|
||||
b.Navigation("Subscription")
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Slot", b =>
|
||||
{
|
||||
b.Navigation("Options")
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Core.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class SlotOptions_Gamemode_camelCase : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "Gamemode",
|
||||
table: "SlotOptions",
|
||||
newName: "GameMode");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "ForceGamemode",
|
||||
table: "SlotOptions",
|
||||
newName: "ForceGameMode");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "GameMode",
|
||||
table: "SlotOptions",
|
||||
newName: "Gamemode");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "ForceGameMode",
|
||||
table: "SlotOptions",
|
||||
newName: "ForceGamemode");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,328 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Core.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Core.Migrations
|
||||
{
|
||||
[DbContext(typeof(DataContext))]
|
||||
partial class DataContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "10.0.9")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Core.Entities.AppConfig", b =>
|
||||
{
|
||||
b.Property<string>("Key")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<object>("Value")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.HasKey("Key");
|
||||
|
||||
b.ToTable("AppConfig");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Player", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<bool>("Accepted")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("Operator")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int?>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Uuid")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RealmId");
|
||||
|
||||
b.ToTable("Players");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ActiveSlotId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("ParentWorldId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("State")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("WorldType")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ActiveSlotId")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("ParentWorldId");
|
||||
|
||||
b.ToTable("Realms");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.RealmRegionSelectionPreference", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("PreferredRegion")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("RegionSelectionPreference")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasDefaultValue(0);
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RealmId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("RegionSelectionPreferences");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Slot", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.PrimitiveCollection<List<string>>("Settings")
|
||||
.IsRequired()
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("text[]")
|
||||
.HasDefaultValueSql("'{}'");
|
||||
|
||||
b.Property<int>("SlotId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RealmId");
|
||||
|
||||
b.ToTable("Slots");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.SlotOptions", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Difficulty")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("ForceGameMode")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("GameMode")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("SlotId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("SlotName")
|
||||
.IsRequired()
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("text")
|
||||
.HasDefaultValueSql("''");
|
||||
|
||||
b.Property<int>("SpawnProtection")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Version")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SlotId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("SlotOptions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Subscription", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("RealmId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("StartDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("SubscriptionId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Type")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RealmId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Subscriptions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Player", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Realm", "Realm")
|
||||
.WithMany("Players")
|
||||
.HasForeignKey("RealmId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.Navigation("Realm");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Slot", "ActiveSlot")
|
||||
.WithOne()
|
||||
.HasForeignKey("Core.Entities.Realm", "ActiveSlotId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Core.Entities.Realm", "ParentWorld")
|
||||
.WithMany()
|
||||
.HasForeignKey("ParentWorldId");
|
||||
|
||||
b.Navigation("ActiveSlot");
|
||||
|
||||
b.Navigation("ParentWorld");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.RealmRegionSelectionPreference", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Realm", "Realm")
|
||||
.WithOne("RegionSelectionPreference")
|
||||
.HasForeignKey("Core.Entities.RealmRegionSelectionPreference", "RealmId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Realm");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Slot", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Realm", "Realm")
|
||||
.WithMany("Slots")
|
||||
.HasForeignKey("RealmId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.Navigation("Realm");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.SlotOptions", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Slot", "Slot")
|
||||
.WithOne("Options")
|
||||
.HasForeignKey("Core.Entities.SlotOptions", "SlotId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Slot");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Subscription", b =>
|
||||
{
|
||||
b.HasOne("Core.Entities.Realm", "Realm")
|
||||
.WithOne("Subscription")
|
||||
.HasForeignKey("Core.Entities.Subscription", "RealmId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.Navigation("Realm");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Realm", b =>
|
||||
{
|
||||
b.Navigation("Players");
|
||||
|
||||
b.Navigation("RegionSelectionPreference")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Slots");
|
||||
|
||||
b.Navigation("Subscription")
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Core.Entities.Slot", b =>
|
||||
{
|
||||
b.Navigation("Options")
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
namespace Core.Models;
|
||||
|
||||
public class ApiError
|
||||
{
|
||||
public int ErrorCode;
|
||||
public string ErrorMsg;
|
||||
|
||||
private ApiError(int errorCode, string errorMsg)
|
||||
{
|
||||
ErrorCode = errorCode;
|
||||
ErrorMsg = errorMsg;
|
||||
}
|
||||
|
||||
public static ApiError WorldNotFound => new(404, "World not found");
|
||||
public static ApiError NotAWorldMember => new(403, "Not a world member"); // TODO: Check if this is correct
|
||||
public static ApiError NotOwner => new(403, "Not owner");
|
||||
public static ApiError WorldAlreadyInitialized => new(409, "World already initialized");
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace Core.Models;
|
||||
|
||||
public class AppConfig
|
||||
{
|
||||
public static string NewsLink { get; set; } = "https://github.com/CyberL1/Minecraft-Realms-Emulator";
|
||||
public static bool Trial { get; set; } = true;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace Core.Models;
|
||||
|
||||
public class CookiePlayerData
|
||||
{
|
||||
public required string Uuid { get; set; }
|
||||
public required string Name { get; set; }
|
||||
public required string Version { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
namespace Core.Models;
|
||||
|
||||
public class Notification
|
||||
{
|
||||
public required string NotificationUuid { get; set; }
|
||||
public bool Dismissable { get; set; }
|
||||
public bool Seen { get; set; }
|
||||
public required string Type { get; set; }
|
||||
public required RealmsText Message { get; set; }
|
||||
|
||||
// visitUrl
|
||||
public string? Url { get; set; }
|
||||
public RealmsText? ButtonText { get; set; }
|
||||
|
||||
// infoPopup
|
||||
public RealmsText? Title { get; set; }
|
||||
public string? Image { get; set; }
|
||||
public UrlButton? UrlButton { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using Core.Enums;
|
||||
|
||||
namespace Core.Models;
|
||||
|
||||
public class RealmRegionSelectionPreference
|
||||
{
|
||||
public required RegionSelectionPreference RegionSelectionPreference { get; set; }
|
||||
public required string PreferredRegion { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace Core.Models;
|
||||
|
||||
public class RealmsText
|
||||
{
|
||||
public required string TranslationKey { get; set; }
|
||||
public string? Args { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using Core.Enums;
|
||||
|
||||
namespace Core.Models;
|
||||
|
||||
public class Region
|
||||
{
|
||||
public required string RegionName { get; set; }
|
||||
public required ServiceQuality ServiceQuality { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace Core.Models;
|
||||
|
||||
public class UrlButton
|
||||
{
|
||||
public required string Url { get; set; }
|
||||
public required RealmsText UrlText { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
using Core.Data;
|
||||
using Core.Middlewares;
|
||||
using Core.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using AppConfig = Core.Helpers.AppConfig;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
builder.Services.AddScoped<CookiePlayerData>();
|
||||
|
||||
builder.Services.AddControllers();
|
||||
|
||||
var connectionString = builder.Configuration.GetValue<string>("Database");
|
||||
|
||||
if (string.IsNullOrEmpty(connectionString))
|
||||
{
|
||||
Console.WriteLine("No database specified. Ensure 'Database' field exists in appsettings.json file.");
|
||||
return;
|
||||
}
|
||||
|
||||
builder.Services.AddDbContextPool<DataContext>(options => options.UseNpgsql(connectionString));
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
AppConfig.InitializeAppConfig(app.Services);
|
||||
|
||||
if (!app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseHttpsRedirection();
|
||||
app.UseHsts();
|
||||
}
|
||||
|
||||
app.UseRouting();
|
||||
|
||||
app.UseMiddleware<AuthorizationMiddleware>();
|
||||
app.UseMiddleware<CheckRealmAccessMiddleware>();
|
||||
|
||||
app.MapControllers();
|
||||
|
||||
app.Run();
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/launchsettings.json",
|
||||
"profiles": {
|
||||
"http": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"applicationUrl": "http://localhost:8080",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace Core.Requests;
|
||||
|
||||
public class RealmInitialize
|
||||
{
|
||||
public required string Name { get; set; }
|
||||
public string? Description { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace Core.Responses;
|
||||
|
||||
public class News
|
||||
{
|
||||
public required string NewsLink { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using Core.Models;
|
||||
|
||||
namespace Core.Responses;
|
||||
|
||||
public class NotificationList
|
||||
{
|
||||
public required List<Notification> Notifications { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace Core.Responses;
|
||||
|
||||
public class Player
|
||||
{
|
||||
public required string Uuid { get; set; }
|
||||
public required string Name { get; set; }
|
||||
public required bool Operator { get; set; }
|
||||
public required bool Accepted { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using RealmRegionSelectionPreference = Core.Models.RealmRegionSelectionPreference;
|
||||
|
||||
namespace Core.Responses;
|
||||
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public class Realm
|
||||
{
|
||||
public required int Id { get; set; }
|
||||
public required string RemoteSubscriptionId { get; set; }
|
||||
public required string Name { get; set; }
|
||||
public required string Motd { get; set; }
|
||||
public required string State { get; set; }
|
||||
public required string Owner { get; set; }
|
||||
public required string OwnerUUID { get; set; }
|
||||
public IEnumerable<Player>? Players { get; set; }
|
||||
public IEnumerable<Slot>? Slots { get; set; }
|
||||
public required bool Expired { get; set; }
|
||||
public required bool ExpiredTrial { get; set; }
|
||||
public required int DaysLeft { get; set; }
|
||||
public required string WorldType { get; set; }
|
||||
public required bool IsHardcore { get; set; }
|
||||
public required int GameMode { get; set; }
|
||||
public required int ActiveSlot { get; set; }
|
||||
public int? ParentWorldId { get; set; }
|
||||
public string? ParentWorldName { get; set; }
|
||||
public required string ActiveVersion { get; set; }
|
||||
public required string Compatibility { get; set; }
|
||||
public RealmRegionSelectionPreference? RegionSelectionPreference { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using Core.Models;
|
||||
|
||||
namespace Core.Responses;
|
||||
|
||||
public class RealmsList
|
||||
{
|
||||
public required List<Realm> Servers { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using Core.Models;
|
||||
|
||||
namespace Core.Responses;
|
||||
|
||||
public class RegionDataArray
|
||||
{
|
||||
public required List<Region> RegionDataList { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace Core.Responses;
|
||||
|
||||
public class Slot
|
||||
{
|
||||
public required int SlotId { get; set; }
|
||||
public required string Options { get; set; }
|
||||
public required List<string> Settings { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Core.Responses;
|
||||
|
||||
public class SlotOptions
|
||||
{
|
||||
[JsonPropertyName("spawnProtection")] public int SpawnProtection { get; set; }
|
||||
|
||||
[JsonPropertyName("forceGameMode")] public bool ForceGeeMode { get; set; }
|
||||
|
||||
[JsonPropertyName("difficulty")] public int Difficulty { get; set; }
|
||||
|
||||
[JsonPropertyName("gameMode")] public int GameMode { get; set; }
|
||||
|
||||
[JsonPropertyName("slotName")] public required string SlotName { get; set; }
|
||||
|
||||
[JsonPropertyName("version")] public required string Version { get; set; }
|
||||
|
||||
[JsonPropertyName("compatibility")] public required string Compatibility { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace Core.Responses;
|
||||
|
||||
public class Subscription
|
||||
{
|
||||
public required long StartDate { get; set; }
|
||||
public required int DaysLeft { get; set; }
|
||||
public required string SubscriptionType { get; set; }
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"Database": "Host=localhost;Username=postgres;Password=postgres;Database=Minecraft-Realms-Emulator",
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
@@ -1,37 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.8.34511.84
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Minecraft-Realms-Emulator", "Minecraft-Realms-Emulator\Minecraft-Realms-Emulator.csproj", "{A9A21AAF-EF1B-4723-9407-51FD6B831B98}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Panel", "Panel\Panel.csproj", "{DDDF0FE0-736D-47D5-8571-3DD7354B7917}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTests", "UnitTests\UnitTests.csproj", "{AFF83C8C-B6CA-4707-A26E-82002822F820}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{A9A21AAF-EF1B-4723-9407-51FD6B831B98}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A9A21AAF-EF1B-4723-9407-51FD6B831B98}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A9A21AAF-EF1B-4723-9407-51FD6B831B98}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A9A21AAF-EF1B-4723-9407-51FD6B831B98}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{DDDF0FE0-736D-47D5-8571-3DD7354B7917}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{DDDF0FE0-736D-47D5-8571-3DD7354B7917}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DDDF0FE0-736D-47D5-8571-3DD7354B7917}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DDDF0FE0-736D-47D5-8571-3DD7354B7917}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AFF83C8C-B6CA-4707-A26E-82002822F820}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AFF83C8C-B6CA-4707-A26E-82002822F820}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AFF83C8C-B6CA-4707-A26E-82002822F820}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AFF83C8C-B6CA-4707-A26E-82002822F820}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {BA6B23CA-D2DE-4AD2-9958-A8A4E3976210}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,3 @@
|
||||
<Solution>
|
||||
<Project Path="Core/Core.csproj" />
|
||||
</Solution>
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace Minecraft_Realms_Emulator.AppSettings;
|
||||
|
||||
public class AppSettings
|
||||
{
|
||||
public required string Database { get; set; }
|
||||
public required string AdminKey { get; set; }
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
namespace Minecraft_Realms_Emulator.Attributes
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Method)]
|
||||
public class CheckActiveSubscription : Attribute
|
||||
{
|
||||
public bool IsSubscriptionActive(DateTime subscriptionStartDate)
|
||||
{
|
||||
return ((DateTimeOffset)subscriptionStartDate.AddDays(30) - DateTime.Today).Days > 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
using Minecraft_Realms_Emulator.Entities;
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Attributes
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Method)]
|
||||
public class CheckForWorldAttribute : Attribute
|
||||
{
|
||||
public bool WorldExists(World? world)
|
||||
{
|
||||
return world != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
namespace Minecraft_Realms_Emulator.Attributes
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Method)]
|
||||
public class CheckRealmOwnerAttribute : Attribute
|
||||
{
|
||||
public bool IsRealmOwner(string playerUuid, string ownerUuid)
|
||||
{
|
||||
return playerUuid == ownerUuid;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace Minecraft_Realms_Emulator.Attributes
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Class)]
|
||||
public class RequireAdminKeyAttribute : Attribute
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
namespace Minecraft_Realms_Emulator.Attributes
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Class)]
|
||||
public class RequireMinecraftCookieAttribute : Attribute
|
||||
{
|
||||
public bool HasMinecraftCookie(string cookie)
|
||||
{
|
||||
return cookie.Contains("sid") && cookie.Contains("user") && cookie.Contains("version");
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user