-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Let user configure custom zoom for tasks
- Loading branch information
Showing
10 changed files
with
1,612 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
using Api.Controllers.Models; | ||
using Api.Services; | ||
using Api.Services.MissionLoaders; | ||
using Api.Services.Models; | ||
using Microsoft.AspNetCore.Authorization; | ||
using Microsoft.AspNetCore.Mvc; | ||
|
||
namespace Api.Controllers | ||
{ | ||
[ApiController] | ||
[Route("inspection")] | ||
public class InspectionController( | ||
ILogger<InspectionController> logger, | ||
IEchoService echoService | ||
) : ControllerBase | ||
{ | ||
/// <summary> | ||
/// Updates the Flotilla metadata for an inspection tag | ||
/// </summary> | ||
/// <remarks> | ||
/// <para> This query updates the Flotilla metadata for an inpection tag </para> | ||
/// </remarks> | ||
[HttpPost("{tagId}/tag-zoom")] | ||
[Authorize(Roles = Role.Admin)] | ||
[ProducesResponseType(typeof(TagInspectionMetadata), StatusCodes.Status201Created)] | ||
[ProducesResponseType(StatusCodes.Status400BadRequest)] | ||
[ProducesResponseType(StatusCodes.Status401Unauthorized)] | ||
[ProducesResponseType(StatusCodes.Status403Forbidden)] | ||
[ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||
public async Task<ActionResult<TagInspectionMetadata>> Create([FromRoute] string tagId, [FromBody] IsarZoomDescription zoom) | ||
{ | ||
logger.LogInformation($"Updating zoom value for tag with ID {tagId}"); | ||
|
||
var newMetadata = new TagInspectionMetadata | ||
{ | ||
TagId = tagId, | ||
ZoomDescription = zoom | ||
}; | ||
|
||
try | ||
{ | ||
var metadata = await echoService.CreateOrUpdateTagInspectionMetadata(newMetadata); | ||
|
||
return metadata; | ||
} | ||
catch (Exception e) | ||
{ | ||
logger.LogError(e, "Error while creating or updating inspection tag metadata"); | ||
throw; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#nullable disable | ||
using System.ComponentModel.DataAnnotations; | ||
using Api.Services.Models; | ||
|
||
namespace Api.Services.MissionLoaders | ||
{ | ||
public class TagInspectionMetadata | ||
{ | ||
[Key] | ||
public string TagId { get; set; } | ||
|
||
public IsarZoomDescription ZoomDescription { get; set; } | ||
} | ||
} |
Oops, something went wrong.