< Summary - pva.SuperV

Information
Class: pva.SuperV.Api.Routes.Scripts.ScriptEndpoints
Assembly: pva.SuperV.Api
File(s): /home/runner/work/pva.SuperV/pva.SuperV/pva.SuperV.Api/Routes/Scripts/ScriptEndpoints.cs
Tag: dotnet-ubuntu_22190969454
Line coverage
100%
Covered lines: 64
Uncovered lines: 0
Coverable lines: 64
Total lines: 81
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
MapScriptEndpoints(...)100%11100%

File(s)

/home/runner/work/pva.SuperV/pva.SuperV/pva.SuperV.Api/Routes/Scripts/ScriptEndpoints.cs

#LineLine coverage
 1using Microsoft.AspNetCore.Mvc;
 2using pva.SuperV.Model.FieldProcessings;
 3using pva.SuperV.Model.Services;
 4using System.ComponentModel;
 5
 6namespace pva.SuperV.Api.Routes.Scripts
 7{
 8    public static class ScriptEndpoints
 9    {
 10        public static WebApplication MapScriptEndpoints(this WebApplication app)
 14511        {
 14512            RouteGroupBuilder scriptsApi = app.MapGroup("/scripts");
 14513            scriptsApi.MapGet("/{projectId}",
 14514                async (IScriptService scriptService,
 14515                [Description("ID of project")] string projectId)
 216                    => await GetScripts.Handle(scriptService, projectId))
 14517                .WithName("GetScripts")
 14518                .WithDisplayName("GetScripts")
 14519                .WithSummary("Gets the list of available scripts from a project")
 14520                .WithDescription("Gets the list of scripts from a project")
 14521                .Produces<List<ScriptDefinitionModel>>(StatusCodes.Status200OK)
 14522                .Produces<string>(StatusCodes.Status404NotFound)
 14523                .Produces<string>(StatusCodes.Status400BadRequest);
 24
 14525            scriptsApi.MapGet("/{projectId}/{scriptName}",
 14526                async (IScriptService scriptService,
 14527                [Description("ID of project")] string projectId,
 14528                [Description("Name of processing")] string scriptName)
 229                    => await GetScript.Handle(scriptService, projectId, scriptName))
 14530                .WithName("GetScript")
 14531                .WithDisplayName("GetScript")
 14532                .WithSummary("Gets a field processing from a class of a project by its name")
 14533                .WithDescription("Gets a field processing from a class of a project by its name")
 14534                .Produces<ScriptDefinitionModel>(StatusCodes.Status200OK)
 14535                .Produces<string>(StatusCodes.Status404NotFound)
 14536                .Produces<string>(StatusCodes.Status400BadRequest);
 37
 14538            scriptsApi.MapPut("/{wipProjectId}/{scriptName}",
 14539                async (IScriptService scriptService,
 14540                [Description("ID of WIP project")] string wipProjectId,
 14541                [Description("Name of field processing")] string scriptName,
 14542                [Description("Field processing update request")][FromBody] ScriptDefinitionModel createRequest)
 343                    => await UpdateScript.Handle(scriptService, wipProjectId, scriptName, createRequest))
 14544                .WithName("UpdateScript")
 14545                .WithDisplayName("UpdateScript")
 14546                .WithSummary("Updates a field processing in a class of a WIP project")
 14547                .WithDescription("Updates a field processing in a class of a WIP project")
 14548                .Produces<ScriptDefinitionModel>(StatusCodes.Status200OK)
 14549                .Produces<string>(StatusCodes.Status404NotFound)
 14550                .Produces<string>(StatusCodes.Status400BadRequest);
 51
 14552            scriptsApi.MapPost("/{wipProjectId}",
 14553                async (IScriptService scriptService,
 14554                [Description("ID of WIP project")] string wipProjectId,
 14555                [Description("Script creation request")][FromBody] ScriptDefinitionModel createRequest)
 356                    => await CreateScript.Handle(scriptService, wipProjectId, createRequest))
 14557                .WithName("CreateScript")
 14558                .WithDisplayName("CreateScript")
 14559                .WithSummary("Creates a script in a WIP project")
 14560                .WithDescription("Creates a script in a WIP project")
 14561                .Produces<ScriptDefinitionModel>(StatusCodes.Status201Created)
 14562                .Produces<string>(StatusCodes.Status404NotFound)
 14563                .Produces<string>(StatusCodes.Status400BadRequest);
 64
 14565            scriptsApi.MapDelete("/{wipProjectId}/{scriptName}",
 14566                async (IScriptService scriptService,
 14567                [Description("ID of WIP project")] string wipProjectId,
 14568                [Description("Name of script")] string scriptName)
 369                    => await DeleteScript.Handle(scriptService, wipProjectId, scriptName))
 14570                .WithName("DeleteScript")
 14571                .WithDisplayName("DeleteScript")
 14572                .WithSummary("Deletes a script from a WIP project by its name")
 14573                .WithDescription("Deletes a script from a WIP project by its name")
 14574                .Produces(StatusCodes.Status204NoContent)
 14575                .Produces<string>(StatusCodes.Status404NotFound)
 14576                .Produces<string>(StatusCodes.Status400BadRequest);
 77
 14578            return app;
 14579        }
 80    }
 81}