Skip to content

Commit

Permalink
Fix naming convention for InspectionFinding
Browse files Browse the repository at this point in the history
  • Loading branch information
MuhammadUsama-afk-equinor authored and UsamaEquinorAFK committed Nov 28, 2023
1 parent 3b93684 commit 57b8e8c
Show file tree
Hide file tree
Showing 9 changed files with 1,362 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ namespace Api.Controllers
{
[ApiController]
[Route("inspection-findings")]
public class InspectionFindingsController(
ILogger<InspectionFindingsController> logger,
public class InspectionFindingController(
ILogger<InspectionFindingController> logger,
IInspectionService inspectionService
) : ControllerBase
{
Expand All @@ -27,12 +27,12 @@ IInspectionService inspectionService
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status403Forbidden)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<InspectionFinding>> AddFindings([FromBody] InspectionFindingsQuery inspectionFinding, [FromRoute] string isarStepId)
public async Task<ActionResult<InspectionFinding>> AddFinding([FromBody] InspectionFindingQuery inspectionFinding, [FromRoute] string isarStepId)
{
logger.LogInformation("Updating inspection findings for inspection with isarStepId '{Id}'", isarStepId);
logger.LogInformation("Add inspection finding for inspection with isarStepId '{Id}'", isarStepId);
try
{
var inspection = await inspectionService.AddFindings(inspectionFinding, isarStepId);
var inspection = await inspectionService.AddFinding(inspectionFinding, isarStepId);

if (inspection != null)
{
Expand All @@ -42,7 +42,7 @@ public async Task<ActionResult<InspectionFinding>> AddFindings([FromBody] Inspec
}
catch (Exception e)
{
logger.LogError(e, "Error while adding findings to inspection with IsarStepId '{Id}'", isarStepId);
logger.LogError(e, "Error while adding inspection finding to inspection with IsarStepId '{Id}'", isarStepId);
return StatusCode(StatusCodes.Status500InternalServerError);
}
return NotFound($"Could not find any inspection with the provided '{isarStepId}'");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
namespace Api.Controllers.Models
{
public struct InspectionFindingsQuery
public struct InspectionFindingQuery
{

public DateTime InspectionDate { get; set; }

public string Findings { get; set; }


public string Finding { get; set; }
}

}
Expand Down
8 changes: 4 additions & 4 deletions backend/api/Database/Models/InspectionFinding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ public class InspectionFinding

public string IsarStepId { get; set; }

public string Findings { get; set; }
public string Finding { get; set; }

public InspectionFinding(InspectionFindingsQuery createInspectionFindingQuery)
public InspectionFinding(InspectionFindingQuery createInspectionFindingQuery)
{
InspectionDate = createInspectionFindingQuery.InspectionDate;
Findings = createInspectionFindingQuery.Findings;
Finding = createInspectionFindingQuery.Finding;
}

public InspectionFinding()
{
InspectionDate = DateTime.UtcNow;
IsarStepId = "string";
Findings = "string";
Finding = "string";
}
}

Expand Down
Loading

0 comments on commit 57b8e8c

Please sign in to comment.