-
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
11 changed files
with
1,613 additions
and
6 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("echo")] | ||
public class EchoController( | ||
ILogger<EchoController> logger, | ||
IEchoService echoService | ||
) : ControllerBase | ||
{ | ||
/// <summary> | ||
/// Updates the Flotilla metadata for an Echo tag | ||
/// </summary> | ||
/// <remarks> | ||
/// <para> This query updates the Flotilla metadata for an Echo tag </para> | ||
/// </remarks> | ||
[HttpPost("{tagId}/tag-zoom")] | ||
[Authorize(Roles = Role.Admin)] | ||
[ProducesResponseType(typeof(EchoTagInspectionMetadata), StatusCodes.Status201Created)] | ||
[ProducesResponseType(StatusCodes.Status400BadRequest)] | ||
[ProducesResponseType(StatusCodes.Status401Unauthorized)] | ||
[ProducesResponseType(StatusCodes.Status403Forbidden)] | ||
[ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||
public async Task<ActionResult<EchoTagInspectionMetadata>> Create([FromRoute] string tagId, [FromBody] IsarZoomDescription zoom) | ||
{ | ||
logger.LogInformation($"Updating zoom value for tag with ID {tagId}"); | ||
|
||
var newMetadata = new EchoTagInspectionMetadata | ||
{ | ||
TagId = tagId, | ||
ZoomDescription = zoom | ||
}; | ||
|
||
try | ||
{ | ||
var metadata = await echoService.CreateOrUpdateEchoTagInspectionMetadata(newMetadata); | ||
|
||
return metadata; | ||
} | ||
catch (Exception e) | ||
{ | ||
logger.LogError(e, "Error while creating or updating Echo tag inspection 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
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 EchoTagInspectionMetadata | ||
{ | ||
[Key] | ||
public string TagId { get; set; } | ||
|
||
public IsarZoomDescription? ZoomDescription { get; set; } | ||
Check warning on line 12 in backend/api/Database/Models/EchoTagInspectionMetadata.cs GitHub Actions / build_backend
Check warning on line 12 in backend/api/Database/Models/EchoTagInspectionMetadata.cs GitHub Actions / build_backend
Check failure on line 12 in backend/api/Database/Models/EchoTagInspectionMetadata.cs GitHub Actions / test_backend
|
||
} | ||
} |
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
Oops, something went wrong.