Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix naming convention for InspectionFinding #1225

Merged
merged 1 commit into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading