using FastEndpoints; using FrameworkBLL.DataDictionary; using FrameworkDAL.DTO.DataDictionary; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace FrameworkSL.Endpoints.DataDictionary { public class SaveDataDictionary : BaseEndpoint> { private readonly IDataDictionaryBLL _DataDictionaryBLL; public SaveDataDictionary(IDataDictionaryBLL DataDictionaryBLL) { _DataDictionaryBLL = DataDictionaryBLL; } public override void Configure() { Post("/DataDictionary/SaveDataDictionary"); AllowAnonymous(); } public record SaveDataDictionaryParameters( [property: FromHeader] string Login, [property: FromBody] DataDictionaryDTO DataDictionaryDTO ); protected override async Task> ExecuteAsync(SaveDataDictionaryParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _DataDictionaryBLL.SaveDataDictionary(req.DataDictionaryDTO, LoginDTO!); 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); } } } }