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 GetMMHeadObjectConversion : BaseEndpoint> { private readonly IMMHeadBLL _MMHeadBLL; public GetMMHeadObjectConversion(IMMHeadBLL MMHeadBLL) { _MMHeadBLL = MMHeadBLL; } public override void Configure() { Get("/MMHead/GetMMHeadObjectConversion"); AllowAnonymous(); } public record GetMMHeadObjectConversionParameters( [property: QueryParam] string Id, [property: QueryParam] string? DetailIds, [property: QueryParam] string EntityCode, [property: QueryParam] int StoreId, [property: FromHeader] string Login ); protected override string? GetCacheKey(GetMMHeadObjectConversionParameters req, LoginDTO login) => null; protected override async Task> ExecuteAsync(GetMMHeadObjectConversionParameters req, LoginDTO loginDTO, CancellationToken ct) { try { var result = await _MMHeadBLL.GetMMHeadObjectConversion( req.Id, req.DetailIds, req.EntityCode, req.StoreId, loginDTO!, ct); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse(result, CacheKeyLevel.NOT_REQUIRED, loginDTO); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response.CreateExceptionError(ex, CacheKeyLevel.NOT_REQUIRED, loginDTO, ex.Message, 500); } } } }