| | | 1 | | using Microsoft.AspNetCore.Http.HttpResults; |
| | | 2 | | using pva.SuperV.Engine.Exceptions; |
| | | 3 | | using pva.SuperV.Model.FieldProcessings; |
| | | 4 | | using pva.SuperV.Model.Services; |
| | | 5 | | |
| | | 6 | | namespace pva.SuperV.Api.Routes.FieldProcessings |
| | | 7 | | { |
| | | 8 | | internal static class GetProcessings |
| | | 9 | | { |
| | | 10 | | internal static async Task<Results<Ok<List<FieldValueProcessingModel>>, NotFound<string>, BadRequest<string>>> |
| | | 11 | | Handle(IFieldProcessingService fieldProcessingService, string projectId, string className, string fieldName) |
| | 2 | 12 | | { |
| | | 13 | | try |
| | 2 | 14 | | { |
| | 2 | 15 | | return TypedResults.Ok(await fieldProcessingService.GetFieldProcessingsAsync(projectId, className, field |
| | | 16 | | } |
| | 1 | 17 | | catch (UnknownEntityException e) |
| | 1 | 18 | | { |
| | 1 | 19 | | return TypedResults.NotFound(e.Message); |
| | | 20 | | } |
| | 0 | 21 | | catch (SuperVException e) |
| | 0 | 22 | | { |
| | 0 | 23 | | return TypedResults.BadRequest(e.Message); |
| | | 24 | | } |
| | 2 | 25 | | } |
| | | 26 | | } |
| | | 27 | | } |