| | | 1 | | using Microsoft.AspNetCore.Http.HttpResults; |
| | | 2 | | using pva.SuperV.Engine.Exceptions; |
| | | 3 | | using pva.SuperV.Model.Projects; |
| | | 4 | | using pva.SuperV.Model.Services; |
| | | 5 | | |
| | | 6 | | namespace pva.SuperV.Api.Routes.Projects |
| | | 7 | | { |
| | | 8 | | internal static class BuildProject |
| | | 9 | | { |
| | | 10 | | internal static async Task<Results<Ok<ProjectModel>, NotFound<string>, BadRequest<string>, InternalServerError<s |
| | 3 | 11 | | { |
| | | 12 | | try |
| | 3 | 13 | | { |
| | 3 | 14 | | ProjectModel createdProject = await projectService.BuildProjectAsync(projectId); |
| | 2 | 15 | | return TypedResults.Ok<ProjectModel>(createdProject); |
| | | 16 | | } |
| | 0 | 17 | | catch (UnknownEntityException e) |
| | 0 | 18 | | { |
| | 0 | 19 | | return TypedResults.NotFound<string>(e.Message); |
| | | 20 | | } |
| | 0 | 21 | | catch (ProjectBuildException e) |
| | 0 | 22 | | { |
| | 0 | 23 | | return TypedResults.InternalServerError<string>(e.Message); |
| | | 24 | | } |
| | 1 | 25 | | catch (SuperVException e) |
| | 1 | 26 | | { |
| | 1 | 27 | | return TypedResults.BadRequest(e.Message); |
| | | 28 | | } |
| | 3 | 29 | | } |
| | | 30 | | } |
| | | 31 | | } |