< Summary - pva.SuperV

Information
Class: pva.SuperV.Api.Routes.Classes.ClassEndpoints
Assembly: pva.SuperV.Api
File(s): /home/runner/work/pva.SuperV/pva.SuperV/pva.SuperV.Api/Routes/Classes/ClassEndpoints.cs
Tag: dotnet-ubuntu_22190969454
Line coverage
100%
Covered lines: 76
Uncovered lines: 0
Coverable lines: 76
Total lines: 95
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
MapClassEndpoints(...)100%11100%

File(s)

/home/runner/work/pva.SuperV/pva.SuperV/pva.SuperV.Api/Routes/Classes/ClassEndpoints.cs

#LineLine coverage
 1using Microsoft.AspNetCore.Mvc;
 2using pva.SuperV.Model;
 3using pva.SuperV.Model.Classes;
 4using pva.SuperV.Model.Services;
 5using System.ComponentModel;
 6
 7namespace pva.SuperV.Api.Routes.Classes
 8{
 9    public static class ClassEndpoints
 10    {
 11        public static WebApplication MapClassEndpoints(this WebApplication app)
 14512        {
 14513            RouteGroupBuilder classesApi = app.MapGroup("/classes");
 14514            classesApi.MapGet("/{projectId}",
 14515                async (IClassService classService,
 14516                [Description("ID of project")] string projectId)
 317                    => await GetClasses.Handle(classService, projectId))
 14518                .WithName("GetClasses")
 14519                .WithDisplayName("GetClasses")
 14520                .WithSummary("Gets the list of available classes in a project")
 14521                .WithDescription("Gets the list of available classes in a project")
 14522                .Produces<List<ClassModel>>(StatusCodes.Status200OK)
 14523                .Produces<string>(StatusCodes.Status404NotFound)
 14524                .Produces<string>(StatusCodes.Status400BadRequest);
 25
 14526            classesApi.MapPost("/{projectId}/search",
 14527                async (IClassService classService,
 14528                [Description("ID of project")] string projectId,
 14529                [FromBody] ClassPagedSearchRequest search)
 330                    => await SearchClasses.Handle(classService, projectId, search))
 14531                .WithName("SearchClasses")
 14532                .WithDisplayName("SearchClasses")
 14533                .WithSummary("Searches the list of available classes in a project")
 14534                .WithDescription("Searches the list of available classes in a project")
 14535                .Produces<PagedSearchResult<ClassModel>>(StatusCodes.Status200OK)
 14536                .Produces<string>(StatusCodes.Status404NotFound)
 14537                .Produces<string>(StatusCodes.Status400BadRequest);
 38
 14539            classesApi.MapGet("/{projectId}/{className}",
 14540                async (IClassService classService,
 14541                [Description("ID of project")] string projectId,
 14542                [Description("Name of class")] string className)
 243                    => await GetClass.Handle(classService, projectId, className))
 14544                .WithName("GetClass")
 14545                .WithDisplayName("GetClass")
 14546                .WithSummary("Gets a class of a project by its name")
 14547                .WithDescription("Gets a class of a project by its name")
 14548                .Produces<ClassModel>(StatusCodes.Status200OK)
 14549                .Produces<string>(StatusCodes.Status404NotFound)
 14550                .Produces<string>(StatusCodes.Status400BadRequest);
 51
 14552            classesApi.MapPost("/{wipProjectId}",
 14553                async (IClassService classService,
 14554                [Description("ID of WIP project")] string wipProjectId,
 14555                [Description("Class creation request")][FromBody] ClassModel createRequest)
 656                    => await CreateClass.Handle(classService, wipProjectId, createRequest))
 14557                .WithName("CreateClass")
 14558                .WithDisplayName("CreateClass")
 14559                .WithSummary("Creates a class in a WIP project")
 14560                .WithDescription("Creates a class in a WIP project")
 14561                .Produces<ClassModel>(StatusCodes.Status201Created)
 14562                .Produces<string>(StatusCodes.Status404NotFound)
 14563                .Produces<string>(StatusCodes.Status400BadRequest);
 64
 14565            classesApi.MapPut("/{wipProjectId}/{className}",
 14566                async (IClassService classService,
 14567                [Description("ID of WIP project")] string wipProjectId,
 14568                [Description("Name of class to be updated")] string className,
 14569                [Description("Class update request")][FromBody] ClassModel createRequest)
 370                    => await UpdateClass.Handle(classService, wipProjectId, className, createRequest))
 14571                .WithName("UpdateClass")
 14572                .WithDisplayName("UpdateClass")
 14573                .WithSummary("Updates a class in a WIP project")
 14574                .WithDescription("Updates a class in a WIP project")
 14575                .Produces<ClassModel>(StatusCodes.Status200OK)
 14576                .Produces<string>(StatusCodes.Status404NotFound)
 14577                .Produces<string>(StatusCodes.Status400BadRequest);
 78
 14579            classesApi.MapDelete("/{wipProjectId}/{className}",
 14580                async (IClassService classService,
 14581                [Description("ID of WIP project")] string wipProjectId,
 14582                [Description("Name of class")] string className)
 383                    => await DeleteClass.Handle(classService, wipProjectId, className))
 14584                .WithName("DeleteClass")
 14585                .WithDisplayName("DeleteClass")
 14586                .WithSummary("Deletes a class of a project by its name")
 14587                .WithDescription("Deletes a class of a WIP project by its name")
 14588                .Produces(StatusCodes.Status204NoContent)
 14589                .Produces<string>(StatusCodes.Status404NotFound)
 14590                .Produces<string>(StatusCodes.Status400BadRequest);
 91
 14592            return app;
 14593        }
 94    }
 95}