- Introduced a new support ticket system allowing users to submit bug reports and role requests. - Implemented endpoints for creating, updating, and managing support tickets, including file attachments. - Enhanced Telegram bot integration to handle role requests directly within the bot, enabling admins to approve or reject requests without accessing the website. - Updated database schema to include support ticket entities and their relationships. - Improved API documentation to reflect new support ticket endpoints and their usage. - Added necessary localization for support ticket features in both Russian and English.
106 lines
4.7 KiB
C#
106 lines
4.7 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace PnvPanel.Infrastructure.Persistence.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddSupportTickets : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "SupportTickets",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
UserId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
Type = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: false),
|
|
Status = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: false),
|
|
RequestedRoleId = table.Column<Guid>(type: "uuid", nullable: true),
|
|
ProposedRoleName = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: true),
|
|
ProposedMaxConfigs = table.Column<int>(type: "integer", nullable: true),
|
|
ProposedMaxIpLimit = table.Column<int>(type: "integer", nullable: true),
|
|
CreatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_SupportTickets", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "TicketAttachments",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
CommentId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
FileName = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
|
|
StoredFileName = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
|
|
ContentType = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
|
|
SizeBytes = table.Column<long>(type: "bigint", nullable: false),
|
|
CreatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_TicketAttachments", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "TicketComments",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
TicketId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
AuthorId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
Body = table.Column<string>(type: "character varying(4000)", maxLength: 4000, nullable: false),
|
|
CreatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_TicketComments", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_SupportTickets_Type_Status",
|
|
table: "SupportTickets",
|
|
columns: new[] { "Type", "Status" });
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_SupportTickets_UserId_Status",
|
|
table: "SupportTickets",
|
|
columns: new[] { "UserId", "Status" });
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_TicketAttachments_CommentId",
|
|
table: "TicketAttachments",
|
|
column: "CommentId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_TicketAttachments_StoredFileName",
|
|
table: "TicketAttachments",
|
|
column: "StoredFileName",
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_TicketComments_TicketId_CreatedAt",
|
|
table: "TicketComments",
|
|
columns: new[] { "TicketId", "CreatedAt" });
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "SupportTickets");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "TicketAttachments");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "TicketComments");
|
|
}
|
|
}
|
|
}
|