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
+1
View File
@@ -34,5 +34,6 @@ namespace SharpbinV3.Server.Data.Entities
public long ExpiresAt { get; set; } // timestamp of when the paste expires, or 0 for never
public List<PasteView> PasteViews { get; set; } = [];
public List<Report> Reports { get; set; } = [];
}
}
+56
View File
@@ -0,0 +1,56 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
namespace SharpbinV3.Server.Data.Entities
{
[Index(nameof(ReportID), IsUnique = true)]
[Index(nameof(ReporterUUID))]
[Index(nameof(TargetType))]
[Index(nameof(PastePID))]
[Index(nameof(UserUUID))]
public class Report
{
public int? ReportID { get; set; }
public ReportType Type { get; set; }
public ReportStatus Status { get; set; } = ReportStatus.Open;
[MaxLength(1000)]
public string? Description { get; set; }
public long CreatedAt { get; set; } = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
public long? UpdatedAt { get; set; }
public Guid ReporterUUID { get; set; }
public ReportTargetType TargetType { get; set; }
public int? PastePID { get; set; }
public Guid? UserUUID { get; set; }
public Paste? Paste { get; set; }
public User? User { get; set; }
}
public enum ReportStatus
{
Open,
InProgress,
Resolved,
Closed
}
public enum ReportType
{
Spam,
Abuse,
InappropriateContent,
CopyrightViolation,
Fraud,
Other
}
public enum ReportTargetType
{
Paste,
User
}
}
+1
View File
@@ -21,6 +21,7 @@ namespace SharpbinV3.Server.Data.Entities
public int Visibility { get; set; } = 0; // 0 = public, 1 = unlisted, 2 = private
public List<Paste> Pastes { get; set; } = [];
public List<RefreshToken> RefreshTokens { get; set; } = [];
public List<Report> Reports { get; set; } = [];
public UserTotp? Totp { get; set; }
}
}