using AnalyticsBLL.DBJoin; using AnalyticsDAL.DTO.DBJoin; using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace AnalyticsSL.EndPoints.DBJoin { public class SaveDBJoin : BaseEndpoint> { private readonly IDBJoinBLL _DBJoinBLL; public SaveDBJoin(IDBJoinBLL DBJoinBLL) { _DBJoinBLL = DBJoinBLL; } public override void Configure() { Post("/DBJoin/SaveDBJoin"); AllowAnonymous(); } public record SaveDBJoinParameters( [property: FromHeader] string Login, [property: FromBody] DBJoinDTO DBJoinDTO ); protected override async Task> ExecuteAsync( SaveDBJoinParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _DBJoinBLL.SaveDBJoin(req.DBJoinDTO, 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); } } } }