using AccountsBLL.PartyBranch; using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace AccountsSL.EndPoints.PartyBranch { // Legacy GB4 route: PartyBranch.svc/SiteDetails/?PartyBranchId={id} (GET). Not address info — // an EAV "site details" parameter set (MPARTYBRANCHINFO/MPARTYBRANCHINFODETAIL) attached to the // PartyBranch, filtered to rows whose effective window (WEFROM/WETO) fully spans today. public class GetSiteDetails : BaseEndpoint> { private readonly IPartyBranchBLL _PartyBranchBLL; public GetSiteDetails(IPartyBranchBLL partyBranchBLL) { _PartyBranchBLL = partyBranchBLL; } public override void Configure() { Get("/PartyBranch/SiteDetails"); AllowAnonymous(); } public record GetSiteDetailsParameters( [property: FromHeader] string Login, [property: QueryParam] int PartyBranchId ); protected override string? GetCacheKey(GetSiteDetailsParameters Parameters, LoginDTO LoginDTO) => null; protected override async Task> ExecuteAsync(GetSiteDetailsParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _PartyBranchBLL.GetSiteDetails(req.PartyBranchId, 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); } } } }