< 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_18869653307
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)
 13112        {
 13113            RouteGroupBuilder classesApi = app.MapGroup("/classes");
 13114            classesApi.MapGet("/{projectId}",
 13115                async (IClassService classService,
 13116                [Description("ID of project")] string projectId)
 217                    => await GetClasses.Handle(classService, projectId))
 13118                .WithName("GetClasses")
 13119                .WithDisplayName("GetClasses")
 13120                .WithSummary("Gets the list of available classes in a project")
 13121                .WithDescription("Gets the list of available classes in a project")
 13122                .Produces<List<ClassModel>>(StatusCodes.Status200OK)
 13123                .Produces<string>(StatusCodes.Status404NotFound)
 13124                .Produces<string>(StatusCodes.Status400BadRequest);
 25
 13126            classesApi.MapPost("/{projectId}/search",
 13127                async (IClassService classService,
 13128                [Description("ID of project")] string projectId,
 13129                [FromBody] ClassPagedSearchRequest search)
 130                    => await SearchClasses.Handle(classService, projectId, search))
 13131                .WithName("SearchClasses")
 13132                .WithDisplayName("SearchClasses")
 13133                .WithSummary("Searches the list of available classes in a project")
 13134                .WithDescription("Searches the list of available classes in a project")
 13135                .Produces<PagedSearchResult<ClassModel>>(StatusCodes.Status200OK)
 13136                .Produces<string>(StatusCodes.Status404NotFound)
 13137                .Produces<string>(StatusCodes.Status400BadRequest);
 38
 13139            classesApi.MapGet("/{projectId}/{className}",
 13140                async (IClassService classService,
 13141                [Description("ID of project")] string projectId,
 13142                [Description("Name of class")] string className)
 243                    => await GetClass.Handle(classService, projectId, className))
 13144                .WithName("GetClass")
 13145                .WithDisplayName("GetClass")
 13146                .WithSummary("Gets a class of a project by its name")
 13147                .WithDescription("Gets a class of a project by its name")
 13148                .Produces<ClassModel>(StatusCodes.Status200OK)
 13149                .Produces<string>(StatusCodes.Status404NotFound)
 13150                .Produces<string>(StatusCodes.Status400BadRequest);
 51
 13152            classesApi.MapPost("/{wipProjectId}",
 13153                async (IClassService classService,
 13154                [Description("ID of WIP project")] string wipProjectId,
 13155                [Description("Class creation request")][FromBody] ClassModel createRequest)
 656                    => await CreateClass.Handle(classService, wipProjectId, createRequest))
 13157                .WithName("CreateClass")
 13158                .WithDisplayName("CreateClass")
 13159                .WithSummary("Creates a class in a WIP project")
 13160                .WithDescription("Creates a class in a WIP project")
 13161                .Produces<ClassModel>(StatusCodes.Status201Created)
 13162                .Produces<string>(StatusCodes.Status404NotFound)
 13163                .Produces<string>(StatusCodes.Status400BadRequest);
 64
 13165            classesApi.MapPut("/{wipProjectId}/{className}",
 13166                async (IClassService classService,
 13167                [Description("ID of WIP project")] string wipProjectId,
 13168                [Description("Name of class to be updated")] string className,
 13169                [Description("Class update request")][FromBody] ClassModel createRequest)
 370                    => await UpdateClass.Handle(classService, wipProjectId, className, createRequest))
 13171                .WithName("UpdateClass")
 13172                .WithDisplayName("UpdateClass")
 13173                .WithSummary("Updates a class in a WIP project")
 13174                .WithDescription("Updates a class in a WIP project")
 13175                .Produces<ClassModel>(StatusCodes.Status200OK)
 13176                .Produces<string>(StatusCodes.Status404NotFound)
 13177                .Produces<string>(StatusCodes.Status400BadRequest);
 78
 13179            classesApi.MapDelete("/{wipProjectId}/{className}",
 13180                async (IClassService classService,
 13181                [Description("ID of WIP project")] string wipProjectId,
 13182                [Description("Name of class")] string className)
 383                    => await DeleteClass.Handle(classService, wipProjectId, className))
 13184                .WithName("DeleteClass")
 13185                .WithDisplayName("DeleteClass")
 13186                .WithSummary("Deletes a class of a project by its name")
 13187                .WithDescription("Deletes a class of a WIP project by its name")
 13188                .Produces(StatusCodes.Status204NoContent)
 13189                .Produces<string>(StatusCodes.Status404NotFound)
 13190                .Produces<string>(StatusCodes.Status400BadRequest);
 91
 13192            return app;
 13193        }
 94    }
 95}