using AnalyticsBLL.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 GetDBJoin : BaseEndpoint> { private readonly IDBJoinBLL _DBJoinBLL; public GetDBJoin(IDBJoinBLL DBJoinBLL) { _DBJoinBLL = DBJoinBLL; } public override void Configure() { Get("/DBJoin/GetDBJoin"); AllowAnonymous(); } public record GetDBJoinParameters( [property: FromHeader] string Login, [property: QueryParam] int JoinId ); //protected override string? GetCacheKey(GetDBJoinParameters Parameters, LoginDTO LoginDTO) //{ // try // { // return KeyGenerator.KeyGeneration(Parameters.JoinId!, EntityConstant.OBJECTDBJOIN, CacheKeyLevel.USER_LEVEL, LoginDTO); // } // catch (Exception) // { // throw; // } //} protected override async Task> ExecuteAsync(GetDBJoinParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var result = await _DBJoinBLL.GetDBJoin(req.JoinId, 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); } } } }