feat: reporting apis; better rate limiting

refactor: change certain apis to be more REST like (e.g. DELETE /api/paste/{pasteId}/delete -> DELETE /api/paste/{pasteId}
This commit is contained in:
2026-01-10 00:06:36 -05:00
parent 864a4ee91a
commit 14bbd9c762
15 changed files with 954 additions and 48 deletions
@@ -0,0 +1,81 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace SharpbinV3.Server.Migrations
{
/// <inheritdoc />
public partial class Reports : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Reports",
columns: table => new
{
ReportID = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Type = table.Column<int>(type: "INTEGER", nullable: false),
Status = table.Column<int>(type: "INTEGER", nullable: false),
Description = table.Column<string>(type: "TEXT", maxLength: 1000, nullable: true),
CreatedAt = table.Column<long>(type: "INTEGER", nullable: false),
UpdatedAt = table.Column<long>(type: "INTEGER", nullable: true),
ReporterUUID = table.Column<Guid>(type: "TEXT", nullable: false),
TargetType = table.Column<int>(type: "INTEGER", nullable: false),
PastePID = table.Column<int>(type: "INTEGER", nullable: true),
UserUUID = table.Column<Guid>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Reports", x => x.ReportID);
table.ForeignKey(
name: "FK_Reports_Pastes_PastePID",
column: x => x.PastePID,
principalTable: "Pastes",
principalColumn: "PID",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Reports_Users_UserUUID",
column: x => x.UserUUID,
principalTable: "Users",
principalColumn: "UUID",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Reports_PastePID",
table: "Reports",
column: "PastePID");
migrationBuilder.CreateIndex(
name: "IX_Reports_ReporterUUID",
table: "Reports",
column: "ReporterUUID");
migrationBuilder.CreateIndex(
name: "IX_Reports_ReportID",
table: "Reports",
column: "ReportID",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Reports_TargetType",
table: "Reports",
column: "TargetType");
migrationBuilder.CreateIndex(
name: "IX_Reports_UserUUID",
table: "Reports",
column: "UserUUID");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Reports");
}
}
}