< Summary - pva.SuperV

Information
Class: pva.SuperV.Api.Routes.FieldFormatters.FieldFormattersEndpoints
Assembly: pva.SuperV.Api
File(s): /home/runner/work/pva.SuperV/pva.SuperV/pva.SuperV.Api/Routes/FieldFormatters/FieldFormattersEndpoints.cs
Tag: dotnet-ubuntu_22190969454
Line coverage
100%
Covered lines: 81
Uncovered lines: 0
Coverable lines: 81
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
MapFieldFormatterEndpoints(...)100%11100%

File(s)

/home/runner/work/pva.SuperV/pva.SuperV/pva.SuperV.Api/Routes/FieldFormatters/FieldFormattersEndpoints.cs

#LineLine coverage
 1using Microsoft.AspNetCore.Mvc;
 2using pva.SuperV.Model;
 3using pva.SuperV.Model.FieldFormatters;
 4using pva.SuperV.Model.Services;
 5using System.ComponentModel;
 6
 7namespace pva.SuperV.Api.Routes.FieldFormatters
 8{
 9    public static class FieldFormattersEndpoints
 10    {
 11        public static WebApplication MapFieldFormatterEndpoints(this WebApplication app)
 14512        {
 14513            RouteGroupBuilder fieldFormattersApi = app.MapGroup("/field-formatters");
 14514            fieldFormattersApi.MapGet("/",
 14515                async (IFieldFormatterService fieldFormatterService)
 116                => await GetFieldFormatterTypes.Handle(fieldFormatterService))
 14517                .WithName("GetFieldFormatterTypes")
 14518                .WithDisplayName("GetFieldFormatterTypes")
 14519                .WithSummary("Gets the list of available field formatter types")
 14520                .WithDescription("Gets the list of available field formatter types")
 14521                .Produces<List<string>>(StatusCodes.Status200OK);
 22
 14523            fieldFormattersApi.MapGet("/{projectId}",
 14524                async (IFieldFormatterService fieldFormatterService,
 14525                [Description("ID of project")] string projectId)
 226                    => await GetFieldFormatters.Handle(fieldFormatterService, projectId))
 14527                .WithName("GetFieldFormatters")
 14528                .WithDisplayName("GetFieldFormatters")
 14529                .WithSummary("Gets the list of field formatters of project")
 14530                .WithDescription("Gets the list of field formatters of project")
 14531                .Produces<List<FieldFormatterModel>>(StatusCodes.Status200OK)
 14532                .Produces<string>(StatusCodes.Status404NotFound);
 33
 14534            fieldFormattersApi.MapPost("/{projectId}/search",
 14535                async (IFieldFormatterService fieldFormatterService,
 14536                [Description("ID of project")] string projectId,
 14537                [FromBody] FieldFormatterPagedSearchRequest search)
 138                => await SearchFieldFormatters.Handle(fieldFormatterService, projectId, search))
 14539                .WithName("SearchFieldFormatterTypes")
 14540                .WithDisplayName("SearchFieldFormatterTypes")
 14541                .WithSummary("Searches the list of available field formatter types")
 14542                .WithDescription("Searches the list of available field formatter types")
 14543                .Produces<PagedSearchResult<FieldFormatterModel>>(StatusCodes.Status200OK);
 44
 14545            fieldFormattersApi.MapGet("/{projectId}/{fieldFormatterName}",
 14546                async (IFieldFormatterService fieldFormatterService,
 14547                [Description("ID of project")] string projectId,
 14548                [Description("Name of field formatter")] string fieldFormatterName)
 249                    => await GetFieldFormatter.Handle(fieldFormatterService, projectId, fieldFormatterName))
 14550                .WithName("GetFieldFormatter")
 14551                .WithDisplayName("GetFieldFormatter")
 14552                .WithSummary("Gets a field formatter of project")
 14553                .WithDescription("Gets a field formatter of project")
 14554                .Produces<FieldFormatterModel>(StatusCodes.Status200OK)
 14555                .Produces<string>(StatusCodes.Status404NotFound)
 14556                .Produces<string>(StatusCodes.Status400BadRequest);
 57
 14558            fieldFormattersApi.MapPost("/{wipProjectId}",
 14559                async (IFieldFormatterService fieldFormatterService, HttpContext _,
 14560                [Description("ID of WIP project")] string wipProjectId,
 14561                [Description("Field formatter creation request")][FromBody] CreateFieldFormatterRequest createRequest)
 562                    => await CreateFieldFormatter.Handle(fieldFormatterService, wipProjectId, createRequest))
 14563                .WithName("CreateFieldFormatter")
 14564                .WithDisplayName("CreateFieldFormatter")
 14565                .WithSummary("Creates a field formatter in a WIP project")
 14566                .WithDescription("Creates a field formatter in a WIP project")
 14567                .Produces<FieldFormatterModel>(StatusCodes.Status201Created)
 14568                .Produces<string>(StatusCodes.Status404NotFound)
 14569                .Produces<string>(StatusCodes.Status400BadRequest);
 70
 14571            fieldFormattersApi.MapPut("/{wipProjectId}/{fieldFormatterName}",
 14572                async (IFieldFormatterService fieldFormatterService, HttpContext _,
 14573                [Description("ID of WIP project")] string wipProjectId,
 14574                [Description("Field formatter name")] string fieldFormatterName,
 14575                [Description("Field formatter update model")][FromBody] FieldFormatterModel fieldFormatterModel)
 376                    => await UpdateFieldFormatter.Handle(fieldFormatterService, wipProjectId, fieldFormatterName, fieldF
 14577                .WithName("UpdateFieldFormatter")
 14578                .WithDisplayName("UpdateFieldFormatter")
 14579                .WithSummary("Updates a field formatter in a WIP project")
 14580                .WithDescription("Updates a field formatter in a WIP project")
 14581                .Produces<FieldFormatterModel>(StatusCodes.Status200OK)
 14582                .Produces<string>(StatusCodes.Status404NotFound)
 14583                .Produces<string>(StatusCodes.Status400BadRequest);
 84
 14585            fieldFormattersApi.MapDelete("/{wipProjectId}/{fieldFormatterName}",
 14586                async (IFieldFormatterService fieldFormatterService,
 14587                [Description("ID of WUP project")] string wipProjectId,
 14588                [Description("Name of field formatter")] string fieldFormatterName)
 389                    => await DeleteFieldFormatter.Handle(fieldFormatterService, wipProjectId, fieldFormatterName))
 14590                .WithName("DeleteFieldFormatter")
 14591                .WithDisplayName("DeleteFieldFormatter")
 14592                .WithSummary("Deletes a field formatter from a WIP project")
 14593                .WithDescription("Deletes a field formatter from a WIP project")
 14594                .Produces(StatusCodes.Status204NoContent)
 14595                .Produces<string>(StatusCodes.Status404NotFound)
 14596                .Produces<string>(StatusCodes.Status400BadRequest);
 97
 14598            return app;
 14599        }
 100    }
 101}