| | | 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 CreateProcessing |
| | | 9 | | { |
| | | 10 | | internal static async Task<Results<Created<FieldValueProcessingModel>, NotFound<string>, BadRequest<string>>> |
| | | 11 | | Handle(IFieldProcessingService fieldProcessingService, string projectId, string className, string fieldName, |
| | 6 | 12 | | { |
| | | 13 | | try |
| | 6 | 14 | | { |
| | 6 | 15 | | FieldValueProcessingModel createdFieldProcessing = await fieldProcessingService.CreateFieldProcessingAsy |
| | 4 | 16 | | return TypedResults.Created<FieldValueProcessingModel>($"//field-processings/{projectId}/{className}/{fi |
| | | 17 | | } |
| | 1 | 18 | | catch (UnknownEntityException e) |
| | 1 | 19 | | { |
| | 1 | 20 | | return TypedResults.NotFound(e.Message); |
| | | 21 | | } |
| | 1 | 22 | | catch (SuperVException e) |
| | 1 | 23 | | { |
| | 1 | 24 | | return TypedResults.BadRequest(e.Message); |
| | | 25 | | } |
| | 6 | 26 | | } |
| | | 27 | | } |
| | | 28 | | } |