< Summary - pva.SuperV

Information
Class: pva.SuperV.Api.Routes.FieldDefinitions.FieldDefinitionEndpoints
Assembly: pva.SuperV.Api
File(s): /home/runner/work/pva.SuperV/pva.SuperV/pva.SuperV.Api/Routes/FieldDefinitions/FieldDefinitionEndpoints.cs
Tag: dotnet-ubuntu_18869653307
Line coverage
100%
Covered lines: 82
Uncovered lines: 0
Coverable lines: 82
Total lines: 101
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
MapFieldDefinitionEndpoints(...)100%11100%

File(s)

/home/runner/work/pva.SuperV/pva.SuperV/pva.SuperV.Api/Routes/FieldDefinitions/FieldDefinitionEndpoints.cs

#LineLine coverage
 1using Microsoft.AspNetCore.Mvc;
 2using pva.SuperV.Model;
 3using pva.SuperV.Model.FieldDefinitions;
 4using pva.SuperV.Model.Services;
 5using System.ComponentModel;
 6
 7namespace pva.SuperV.Api.Routes.FieldDefinitions
 8{
 9    public static class FieldDefinitionEndpoints
 10    {
 11        public static WebApplication MapFieldDefinitionEndpoints(this WebApplication app)
 13112        {
 13113            RouteGroupBuilder fieldDefinitionsApi = app.MapGroup("/fields");
 13114            fieldDefinitionsApi.MapGet("/{projectId}/{className}",
 13115                async (IFieldDefinitionService fieldDefinitionService,
 13116                [Description("ID of project")] string projectId,
 13117                [Description("Name of class")] string className)
 218                    => await GetFieldDefinitions.Handle(fieldDefinitionService, projectId, className))
 13119                .WithName("GetFieldDefinitions")
 13120                .WithDisplayName("GetFieldDefinitions")
 13121                .WithSummary("Gets the list of available fields in a class from a project")
 13122                .WithDescription("Gets the list of available fields in a class from a project")
 13123                .Produces<List<FieldDefinitionModel>>(StatusCodes.Status200OK)
 13124                .Produces<string>(StatusCodes.Status404NotFound)
 13125                .Produces<string>(StatusCodes.Status400BadRequest);
 26
 13127            fieldDefinitionsApi.MapPost("/{projectId}/{className}/search",
 13128                async (IFieldDefinitionService fieldDefinitionService,
 13129                [Description("ID of project")] string projectId,
 13130                [Description("Name of class")] string className,
 13131                [FromBody] FieldDefinitionPagedSearchRequest search)
 132                    => await SearchFieldDefinitions.Handle(fieldDefinitionService, projectId, className, search))
 13133                .WithName("SearchFieldDefinitions")
 13134                .WithDisplayName("SearchFieldDefinitions")
 13135                .WithSummary("Searches the list of available fields in a class from a project")
 13136                .WithDescription("Searches the list of available fields in a class from a project")
 13137                .Produces<PagedSearchResult<FieldDefinitionModel>>(StatusCodes.Status200OK)
 13138                .Produces<string>(StatusCodes.Status404NotFound)
 13139                .Produces<string>(StatusCodes.Status400BadRequest);
 40
 13141            fieldDefinitionsApi.MapGet("/{projectId}/{className}/{fieldName}",
 13142                async (IFieldDefinitionService fieldDefinitionService,
 13143                [Description("ID of project")] string projectId,
 13144                [Description("Name of class")] string className,
 13145                [Description("Name of field")] string fieldName)
 1346                    => await GetFieldDefinition.Handle(fieldDefinitionService, projectId, className, fieldName))
 13147                .WithName("GetFieldDefinition")
 13148                .WithDisplayName("GetFieldDefinition")
 13149                .WithSummary("Gets a field definition from a class of a project by its name")
 13150                .WithDescription("Gets a field definitionfrom a class of a project by its name")
 13151                .Produces<FieldDefinitionModel>(StatusCodes.Status200OK)
 13152                .Produces<string>(StatusCodes.Status404NotFound)
 13153                .Produces<string>(StatusCodes.Status400BadRequest);
 54
 13155            fieldDefinitionsApi.MapPost("/{wipProjectId}/{className}",
 13156                async (IFieldDefinitionService fieldDefinitionService,
 13157                [Description("ID of WIP project")] string wipProjectId,
 13158                [Description("Name of class")] string className,
 13159                [Description("Field creation requests")][FromBody] List<FieldDefinitionModel> createRequests)
 660                    => await CreateFieldDefinitions.Handle(fieldDefinitionService, wipProjectId, className, createReques
 13161                .WithName("CreateFieldDefinitions")
 13162                .WithDisplayName("CreateFieldDefinitions")
 13163                .WithSummary("Creates field definitions in a class of a WIP project")
 13164                .WithDescription("Creates field definitions in a class of a WIP project")
 13165                .Produces<List<FieldDefinitionModel>>(StatusCodes.Status201Created)
 13166                .Produces<string>(StatusCodes.Status404NotFound)
 13167                .Produces<string>(StatusCodes.Status400BadRequest);
 68
 13169            fieldDefinitionsApi.MapPut("/{wipProjectId}/{className}/{fieldName}",
 13170                async (IFieldDefinitionService fieldDefinitionService,
 13171                [Description("ID of WIP project")] string wipProjectId,
 13172                [Description("Name of class")] string className,
 13173                [Description("Name of class")] string fieldName,
 13174                [Description("Field update request")][FromBody] FieldDefinitionModel updateRequest)
 375                    => await UpdateFieldDefinition.Handle(fieldDefinitionService, wipProjectId, className, fieldName, up
 13176                .WithName("UpdateFieldDefinition")
 13177                .WithDisplayName("UpdateFieldDefinition")
 13178                .WithSummary("Updates field definition in a class of a WIP project")
 13179                .WithDescription("Uodates field definition in a class of a WIP project")
 13180                .Produces<List<FieldDefinitionModel>>(StatusCodes.Status200OK)
 13181                .Produces<string>(StatusCodes.Status404NotFound)
 13182                .Produces<string>(StatusCodes.Status400BadRequest);
 83
 13184            fieldDefinitionsApi.MapDelete("/{wipProjectId}/{className}/{fieldName}",
 13185                async (IFieldDefinitionService fieldDefinitionService,
 13186                [Description("ID of WIP project")] string wipProjectId,
 13187                [Description("Name of class")] string className,
 13188                [Description("Name of field")] string fieldName)
 389                    => await DeleteFieldDefinition.Handle(fieldDefinitionService, wipProjectId, className, fieldName))
 13190                .WithName("DeleteFieldDefinition")
 13191                .WithDisplayName("DeleteFieldDefinition")
 13192                .WithSummary("Deletes a field definition from a class of a WIP project by its name")
 13193                .WithDescription("Deletes a field definition from a class of a WIP project by its name")
 13194                .Produces(StatusCodes.Status204NoContent)
 13195                .Produces<string>(StatusCodes.Status404NotFound)
 13196                .Produces<string>(StatusCodes.Status400BadRequest);
 97
 13198            return app;
 13199        }
 100    }
 101}