Skip to content

Commit

Permalink
Merge pull request #392 from DFE-Digital/v1-trusts-documentation
Browse files Browse the repository at this point in the history
V1 trusts documentation
  • Loading branch information
dneed-nimble authored Oct 11, 2023
2 parents 956f39c + a885a4b commit 9cd1a2f
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion TramsDataApi/Controllers/TrustsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@
using System.Text.Json;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Swashbuckle.AspNetCore.Annotations;
using TramsDataApi.ResponseModels;
using TramsDataApi.UseCases;

namespace TramsDataApi.Controllers
{
/// <summary>
/// Handles operations related to Trusts.
/// </summary>
[ApiController]
[ApiVersion("1.0")]
[SwaggerTag("Trust Endpoints")]
public class TrustsController : ControllerBase
{
private readonly IGetTrustByUkprn _getTrustByUkprn;
Expand All @@ -22,9 +27,17 @@ public TrustsController(IGetTrustByUkprn getTrustByUkprn, ISearchTrusts searchTr
_searchTrusts = searchTrusts;
_logger = logger;
}


/// <summary>
/// Retrieves a Trust by its UKPRN.
/// </summary>
/// <param name="ukprn">The UKPRN identifier.</param>
/// <returns>A Trust or NotFound if not available.</returns>
[HttpGet]
[Route("trust/{ukprn}")]
[SwaggerOperation(Summary = "Retrieve Trust by UKPRN", Description = "Returns a Trust identified by UKPRN.")]
[SwaggerResponse(200, "Successfully found and returned the Trust.")]
[SwaggerResponse(404, "Trust with specified UKPRN not found.")]
public ActionResult<TrustResponse> GetTrustByUkprn(string ukprn)
{
_logger.LogInformation($"Attempting to get trust by UKPRN {ukprn}");
Expand All @@ -41,8 +54,19 @@ public ActionResult<TrustResponse> GetTrustByUkprn(string ukprn)
return Ok(trust);
}

/// <summary>
/// Searches for Trusts based on query parameters.
/// </summary>
/// <param name="groupName">Name of the group.</param>
/// <param name="ukPrn">UKPRN identifier.</param>
/// <param name="companiesHouseNumber">Companies House Number.</param>
/// <param name="page">Pagination page.</param>
/// <param name="count">Number of results per page.</param>
/// <returns>A list of Trusts that meet the search criteria.</returns>
[HttpGet]
[Route("trusts")]
[SwaggerOperation(Summary = "Search Trusts", Description = "Returns a list of Trusts based on search criteria.")]
[SwaggerResponse(200, "Successfully executed the search and returned Trusts.")]
public ActionResult<List<TrustSummaryResponse>> SearchTrusts(string groupName, string ukPrn, string companiesHouseNumber, int page = 1, int count = 10)
{
_logger.LogInformation(
Expand Down

0 comments on commit 9cd1a2f

Please sign in to comment.