using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using MMBLL.MMHead; using static GB5Shared.GB5Constant.Constant; namespace MMSL.EndPoints.MMHead { public class GetMMHead : BaseEndpoint { private readonly IMMHeadBLL _MMHeadBLL; public GetMMHead(IMMHeadBLL MMHeadBLL) { _MMHeadBLL = MMHeadBLL; } public override void Configure() { Get("/MMHead/GetMMHead"); AllowAnonymous(); } public record GetMMHeadParameters( [property: QueryParam] int DocumentId, [property: FromHeader] string Login ); protected override async Task> ExecuteAsync(GetMMHeadParameters parameters, LoginDTO loginDTO, CancellationToken ct) { try { var result = await _MMHeadBLL.GetMMHead(parameters.DocumentId, loginDTO!); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse(result, CacheKeyLevel.USER_LEVEL, loginDTO); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response.CreateExceptionError(ex, CacheKeyLevel.USER_LEVEL, loginDTO, ex.Message, 500); } } } }