mirror of
https://github.com/CyberL1/Minecraft-Realms-Emulator.git
synced 2025-04-10 18:08:37 -04:00
Compare commits
No commits in common. "ece3d3825fb439d53331d5b0a0ed0ff4e1b74ca3" and "26fa8813dd3bf37f7747d235c923c2ddb4da1a89" have entirely different histories.
ece3d3825f
...
26fa8813dd
@ -13,6 +13,5 @@ namespace Minecraft_Realms_Emulator.Data
|
|||||||
public DbSet<Player> Players { get; set; }
|
public DbSet<Player> Players { get; set; }
|
||||||
public DbSet<Configuration> Configuration { get; set; }
|
public DbSet<Configuration> Configuration { get; set; }
|
||||||
public DbSet<Slot> Slots { get; set; }
|
public DbSet<Slot> Slots { get; set; }
|
||||||
public DbSet<Template> Templates { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
namespace Minecraft_Realms_Emulator.Entities
|
|
||||||
{
|
|
||||||
public class Template
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
public string Name { get; set; } = string.Empty;
|
|
||||||
public string Version { get; set; } = string.Empty;
|
|
||||||
public string Author { get; set; } = string.Empty;
|
|
||||||
public string Link { get; set; } = string.Empty;
|
|
||||||
public string? Image { get; set; }
|
|
||||||
public string Trailer { get; set; } = string.Empty;
|
|
||||||
public string RecommendedPlayers { get; set; } = string.Empty;
|
|
||||||
public string Type { get; set; } = null!;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,422 +0,0 @@
|
|||||||
// <auto-generated />
|
|
||||||
using System;
|
|
||||||
using System.Text.Json;
|
|
||||||
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
|
|
||||||
{
|
|
||||||
[DbContext(typeof(DataContext))]
|
|
||||||
[Migration("20240611172843_Templates")]
|
|
||||||
partial class Templates
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
#pragma warning disable 612, 618
|
|
||||||
modelBuilder
|
|
||||||
.HasAnnotation("ProductVersion", "8.0.5")
|
|
||||||
.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 =>
|
|
||||||
{
|
|
||||||
b.Property<string>("Key")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<object>("Value")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("jsonb");
|
|
||||||
|
|
||||||
b.HasKey("Key");
|
|
||||||
|
|
||||||
b.ToTable("Configuration");
|
|
||||||
});
|
|
||||||
|
|
||||||
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 =>
|
|
||||||
{
|
|
||||||
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>("Online")
|
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.Property<bool>("Operator")
|
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.Property<string>("Permission")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Uuid")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<int>("WorldId")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("WorldId");
|
|
||||||
|
|
||||||
b.ToTable("Players");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Slot", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<bool>("CommandBlocks")
|
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.Property<int>("Difficulty")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<bool>("ForceGameMode")
|
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.Property<int>("GameMode")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<bool>("Pvp")
|
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.Property<int>("SlotId")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<string>("SlotName")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<bool>("SpawnAnimals")
|
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.Property<bool>("SpawnMonsters")
|
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.Property<bool>("SpawnNPCs")
|
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.Property<int>("SpawnProtection")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<string>("Version")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<int>("WorldId")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("WorldId");
|
|
||||||
|
|
||||||
b.ToTable("Slots");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Subscription", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<DateTime>("StartDate")
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<string>("SubscriptionType")
|
|
||||||
.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.Template", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<string>("Author")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Image")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Link")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("RecommendedPlayers")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Trailer")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Type")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Version")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Templates");
|
|
||||||
});
|
|
||||||
|
|
||||||
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<string>("State")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("WorldType")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Worlds");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Backup", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Minecraft_Realms_Emulator.Entities.World", "World")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("WorldId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("World");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Connection", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Minecraft_Realms_Emulator.Entities.World", "World")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("WorldId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("World");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Invite", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Minecraft_Realms_Emulator.Entities.World", "World")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("WorldId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("World");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Player", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Minecraft_Realms_Emulator.Entities.World", "World")
|
|
||||||
.WithMany("Players")
|
|
||||||
.HasForeignKey("WorldId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("World");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Slot", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Minecraft_Realms_Emulator.Entities.World", "World")
|
|
||||||
.WithMany("Slots")
|
|
||||||
.HasForeignKey("WorldId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("World");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Subscription", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Minecraft_Realms_Emulator.Entities.World", "World")
|
|
||||||
.WithOne("Subscription")
|
|
||||||
.HasForeignKey("Minecraft_Realms_Emulator.Entities.Subscription", "WorldId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("World");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.World", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Players");
|
|
||||||
|
|
||||||
b.Navigation("Slots");
|
|
||||||
|
|
||||||
b.Navigation("Subscription");
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,42 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace Minecraft_Realms_Emulator.Migrations
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public partial class Templates : Migration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Templates",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<int>(type: "integer", nullable: false)
|
|
||||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
||||||
Name = table.Column<string>(type: "text", nullable: false),
|
|
||||||
Version = table.Column<string>(type: "text", nullable: false),
|
|
||||||
Author = table.Column<string>(type: "text", nullable: false),
|
|
||||||
Link = table.Column<string>(type: "text", nullable: false),
|
|
||||||
Image = table.Column<string>(type: "text", nullable: true),
|
|
||||||
Trailer = table.Column<string>(type: "text", nullable: false),
|
|
||||||
RecommendedPlayers = table.Column<string>(type: "text", nullable: false),
|
|
||||||
Type = table.Column<string>(type: "text", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Templates", x => x.Id);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Templates");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -18,7 +18,7 @@ namespace Minecraft_Realms_Emulator.Migrations
|
|||||||
{
|
{
|
||||||
#pragma warning disable 612, 618
|
#pragma warning disable 612, 618
|
||||||
modelBuilder
|
modelBuilder
|
||||||
.HasAnnotation("ProductVersion", "8.0.5")
|
.HasAnnotation("ProductVersion", "8.0.4")
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||||
|
|
||||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||||
@ -244,50 +244,6 @@ namespace Minecraft_Realms_Emulator.Migrations
|
|||||||
b.ToTable("Subscriptions");
|
b.ToTable("Subscriptions");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Template", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<string>("Author")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Image")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Link")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("RecommendedPlayers")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Trailer")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Type")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Version")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Templates");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.World", b =>
|
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.World", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
|
@ -324,30 +324,8 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
|||||||
[HttpPost("{wId}")]
|
[HttpPost("{wId}")]
|
||||||
[CheckForWorld]
|
[CheckForWorld]
|
||||||
[CheckRealmOwner]
|
[CheckRealmOwner]
|
||||||
public async Task<ActionResult<(bool, ErrorResponse)>> UpdateWorld(int wId, WorldCreateRequest body)
|
public async Task<ActionResult<bool>> UpdateWorld(int wId, WorldCreateRequest body)
|
||||||
{
|
{
|
||||||
if (body.Name.Length > 32)
|
|
||||||
{
|
|
||||||
ErrorResponse errorResponse = new()
|
|
||||||
{
|
|
||||||
ErrorCode = 400,
|
|
||||||
ErrorMsg = "World name cannot exceed 32 characters"
|
|
||||||
};
|
|
||||||
|
|
||||||
return BadRequest(errorResponse);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (body.Description.Length > 32)
|
|
||||||
{
|
|
||||||
ErrorResponse errorResponse = new()
|
|
||||||
{
|
|
||||||
ErrorCode = 400,
|
|
||||||
ErrorMsg = "World description cannot exceed 32 characters"
|
|
||||||
};
|
|
||||||
|
|
||||||
return BadRequest(errorResponse);
|
|
||||||
}
|
|
||||||
|
|
||||||
var worlds = await _context.Worlds.ToListAsync();
|
var worlds = await _context.Worlds.ToListAsync();
|
||||||
|
|
||||||
var world = worlds.Find(w => w.Id == wId);
|
var world = worlds.Find(w => w.Id == wId);
|
||||||
@ -363,19 +341,8 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
|||||||
[HttpPost("{wId}/slot/{sId}")]
|
[HttpPost("{wId}/slot/{sId}")]
|
||||||
[CheckForWorld]
|
[CheckForWorld]
|
||||||
[CheckRealmOwner]
|
[CheckRealmOwner]
|
||||||
public async Task<ActionResult<(bool, ErrorResponse)>> UpdateSlot(int wId, int sId, SlotOptionsRequest body)
|
public async Task<ActionResult<bool>> UpdateSlotAsync(int wId, int sId, SlotOptionsRequest body)
|
||||||
{
|
{
|
||||||
if (body.SlotName.Length > 10)
|
|
||||||
{
|
|
||||||
ErrorResponse errorResponse = new()
|
|
||||||
{
|
|
||||||
ErrorCode = 400,
|
|
||||||
ErrorMsg = "Slot name cannot exceed 10 characters"
|
|
||||||
};
|
|
||||||
|
|
||||||
return BadRequest(errorResponse);
|
|
||||||
}
|
|
||||||
|
|
||||||
var slots = await _context.Slots.Where(s => s.World.Id == wId).ToListAsync();
|
var slots = await _context.Slots.Where(s => s.World.Id == wId).ToListAsync();
|
||||||
var slot = slots.Find(s => s.SlotId == sId);
|
var slot = slots.Find(s => s.SlotId == sId);
|
||||||
|
|
||||||
@ -470,22 +437,5 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
|||||||
|
|
||||||
return Ok(true);
|
return Ok(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("templates/{type}")]
|
|
||||||
public ActionResult<TemplatesResponse> GetWorldTemplates(string type, int page, int pageSize)
|
|
||||||
{
|
|
||||||
var totalTemplates = _context.Templates.Where(t => t.Type == type).Count();
|
|
||||||
var templates = _context.Templates.Where(t => t.Type == type).Skip((page - 1) * pageSize).Take(pageSize).ToList();
|
|
||||||
|
|
||||||
TemplatesResponse templatesResponse = new()
|
|
||||||
{
|
|
||||||
Page = page,
|
|
||||||
Size = pageSize,
|
|
||||||
Total = totalTemplates,
|
|
||||||
Templates = templates
|
|
||||||
};
|
|
||||||
|
|
||||||
return Ok(templatesResponse);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -347,30 +347,8 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
|||||||
[CheckForWorld]
|
[CheckForWorld]
|
||||||
[CheckRealmOwner]
|
[CheckRealmOwner]
|
||||||
[CheckActiveSubscription]
|
[CheckActiveSubscription]
|
||||||
public async Task<ActionResult<(bool, ErrorResponse)>> UpdateWorld(int wId, WorldCreateRequest body)
|
public async Task<ActionResult<bool>> UpdateWorld(int wId, WorldCreateRequest body)
|
||||||
{
|
{
|
||||||
if (body.Name.Length > 32)
|
|
||||||
{
|
|
||||||
ErrorResponse errorResponse = new()
|
|
||||||
{
|
|
||||||
ErrorCode = 400,
|
|
||||||
ErrorMsg = "World name cannot exceed 32 characters"
|
|
||||||
};
|
|
||||||
|
|
||||||
return BadRequest(errorResponse);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (body.Description.Length > 32)
|
|
||||||
{
|
|
||||||
ErrorResponse errorResponse = new()
|
|
||||||
{
|
|
||||||
ErrorCode = 400,
|
|
||||||
ErrorMsg = "World description cannot exceed 32 characters"
|
|
||||||
};
|
|
||||||
|
|
||||||
return BadRequest(errorResponse);
|
|
||||||
}
|
|
||||||
|
|
||||||
var worlds = await _context.Worlds.ToListAsync();
|
var worlds = await _context.Worlds.ToListAsync();
|
||||||
|
|
||||||
var world = worlds.Find(w => w.Id == wId);
|
var world = worlds.Find(w => w.Id == wId);
|
||||||
@ -387,52 +365,8 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
|||||||
[CheckForWorld]
|
[CheckForWorld]
|
||||||
[CheckRealmOwner]
|
[CheckRealmOwner]
|
||||||
[CheckActiveSubscription]
|
[CheckActiveSubscription]
|
||||||
public async Task<ActionResult<(bool, ErrorResponse)>> UpdateSlot(int wId, int sId, SlotOptionsRequest body)
|
public async Task<ActionResult<bool>> UpdateSlotAsync(int wId, int sId, SlotOptionsRequest body)
|
||||||
{
|
{
|
||||||
if (body.SlotName.Length > 10)
|
|
||||||
{
|
|
||||||
ErrorResponse errorResponse = new()
|
|
||||||
{
|
|
||||||
ErrorCode = 400,
|
|
||||||
ErrorMsg = "Slot name cannot exceed 10 characters"
|
|
||||||
};
|
|
||||||
|
|
||||||
return BadRequest(errorResponse);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (body.SpawnProtection < 0 || body.SpawnProtection > 16)
|
|
||||||
{
|
|
||||||
ErrorResponse errorResponse = new()
|
|
||||||
{
|
|
||||||
ErrorCode = 400,
|
|
||||||
ErrorMsg = "Spawn protection can only be between 0 and 16"
|
|
||||||
};
|
|
||||||
|
|
||||||
return BadRequest(errorResponse);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!new List<int> { 0, 1, 2 }.Contains(body.GameMode))
|
|
||||||
{
|
|
||||||
ErrorResponse errorResponse = new()
|
|
||||||
{
|
|
||||||
ErrorCode = 400,
|
|
||||||
ErrorMsg = "Gamemode can only be one of 0, 1, 2"
|
|
||||||
};
|
|
||||||
|
|
||||||
return BadRequest(errorResponse);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!new List<int> { 0, 1, 2, 3 }.Contains(body.Difficulty))
|
|
||||||
{
|
|
||||||
ErrorResponse errorResponse = new()
|
|
||||||
{
|
|
||||||
ErrorCode = 400,
|
|
||||||
ErrorMsg = "Difficulty can only be one of 0, 1, 2, 3"
|
|
||||||
};
|
|
||||||
|
|
||||||
return BadRequest(errorResponse);
|
|
||||||
}
|
|
||||||
|
|
||||||
var slots = await _context.Slots.Where(s => s.World.Id == wId).ToListAsync();
|
var slots = await _context.Slots.Where(s => s.World.Id == wId).ToListAsync();
|
||||||
var slot = slots.Find(s => s.SlotId == sId);
|
var slot = slots.Find(s => s.SlotId == sId);
|
||||||
|
|
||||||
@ -530,22 +464,5 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
|||||||
|
|
||||||
return Ok(true);
|
return Ok(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("templates/{type}")]
|
|
||||||
public ActionResult<TemplatesResponse> GetWorldTemplates(string type, int page, int pageSize)
|
|
||||||
{
|
|
||||||
var totalTemplates = _context.Templates.Where(t => t.Type == type).Count();
|
|
||||||
var templates = _context.Templates.Where(t => t.Type == type).Skip((page - 1) * pageSize).Take(pageSize).ToList();
|
|
||||||
|
|
||||||
TemplatesResponse templatesResponse = new()
|
|
||||||
{
|
|
||||||
Page = page,
|
|
||||||
Size = pageSize,
|
|
||||||
Total = totalTemplates,
|
|
||||||
Templates = templates
|
|
||||||
};
|
|
||||||
|
|
||||||
return Ok(templatesResponse);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
using Minecraft_Realms_Emulator.Entities;
|
|
||||||
|
|
||||||
namespace Minecraft_Realms_Emulator.Responses
|
|
||||||
{
|
|
||||||
public class TemplatesResponse
|
|
||||||
{
|
|
||||||
public List<Template> Templates { get; set; } = null!;
|
|
||||||
public int Page { get; set; }
|
|
||||||
public int Size { get; set; }
|
|
||||||
public int Total { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user