| | | 1 | | using pva.SuperV.Model.HistoryRepositories; |
| | | 2 | | using pva.SuperV.Model.Services; |
| | | 3 | | using System.ComponentModel; |
| | | 4 | | |
| | | 5 | | namespace pva.SuperV.Api.Routes.HistoryRepositories |
| | | 6 | | { |
| | | 7 | | public static class HistoryRepositoryEndpoints |
| | | 8 | | { |
| | | 9 | | public static WebApplication MapHistoryRepositoryEndpoints(this WebApplication app) |
| | 131 | 10 | | { |
| | 131 | 11 | | RouteGroupBuilder historyRepositoriesApi = app.MapGroup("/history-repositories"); |
| | 131 | 12 | | historyRepositoriesApi.MapGet("/{projectId}", |
| | 131 | 13 | | (IHistoryRepositoryService historyRepositoryService, |
| | 131 | 14 | | [Description("ID of project")] string projectId) |
| | 2 | 15 | | => GetHistoryRepositories.Handle(historyRepositoryService, projectId)) |
| | 131 | 16 | | .WithName("GetHistoryRepositories") |
| | 131 | 17 | | .WithDisplayName("GetHistoryRepositories") |
| | 131 | 18 | | .WithSummary("Gets the list of available history respoitories in project") |
| | 131 | 19 | | .WithDescription("Gets the list of available history respoitories in project") |
| | 131 | 20 | | .Produces<List<HistoryRepositoryModel>>(StatusCodes.Status200OK) |
| | 131 | 21 | | .Produces<string>(StatusCodes.Status404NotFound) |
| | 131 | 22 | | .Produces<string>(StatusCodes.Status400BadRequest); |
| | | 23 | | |
| | 131 | 24 | | historyRepositoriesApi.MapGet("/{projectId}/{historyRepositoryName}", |
| | 131 | 25 | | (IHistoryRepositoryService historyRepositoryService, |
| | 131 | 26 | | [Description("ID of project")] string projectId, |
| | 131 | 27 | | [Description("Name of history repository")] string historyRepositoryName) |
| | 2 | 28 | | => GetHistoryRepository.Handle(historyRepositoryService, projectId, historyRepositoryName)) |
| | 131 | 29 | | .WithName("GetHistoryRepository") |
| | 131 | 30 | | .WithDisplayName("GetHistoryRepository") |
| | 131 | 31 | | .WithSummary("Gets a project's history repository by its name") |
| | 131 | 32 | | .WithDescription("Gets a project's history repository by its name") |
| | 131 | 33 | | .Produces<HistoryRepositoryModel>(StatusCodes.Status200OK) |
| | 131 | 34 | | .Produces<string>(StatusCodes.Status404NotFound) |
| | 131 | 35 | | .Produces<string>(StatusCodes.Status400BadRequest); |
| | | 36 | | |
| | 131 | 37 | | historyRepositoriesApi.MapPost("/{wipProjectId}", |
| | 131 | 38 | | (IHistoryRepositoryService historyRepositoryService, |
| | 131 | 39 | | [Description("ID of WIP project")] string wipProjectId, |
| | 131 | 40 | | [Description("History repository create request")] HistoryRepositoryModel historyRepositoryCreateRequest |
| | 4 | 41 | | => CreateHistoryRepository.Handle(historyRepositoryService, wipProjectId, historyRepositoryCreateReq |
| | 131 | 42 | | .WithName("CreateHistoryRepository") |
| | 131 | 43 | | .WithDisplayName("CreateHistoryRepository") |
| | 131 | 44 | | .WithSummary("Creates a history repository in a WIP project") |
| | 131 | 45 | | .WithDescription("Creates a history repository in a WIP project") |
| | 131 | 46 | | .Produces<HistoryRepositoryModel>(StatusCodes.Status201Created) |
| | 131 | 47 | | .Produces<string>(StatusCodes.Status404NotFound) |
| | 131 | 48 | | .Produces<string>(StatusCodes.Status400BadRequest); |
| | | 49 | | |
| | 131 | 50 | | historyRepositoriesApi.MapPut("/{wipProjectId}/{historyRepositoryName}", |
| | 131 | 51 | | (IHistoryRepositoryService historyRepositoryService, |
| | 131 | 52 | | [Description("ID of WIP project")] string wipProjectId, |
| | 131 | 53 | | [Description("Name of history repository")] string historyRepositoryName, |
| | 131 | 54 | | [Description("History repository update request")] HistoryRepositoryModel historyRepositoryUpdateRequest |
| | 3 | 55 | | => UpdateHistoryRepository.Handle(historyRepositoryService, wipProjectId, historyRepositoryName, his |
| | 131 | 56 | | .WithName("UpdateHistoryRepository") |
| | 131 | 57 | | .WithDisplayName("UpdateHistoryRepository") |
| | 131 | 58 | | .WithSummary("Updates a history repository in a WIP project") |
| | 131 | 59 | | .WithDescription("Updates a history repository in a WIP project") |
| | 131 | 60 | | .Produces<HistoryRepositoryModel>(StatusCodes.Status200OK) |
| | 131 | 61 | | .Produces<string>(StatusCodes.Status404NotFound) |
| | 131 | 62 | | .Produces<string>(StatusCodes.Status400BadRequest); |
| | | 63 | | |
| | 131 | 64 | | historyRepositoriesApi.MapDelete("/{wipProjectId}/{historyRepositoryName}", |
| | 131 | 65 | | (IHistoryRepositoryService historyRepositoryService, |
| | 131 | 66 | | [Description("ID of WIP project")] string wipProjectId, |
| | 131 | 67 | | [Description("Name of history repository")] string historyRepositoryName) |
| | 3 | 68 | | => DeleteHistoryRepository.Handle(historyRepositoryService, wipProjectId, historyRepositoryName)) |
| | 131 | 69 | | .WithName("DeleteHistoryRepository") |
| | 131 | 70 | | .WithDisplayName("DeleteHistoryRepository") |
| | 131 | 71 | | .WithSummary("Deletes a history repository from a WIP project by its name") |
| | 131 | 72 | | .WithDescription("Deletes a history repository from a WIP project by its name") |
| | 131 | 73 | | .Produces(StatusCodes.Status204NoContent) |
| | 131 | 74 | | .Produces<string>(StatusCodes.Status404NotFound) |
| | 131 | 75 | | .Produces<string>(StatusCodes.Status400BadRequest); |
| | | 76 | | |
| | 131 | 77 | | return app; |
| | 131 | 78 | | } |
| | | 79 | | } |
| | | 80 | | } |