using FastEndpoints;
using FrameworkBLL.CommentHistory;
using FrameworkDAL.DTO.CommentHistory;
using GB5Shared.DTO.Framework.Login;
using GB5Shared.DTO.Framework.ResponseStandard;
using GB5Shared.FastEndPoint;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using static FrameworkDAL.Constant.Constant;
namespace FrameworkSL.Endpoints.CommentHistory
{
///
/// Superseded by CommunicationSL.Endpoints.CommentThread.GetCommentThreadTree (GB5Solution/
/// Communication module, ECP Phase 1), which returns the full threaded conversation for an
/// ObjectType+Object instead of a flat history list. CommentHistory has no callers outside
/// GB5Framework (confirmed by repo-wide grep during Phase 1 planning) — kept only in case of
/// an undiscovered caller. Do not add new callers.
///
[Obsolete("Superseded by CommunicationSL.Endpoints.CommentThread.GetCommentThreadTree (Communication module, ECP Phase 1). Do not use in new code.")]
public class GetCommentHistory : BaseEndpoint>
{
private readonly ICommentHistoryBLL _CommentHistoryBLL;
public GetCommentHistory(ICommentHistoryBLL commentHistoryBLL)
{
_CommentHistoryBLL = commentHistoryBLL;
}
public override void Configure()
{
Get("/CommentHistory/GetCommentHistory");
AllowAnonymous();
}
public record GetCommentHistoryParameters(
[property: FromHeader] string Login,
[property: QueryParam] int ObjectId,
[property: QueryParam] int ObjectTypeId
);
protected override async Task> ExecuteAsync(GetCommentHistoryParameters req, LoginDTO LoginDTO, CancellationToken ct)
{
try
{
var Result = await _CommentHistoryBLL.GetCommentHistoryAsync(req.ObjectId,req.ObjectTypeId, LoginDTO!);
return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse(Result, CacheKeyLevel.NotRequired, LoginDTO);
}
catch (Exception ex)
{
return await GB5Shared.ResponseStandard.Response.CreateExceptionError(ex, CacheKeyLevel.NotRequired, LoginDTO, ex.Message, 500);
}
}
}
}