mirror of
https://github.com/whoswhip/Sharpbin.git
synced 2026-12-06 02:48:43 +00:00
feat: reports; improved+simplifed modals; extractError funcction;
refactor: change jwt claims to lowercase; use response dtos for sensitive data fix: nullify user on token clears; change appsettings.dev View_Internal_API_Key
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
namespace SharpbinV3.Server.DTOs.Auth
|
||||
{
|
||||
public class LoginResponseDto
|
||||
{
|
||||
public bool Success { get; set; }
|
||||
public string Token { get; set; } = string.Empty;
|
||||
public string RefreshToken { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public class TokenRefreshResponseDto
|
||||
{
|
||||
public bool Success { get; set; }
|
||||
public string? Message { get; set; }
|
||||
public TokenData? Token { get; set; }
|
||||
}
|
||||
|
||||
public class TokenData
|
||||
{
|
||||
public string? Token { get; set; }
|
||||
public string? RefreshToken { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
using SharpbinV3.Server.DTOs.User;
|
||||
|
||||
namespace SharpbinV3.Server.DTOs.Paste
|
||||
{
|
||||
public class PasteResponseDto
|
||||
{
|
||||
public string ID { get; set; } = string.Empty;
|
||||
public Guid UUID { get; set; }
|
||||
public string? Title { get; set; }
|
||||
public string? Syntax { get; set; }
|
||||
public long Size { get; set; }
|
||||
public long TrueSize { get; set; }
|
||||
public bool IsCompressed { get; set; }
|
||||
public int Views { get; set; }
|
||||
public int Visibility { get; set; }
|
||||
public long? EditedAt { get; set; }
|
||||
public long ExpiresAt { get; set; }
|
||||
public int? ReportCount { get; set; }
|
||||
public UserSimpleDto? Author { get; set; }
|
||||
}
|
||||
|
||||
public class PasteCreatedResponseDto
|
||||
{
|
||||
public string ID { get; set; } = string.Empty;
|
||||
public Guid UUID { get; set; }
|
||||
public bool IsCompressed { get; set; }
|
||||
public long Size { get; set; }
|
||||
public long TrueSize { get; set; }
|
||||
public long ExpiresAt { get; set; }
|
||||
}
|
||||
|
||||
public class PasteOptionsDto
|
||||
{
|
||||
public string[] Syntaxes { get; set; } = [];
|
||||
public List<PasteVisibilityOptionDto> Visibilities { get; set; } = [];
|
||||
public int MaxTitleLength { get; set; }
|
||||
public long MaxPasteSize { get; set; }
|
||||
public bool RequiresVerification { get; set; }
|
||||
}
|
||||
|
||||
public class PasteVisibilityOptionDto
|
||||
{
|
||||
public int Value { get; set; }
|
||||
public string DisplayName { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace SharpbinV3.Server.DTOs
|
||||
namespace SharpbinV3.Server.DTOs.Report
|
||||
{
|
||||
public class ReportDto
|
||||
{
|
||||
[Required]
|
||||
[MaxLength(1000)]
|
||||
[MinLength(12), MaxLength(1000)]
|
||||
public string Description { get; set; } = string.Empty;
|
||||
[Required]
|
||||
public string ReportType { get; set; } = string.Empty; // e.g., "Spam", "Abuse", etc.
|
||||
@@ -0,0 +1,17 @@
|
||||
using SharpbinV3.Server.Data.Entities;
|
||||
|
||||
namespace SharpbinV3.Server.DTOs.Report
|
||||
{
|
||||
public sealed record ReportQuery
|
||||
{
|
||||
public Guid? ReporterUUID { get; init; }
|
||||
public Guid? UserUUID { get; init; }
|
||||
public int? PastePID { get; init; }
|
||||
public string? PasteId { get; init; }
|
||||
public ReportTargetType? TargetType { get; init; }
|
||||
public ReportType? Type { get; init; }
|
||||
public ReportStatus? Status { get; init; }
|
||||
public int Page { get; init; } = 1;
|
||||
public int PageSize { get; init; } = 20;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using SharpbinV3.Server.Data.Entities;
|
||||
|
||||
namespace SharpbinV3.Server.DTOs.Report
|
||||
{
|
||||
public class ReportResponseDto
|
||||
{
|
||||
public int? ReportID { get; set; }
|
||||
public ReportType Type { get; set; }
|
||||
public ReportStatus Status { get; set; }
|
||||
public string? Description { get; set; }
|
||||
public long CreatedAt { get; set; }
|
||||
public long? UpdatedAt { get; set; }
|
||||
public Guid ReporterUUID { get; set; }
|
||||
public string? ReporterUsername { get; set; }
|
||||
public string? ReporterDisplayName { get; set; }
|
||||
public ReportTargetType TargetType { get; set; }
|
||||
public string? PasteId { get; set; }
|
||||
public string? PasteTitle { get; set; }
|
||||
public Guid? UserUUID { get; set; }
|
||||
public string? TargetUsername { get; set; }
|
||||
public string? TargetDisplayName { get; set; }
|
||||
}
|
||||
|
||||
public class ReportOptionsDto
|
||||
{
|
||||
public string[] Types { get; set; } = [];
|
||||
public string[] Statuses { get; set; } = [];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace SharpbinV3.Server.DTOs.Report
|
||||
{
|
||||
public class ReportUpdateDto
|
||||
{
|
||||
public string? Status { get; set; }
|
||||
public string? Type { get; set; }
|
||||
[MaxLength(1000)]
|
||||
public string? Description { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
namespace SharpbinV3.Server.DTOs.User
|
||||
{
|
||||
public class UserSimpleDto
|
||||
{
|
||||
public int? UID { get; set; }
|
||||
public Guid UUID { get; set; }
|
||||
public string Username { get; set; } = string.Empty;
|
||||
public string? DisplayName { get; set; }
|
||||
public int[] Roles { get; set; } = [];
|
||||
public int Visibility { get; set; }
|
||||
}
|
||||
|
||||
public class UserResponseDto : UserSimpleDto
|
||||
{
|
||||
public string? Email { get; set; }
|
||||
public long? LastLogin { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user