Foxnouns.NET/Foxnouns.Backend/Dto/Moderation.cs

84 lines
2.6 KiB
C#

// Copyright (C) 2023-present sam/u1f320 (vulpine.solutions)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// ReSharper disable NotAccessedPositionalProperty.Global
using Foxnouns.Backend.Database;
using Foxnouns.Backend.Database.Models;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace Foxnouns.Backend.Dto;
public record ReportResponse(
Snowflake Id,
PartialUser Reporter,
PartialUser TargetUser,
[property: JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
PartialMember? TargetMember,
ReportStatus Status,
ReportReason Reason,
ReportTargetType TargetType,
JObject? Snapshot
);
public record AuditLogResponse(
Snowflake Id,
AuditLogEntity Moderator,
[property: JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
AuditLogEntity? TargetUser,
[property: JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
AuditLogEntity? TargetMember,
[property: JsonProperty(NullValueHandling = NullValueHandling.Ignore)] Snowflake? ReportId,
AuditLogEntryType Type,
string? Reason,
[property: JsonProperty(NullValueHandling = NullValueHandling.Ignore)] string[]? ClearedFields
);
public record NotificationResponse(
Snowflake Id,
NotificationType Type,
string? Message,
string? LocalizationKey,
Dictionary<string, string> LocalizationParams,
bool Acknowledged
);
public record AuditLogEntity(Snowflake Id, string Username);
public record CreateReportRequest(ReportReason Reason, string? Context = null);
public record IgnoreReportRequest(string? Reason = null);
public record WarnUserRequest(
string Reason,
FieldsToClear[]? ClearFields = null,
Snowflake? MemberId = null,
Snowflake? ReportId = null
);
public record SuspendUserRequest(string Reason, bool ClearProfile, Snowflake? ReportId = null);
public enum FieldsToClear
{
DisplayName,
Avatar,
Bio,
Links,
Names,
Pronouns,
Fields,
Flags,
CustomPreferences,
}