mirror of
https://github.com/corvax-team/ss14-wl.git
synced 2026-02-14 19:29:57 +01:00
Апдейт http апи сервера
This commit is contained in:
2095
Content.Server.Database/Migrations/Postgres/20240909080023_DiscordConnection.Designer.cs
generated
Normal file
2095
Content.Server.Database/Migrations/Postgres/20240909080023_DiscordConnection.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Content.Server.Database.Migrations.Postgres
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class DiscordConnection : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "discord_connections",
|
||||
columns: table => new
|
||||
{
|
||||
discord_connections_id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
discord_id = table.Column<string>(type: "text", nullable: false),
|
||||
user_guid = table.Column<Guid>(type: "uuid", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_discord_connections", x => x.discord_connections_id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_discord_connections_discord_id",
|
||||
table: "discord_connections",
|
||||
column: "discord_id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_discord_connections_user_guid",
|
||||
table: "discord_connections",
|
||||
column: "user_guid",
|
||||
unique: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "discord_connections");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -614,6 +614,36 @@ namespace Content.Server.Database.Migrations.Postgres
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Content.Server.Database.DiscordConnection", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("discord_connections_id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("DiscordId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("discord_id");
|
||||
|
||||
b.Property<Guid>("UserGuid")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("user_guid");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("PK_discord_connections");
|
||||
|
||||
b.HasIndex("DiscordId")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("UserGuid")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("discord_connections", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Content.Server.Database.Job", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
|
||||
2012
Content.Server.Database/Migrations/Sqlite/20240909080007_DiscordConnection.Designer.cs
generated
Normal file
2012
Content.Server.Database/Migrations/Sqlite/20240909080007_DiscordConnection.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Content.Server.Database.Migrations.Sqlite
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class DiscordConnection : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "discord_connections",
|
||||
columns: table => new
|
||||
{
|
||||
discord_connections_id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
discord_id = table.Column<string>(type: "TEXT", nullable: false),
|
||||
user_guid = table.Column<Guid>(type: "TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_discord_connections", x => x.discord_connections_id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_discord_connections_discord_id",
|
||||
table: "discord_connections",
|
||||
column: "discord_id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_discord_connections_user_guid",
|
||||
table: "discord_connections",
|
||||
column: "user_guid",
|
||||
unique: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "discord_connections");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -578,6 +578,34 @@ namespace Content.Server.Database.Migrations.Sqlite
|
||||
b.ToTable("connection_log", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Content.Server.Database.DiscordConnection", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER")
|
||||
.HasColumnName("discord_connections_id");
|
||||
|
||||
b.Property<string>("DiscordId")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnName("discord_id");
|
||||
|
||||
b.Property<Guid>("UserGuid")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnName("user_guid");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("PK_discord_connections");
|
||||
|
||||
b.HasIndex("DiscordId")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("UserGuid")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("discord_connections", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Content.Server.Database.Job", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
|
||||
@@ -43,8 +43,28 @@ namespace Content.Server.Database
|
||||
public DbSet<RoleWhitelist> RoleWhitelists { get; set; } = null!;
|
||||
public DbSet<BanTemplate> BanTemplate { get; set; } = null!;
|
||||
|
||||
//WL-Changes-start
|
||||
public DbSet<DiscordConnection> DiscordConnections { get; set; } = null!;
|
||||
//WL-Changes-end
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
//WL-Changes-start
|
||||
modelBuilder.Entity<DiscordConnection>()
|
||||
.HasIndex(c => c.UserGuid)
|
||||
.IsUnique();
|
||||
|
||||
modelBuilder.Entity<DiscordConnection>()
|
||||
.HasIndex(c => c.DiscordId)
|
||||
.IsUnique();
|
||||
|
||||
modelBuilder.Entity<DiscordConnection>()
|
||||
.Property(p => p.DiscordId)
|
||||
.HasConversion(
|
||||
p => p.ToString(),
|
||||
p => ulong.Parse(p));
|
||||
//WL-Changes-end
|
||||
|
||||
modelBuilder.Entity<Preference>()
|
||||
.HasIndex(p => p.UserId)
|
||||
.IsUnique();
|
||||
@@ -426,6 +446,13 @@ namespace Content.Server.Database
|
||||
public string JobName { get; set; } = null!;
|
||||
public string Subname { get; set; } = null!;
|
||||
}
|
||||
|
||||
public class DiscordConnection
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public ulong DiscordId { get; set; }
|
||||
public Guid UserGuid { get; set; }
|
||||
}
|
||||
//WL-Changes-start
|
||||
|
||||
public enum DbJobPriority
|
||||
|
||||
Reference in New Issue
Block a user