< 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_18869653307
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)
 13112        {
 13113            RouteGroupBuilder fieldFormattersApi = app.MapGroup("/field-formatters");
 13114            fieldFormattersApi.MapGet("/",
 13115                async (IFieldFormatterService fieldFormatterService)
 116                => await GetFieldFormatterTypes.Handle(fieldFormatterService))
 13117                .WithName("GetFieldFormatterTypes")
 13118                .WithDisplayName("GetFieldFormatterTypes")
 13119                .WithSummary("Gets the list of available field formatter types")
 13120                .WithDescription("Gets the list of available field formatter types")
 13121                .Produces<List<string>>(StatusCodes.Status200OK);
 22
 13123            fieldFormattersApi.MapGet("/{projectId}",
 13124                async (IFieldFormatterService fieldFormatterService,
 13125                [Description("ID of project")] string projectId)
 226                    => await GetFieldFormatters.Handle(fieldFormatterService, projectId))
 13127                .WithName("GetFieldFormatters")
 13128                .WithDisplayName("GetFieldFormatters")
 13129                .WithSummary("Gets the list of field formatters of project")
 13130                .WithDescription("Gets the list of field formatters of project")
 13131                .Produces<List<FieldFormatterModel>>(StatusCodes.Status200OK)
 13132                .Produces<string>(StatusCodes.Status404NotFound);
 33
 13134            fieldFormattersApi.MapPost("/{projectId}/search",
 13135                async (IFieldFormatterService fieldFormatterService,
 13136                [Description("ID of project")] string projectId,
 13137                [FromBody] FieldFormatterPagedSearchRequest search)
 138                => await SearchFieldFormatters.Handle(fieldFormatterService, projectId, search))
 13139                .WithName("SearchFieldFormatterTypes")
 13140                .WithDisplayName("SearchFieldFormatterTypes")
 13141                .WithSummary("Searches the list of available field formatter types")
 13142                .WithDescription("Searches the list of available field formatter types")
 13143                .Produces<PagedSearchResult<FieldFormatterModel>>(StatusCodes.Status200OK);
 44
 13145            fieldFormattersApi.MapGet("/{projectId}/{fieldFormatterName}",
 13146                async (IFieldFormatterService fieldFormatterService,
 13147                [Description("ID of project")] string projectId,
 13148                [Description("Name of field formatter")] string fieldFormatterName)
 249                    => await GetFieldFormatter.Handle(fieldFormatterService, projectId, fieldFormatterName))
 13150                .WithName("GetFieldFormatter")
 13151                .WithDisplayName("GetFieldFormatter")
 13152                .WithSummary("Gets a field formatter of project")
 13153                .WithDescription("Gets a field formatter of project")
 13154                .Produces<FieldFormatterModel>(StatusCodes.Status200OK)
 13155                .Produces<string>(StatusCodes.Status404NotFound)
 13156                .Produces<string>(StatusCodes.Status400BadRequest);
 57
 13158            fieldFormattersApi.MapPost("/{wipProjectId}",
 13159                async (IFieldFormatterService fieldFormatterService, HttpContext context,
 13160                [Description("ID of WIP project")] string wipProjectId,
 13161                [Description("Field formatter creation request")][FromBody] CreateFieldFormatterRequest createRequest)
 562                    => await CreateFieldFormatter.Handle(fieldFormatterService, wipProjectId, createRequest))
 13163                .WithName("CreateFieldFormatter")
 13164                .WithDisplayName("CreateFieldFormatter")
 13165                .WithSummary("Creates a field formatter in a WIP project")
 13166                .WithDescription("Creates a field formatter in a WIP project")
 13167                .Produces<FieldFormatterModel>(StatusCodes.Status201Created)
 13168                .Produces<string>(StatusCodes.Status404NotFound)
 13169                .Produces<string>(StatusCodes.Status400BadRequest);
 70
 13171            fieldFormattersApi.MapPut("/{wipProjectId}/{fieldFormatterName}",
 13172                async (IFieldFormatterService fieldFormatterService, HttpContext context,
 13173                [Description("ID of WIP project")] string wipProjectId,
 13174                [Description("Field formatter name")] string fieldFormatterName,
 13175                [Description("Field formatter update model")][FromBody] FieldFormatterModel fieldFormatterModel)
 376                    => await UpdateFieldFormatter.Handle(fieldFormatterService, wipProjectId, fieldFormatterName, fieldF
 13177                .WithName("UpdateFieldFormatter")
 13178                .WithDisplayName("UpdateFieldFormatter")
 13179                .WithSummary("Updates a field formatter in a WIP project")
 13180                .WithDescription("Updates a field formatter in a WIP project")
 13181                .Produces<FieldFormatterModel>(StatusCodes.Status200OK)
 13182                .Produces<string>(StatusCodes.Status404NotFound)
 13183                .Produces<string>(StatusCodes.Status400BadRequest);
 84
 13185            fieldFormattersApi.MapDelete("/{wipProjectId}/{fieldFormatterName}",
 13186                async (IFieldFormatterService fieldFormatterService,
 13187                [Description("ID of WUP project")] string wipProjectId,
 13188                [Description("Name of field formatter")] string fieldFormatterName)
 389                    => await DeleteFieldFormatter.Handle(fieldFormatterService, wipProjectId, fieldFormatterName))
 13190                .WithName("DeleteFieldFormatter")
 13191                .WithDisplayName("DeleteFieldFormatter")
 13192                .WithSummary("Deletes a field formatter from a WIP project")
 13193                .WithDescription("Deletes a field formatter from a WIP project")
 13194                .Produces(StatusCodes.Status204NoContent)
 13195                .Produces<string>(StatusCodes.Status404NotFound)
 13196                .Produces<string>(StatusCodes.Status400BadRequest);
 97
 13198            return app;
 13199        }
 100    }
 101}