Skip to content

Commit

Permalink
Merge pull request #2019 from bcgov/bug/TCVP-3116
Browse files Browse the repository at this point in the history
TCVP-3116 Query Performance Improvement Front-end Changes
  • Loading branch information
saikrishnametpalli-nttdata authored Dec 9, 2024
2 parents 88907ab + 1de6adf commit 51e4762
Show file tree
Hide file tree
Showing 164 changed files with 1,789 additions and 846 deletions.
2 changes: 2 additions & 0 deletions src/backend/TrafficCourts/Staff.Service/Caching/Cache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ public static class Api
public static string Languages(int version = 1) => $"staff-api:v{version}:languages";
public static string Provinces(int version = 1) => $"staff-api:v{version}:provinces";

public static string DisputeCaseFileStatusTypes(int version = 1) => $"staff-api:v{version}:tco:dispute-status_types";

/// <summary>
/// Stores the list of statutues
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using System;
using System.ComponentModel.DataAnnotations;
using System.Net;
using System.Security.Claims;
Expand Down Expand Up @@ -93,9 +94,14 @@ public async Task<IActionResult> GetJJDisputesAsync(string? jjAssignedTo, Cancel
/// <param name="ticket_number"></param>
/// <param name="surname">The case insenstive surname to search for.</param>
/// <param name="jj_assigned_to">The JJ assigned user</param>
/// <param name="jj_decision_dt_from">The jj decision date where greater or equal to this date. Format must be YYYY-MM-DD.</param>
/// <param name="jj_decision_dt_thru">The jj decision date where less or equal to this date. Format must be YYYY-MM-DD.</param>
/// <param name="dispute_status_codes">The comma separate list of status codes</param>
/// <param name="appearance_courthouse_ids">The comma separate list of agency ids</param>
/// <param name="appearance_dt_from">The appearance date from. Format must be YYYY-MM-DD.</param>
/// <param name="appearance_dt_thru">The appearance date thru. Format must be YYYY-MM-DD.</param>
/// <param name="to_be_heard_at_courthouse_ids">The comma separate list of agency ids</param>
/// <param name="hearing_type_cd">The hearing type code to search.</param>
/// <param name="page_number">The page number to fetch. Starts at 1.</param>
/// <param name="page_size">The page size to use. If not specified, defaults to 25</param>
/// <param name="sort_by">The list of columns to sort the result by. To sort descending, add a '-' before the column name.</param>
Expand All @@ -121,9 +127,14 @@ public async Task<IActionResult> SearchDisputesAsync(
string? ticket_number,
string? surname,
string? jj_assigned_to,
string? jj_decision_dt_from,
string? jj_decision_dt_thru,
string? dispute_status_codes,
string? appearance_courthouse_ids,
string? appearance_dt_from,
string? appearance_dt_thru,
string? to_be_heard_at_courthouse_ids,
string? hearing_type_cd,
string? sort_by,
int? page_number,
int? page_size,
Expand All @@ -141,9 +152,14 @@ public async Task<IActionResult> SearchDisputesAsync(
ticket_number = ticket_number,
surname = surname,
jj_assigned_to = jj_assigned_to,
jj_decision_dt_from = jj_decision_dt_from,
jj_decision_dt_thru = jj_decision_dt_thru,
dispute_status_codes = dispute_status_codes,
appearance_courthouse_ids = appearance_courthouse_ids,
appearance_dt_from = appearance_dt_from,
appearance_dt_thru = appearance_dt_thru,
to_be_heard_at_courthouse_ids = to_be_heard_at_courthouse_ids,
hearing_type_cd = hearing_type_cd,
sort_by = sort_by,
page_number = page_number,
page_size = page_size
Expand All @@ -152,7 +168,13 @@ public async Task<IActionResult> SearchDisputesAsync(
try
{
var response = await _mediator.Send(request, cancellationToken);
return Ok(response.Data);

if (response.Data is not null)
{
return Ok(response.Data);
}

return StatusCode(StatusCodes.Status500InternalServerError, new { message = "Error fetching disputes", errorId = response.ErrorId });
}
catch (Exception exception)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,4 +250,30 @@ public async Task<IActionResult> CountryV2Async(CancellationToken cancellationTo

return Ok(response.Items);
}


/// <summary>
/// Returns a list of dispute case file status types.
/// </summary>
/// <param name="cancellationToken"></param>
/// <returns></returns>
/// <response code="200">OK</response>
/// <response code="401">Request lacks valid authentication credentials.</response>
#if DEBUG
[AllowAnonymous]
#endif
[HttpGet]
[Route("/api/[controller]/dispute-case-file-statuses/v2")]
[Produces("application/json")]
[ProducesResponseType(typeof(IList<DisputeCaseFileStatus>), StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
public async Task<IActionResult> DisputeCaseFileStatusesV2Async(CancellationToken cancellationToken)
{
_logger.LogDebug("Retrieving Dispute Case File Statuses");

var request = new Features.Lookups.DisputeCaseFileStatusTypes.Request();
var response = await _mediator.Send(request, cancellationToken);

return Ok(response.Items);
}
}
Loading

0 comments on commit 51e4762

Please sign in to comment.