Removed old support system

This commit is contained in:
Marcel Baumgartner
2023-04-21 16:38:06 +02:00
parent 2a0475bd17
commit 7f51bfd1db
11 changed files with 1099 additions and 528 deletions

View File

@@ -30,8 +30,7 @@ public class DataContext : DbContext
public DbSet<AuditLogEntry> AuditLog { get; set; }
public DbSet<ErrorLogEntry> ErrorLog { get; set; }
public DbSet<SecurityLogEntry> SecurityLog { get; set; }
public DbSet<SupportMessage> SupportMessages { get; set; }
public DbSet<SharedDomain> SharedDomains { get; set; }
public DbSet<Domain> Domains { get; set; }
public DbSet<Revoke> Revokes { get; set; }

View File

@@ -1,17 +0,0 @@
using Moonlight.App.Models.Misc;
namespace Moonlight.App.Database.Entities;
public class SupportMessage
{
public int Id { get; set; }
public string Message { get; set; } = "";
public User? Sender { get; set; } = null;
public User? Recipient { get; set; } = null;
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public bool IsQuestion { get; set; } = false;
public QuestionType Type { get; set; }
public string Answer { get; set; } = "";
public bool IsSystem { get; set; } = false;
public bool IsSupport { get; set; } = false;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,67 @@
using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Moonlight.App.Database.Migrations
{
/// <inheritdoc />
public partial class RemovedOldSupportChatModel : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "SupportMessages");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "SupportMessages",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
RecipientId = table.Column<int>(type: "int", nullable: true),
SenderId = table.Column<int>(type: "int", nullable: true),
Answer = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false),
IsQuestion = table.Column<bool>(type: "tinyint(1)", nullable: false),
IsSupport = table.Column<bool>(type: "tinyint(1)", nullable: false),
IsSystem = table.Column<bool>(type: "tinyint(1)", nullable: false),
Message = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Type = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_SupportMessages", x => x.Id);
table.ForeignKey(
name: "FK_SupportMessages_Users_RecipientId",
column: x => x.RecipientId,
principalTable: "Users",
principalColumn: "Id");
table.ForeignKey(
name: "FK_SupportMessages_Users_SenderId",
column: x => x.SenderId,
principalTable: "Users",
principalColumn: "Id");
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_SupportMessages_RecipientId",
table: "SupportMessages",
column: "RecipientId");
migrationBuilder.CreateIndex(
name: "IX_SupportMessages_SenderId",
table: "SupportMessages",
column: "SenderId");
}
}
}

View File

@@ -695,50 +695,6 @@ namespace Moonlight.App.Database.Migrations
b.ToTable("SupportChatMessages");
});
modelBuilder.Entity("Moonlight.App.Database.Entities.SupportMessage", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<string>("Answer")
.IsRequired()
.HasColumnType("longtext");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)");
b.Property<bool>("IsQuestion")
.HasColumnType("tinyint(1)");
b.Property<bool>("IsSupport")
.HasColumnType("tinyint(1)");
b.Property<bool>("IsSystem")
.HasColumnType("tinyint(1)");
b.Property<string>("Message")
.IsRequired()
.HasColumnType("longtext");
b.Property<int?>("RecipientId")
.HasColumnType("int");
b.Property<int?>("SenderId")
.HasColumnType("int");
b.Property<int>("Type")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("RecipientId");
b.HasIndex("SenderId");
b.ToTable("SupportMessages");
});
modelBuilder.Entity("Moonlight.App.Database.Entities.User", b =>
{
b.Property<int>("Id")
@@ -1010,21 +966,6 @@ namespace Moonlight.App.Database.Migrations
b.Navigation("Sender");
});
modelBuilder.Entity("Moonlight.App.Database.Entities.SupportMessage", b =>
{
b.HasOne("Moonlight.App.Database.Entities.User", "Recipient")
.WithMany()
.HasForeignKey("RecipientId");
b.HasOne("Moonlight.App.Database.Entities.User", "Sender")
.WithMany()
.HasForeignKey("SenderId");
b.Navigation("Recipient");
b.Navigation("Sender");
});
modelBuilder.Entity("Moonlight.App.Database.Entities.User", b =>
{
b.HasOne("Moonlight.App.Database.Entities.Subscription", "CurrentSubscription")