diff --git a/WowsKarma.Api/Utilities/Conversions.cs b/WowsKarma.Api/Utilities/Conversions.cs index edf1928..c69d72d 100644 --- a/WowsKarma.Api/Utilities/Conversions.cs +++ b/WowsKarma.Api/Utilities/Conversions.cs @@ -15,12 +15,17 @@ public static class Conversions public static void ConfigureMapping() { TypeAdapterConfig.GlobalSettings.Compiler = exp => exp.CompileWithDebugInfo(); - + TypeAdapterConfig .NewConfig() .IgnoreNullValues(true) .Ignore(dest => dest.Author) - .Ignore(dest => dest.Player); + .Ignore(dest => dest.Player) + .Map( + dest => dest.CustomerSupportTicketId, + src => src.SupportTicketStatus.TicketId, + srcCond => srcCond.SupportTicketStatus.TicketId != null + ); TypeAdapterConfig .NewConfig() @@ -34,7 +39,12 @@ public static void ConfigureMapping() : ReplayState.Processing ) .Map(dest => dest.Author.Clan, src => src.Author.ClanMember.Clan) - .Map(dest => dest.Player.Clan, src => src.Player.ClanMember.Clan); + .Map(dest => dest.Player.Clan, src => src.Player.ClanMember.Clan) + .Map(dest => dest.SupportTicketStatus, src => new PlayerPostDTO.CustomerSupportStatus + { + HasTicket = src.CustomerSupportTicketId != null, + TicketId = src.CustomerSupportTicketId + }); TypeAdapterConfig .NewConfig() diff --git a/WowsKarma.Common/Models/DTOs/PlayerPostDTO.cs b/WowsKarma.Common/Models/DTOs/PlayerPostDTO.cs index 87693cd..489f5c8 100644 --- a/WowsKarma.Common/Models/DTOs/PlayerPostDTO.cs +++ b/WowsKarma.Common/Models/DTOs/PlayerPostDTO.cs @@ -26,4 +26,29 @@ public record PlayerPostDTO // Computed by DB Engine (hopefully) public DateTimeOffset? CreatedAt { get; init; } public DateTimeOffset? UpdatedAt { get; init; } + + /// + /// The status of the Customer Support ticket associated with the post when applicable. + /// + public CustomerSupportStatus SupportTicketStatus { get; init; } + + /// + /// Defines the status of the Customer Support ticket associated with the post when applicable. + /// + public struct CustomerSupportStatus + { + /// + /// Whether the post has an associated Customer Support ticket. + /// + public bool HasTicket { get; init; } + + /// + /// The Customer Support ticket ID associated with this post. + /// + /// + /// This is only available when is , + /// and only visible to the post's author, platform staff, and Wargaming staff. + /// + public int? TicketId { get; init; } + } }