< 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_22190969454
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)
 14512        {
 14513            RouteGroupBuilder fieldDefinitionsApi = app.MapGroup("/fields");
 14514            fieldDefinitionsApi.MapGet("/{projectId}/{className}",
 14515                async (IFieldDefinitionService fieldDefinitionService,
 14516                [Description("ID of project")] string projectId,
 14517                [Description("Name of class")] string className)
 318                    => await GetFieldDefinitions.Handle(fieldDefinitionService, projectId, className))
 14519                .WithName("GetFieldDefinitions")
 14520                .WithDisplayName("GetFieldDefinitions")
 14521                .WithSummary("Gets the list of available fields in a class from a project")
 14522                .WithDescription("Gets the list of available fields in a class from a project")
 14523                .Produces<List<FieldDefinitionModel>>(StatusCodes.Status200OK)
 14524                .Produces<string>(StatusCodes.Status404NotFound)
 14525                .Produces<string>(StatusCodes.Status400BadRequest);
 26
 14527            fieldDefinitionsApi.MapPost("/{projectId}/{className}/search",
 14528                async (IFieldDefinitionService fieldDefinitionService,
 14529                [Description("ID of project")] string projectId,
 14530                [Description("Name of class")] string className,
 14531                [FromBody] FieldDefinitionPagedSearchRequest search)
 232                    => await SearchFieldDefinitions.Handle(fieldDefinitionService, projectId, className, search))
 14533                .WithName("SearchFieldDefinitions")
 14534                .WithDisplayName("SearchFieldDefinitions")
 14535                .WithSummary("Searches the list of available fields in a class from a project")
 14536                .WithDescription("Searches the list of available fields in a class from a project")
 14537                .Produces<PagedSearchResult<FieldDefinitionModel>>(StatusCodes.Status200OK)
 14538                .Produces<string>(StatusCodes.Status404NotFound)
 14539                .Produces<string>(StatusCodes.Status400BadRequest);
 40
 14541            fieldDefinitionsApi.MapGet("/{projectId}/{className}/{fieldName}",
 14542                async (IFieldDefinitionService fieldDefinitionService,
 14543                [Description("ID of project")] string projectId,
 14544                [Description("Name of class")] string className,
 14545                [Description("Name of field")] string fieldName)
 1346                    => await GetFieldDefinition.Handle(fieldDefinitionService, projectId, className, fieldName))
 14547                .WithName("GetFieldDefinition")
 14548                .WithDisplayName("GetFieldDefinition")
 14549                .WithSummary("Gets a field definition from a class of a project by its name")
 14550                .WithDescription("Gets a field definitionfrom a class of a project by its name")
 14551                .Produces<FieldDefinitionModel>(StatusCodes.Status200OK)
 14552                .Produces<string>(StatusCodes.Status404NotFound)
 14553                .Produces<string>(StatusCodes.Status400BadRequest);
 54
 14555            fieldDefinitionsApi.MapPost("/{wipProjectId}/{className}",
 14556                async (IFieldDefinitionService fieldDefinitionService,
 14557                [Description("ID of WIP project")] string wipProjectId,
 14558                [Description("Name of class")] string className,
 14559                [Description("Field creation requests")][FromBody] List<FieldDefinitionModel> createRequests)
 660                    => await CreateFieldDefinitions.Handle(fieldDefinitionService, wipProjectId, className, createReques
 14561                .WithName("CreateFieldDefinitions")
 14562                .WithDisplayName("CreateFieldDefinitions")
 14563                .WithSummary("Creates field definitions in a class of a WIP project")
 14564                .WithDescription("Creates field definitions in a class of a WIP project")
 14565                .Produces<List<FieldDefinitionModel>>(StatusCodes.Status201Created)
 14566                .Produces<string>(StatusCodes.Status404NotFound)
 14567                .Produces<string>(StatusCodes.Status400BadRequest);
 68
 14569            fieldDefinitionsApi.MapPut("/{wipProjectId}/{className}/{fieldName}",
 14570                async (IFieldDefinitionService fieldDefinitionService,
 14571                [Description("ID of WIP project")] string wipProjectId,
 14572                [Description("Name of class")] string className,
 14573                [Description("Name of class")] string fieldName,
 14574                [Description("Field update request")][FromBody] FieldDefinitionModel updateRequest)
 375                    => await UpdateFieldDefinition.Handle(fieldDefinitionService, wipProjectId, className, fieldName, up
 14576                .WithName("UpdateFieldDefinition")
 14577                .WithDisplayName("UpdateFieldDefinition")
 14578                .WithSummary("Updates field definition in a class of a WIP project")
 14579                .WithDescription("Uodates field definition in a class of a WIP project")
 14580                .Produces<List<FieldDefinitionModel>>(StatusCodes.Status200OK)
 14581                .Produces<string>(StatusCodes.Status404NotFound)
 14582                .Produces<string>(StatusCodes.Status400BadRequest);
 83
 14584            fieldDefinitionsApi.MapDelete("/{wipProjectId}/{className}/{fieldName}",
 14585                async (IFieldDefinitionService fieldDefinitionService,
 14586                [Description("ID of WIP project")] string wipProjectId,
 14587                [Description("Name of class")] string className,
 14588                [Description("Name of field")] string fieldName)
 389                    => await DeleteFieldDefinition.Handle(fieldDefinitionService, wipProjectId, className, fieldName))
 14590                .WithName("DeleteFieldDefinition")
 14591                .WithDisplayName("DeleteFieldDefinition")
 14592                .WithSummary("Deletes a field definition from a class of a WIP project by its name")
 14593                .WithDescription("Deletes a field definition from a class of a WIP project by its name")
 14594                .Produces(StatusCodes.Status204NoContent)
 14595                .Produces<string>(StatusCodes.Status404NotFound)
 14596                .Produces<string>(StatusCodes.Status400BadRequest);
 97
 14598            return app;
 14599        }
 100    }
 101}