| | | 1 | | using Microsoft.AspNetCore.Http.HttpResults; |
| | | 2 | | using pva.SuperV.Engine.Exceptions; |
| | | 3 | | using pva.SuperV.Model; |
| | | 4 | | using pva.SuperV.Model.FieldDefinitions; |
| | | 5 | | using pva.SuperV.Model.Services; |
| | | 6 | | |
| | | 7 | | namespace pva.SuperV.Api.Routes.FieldDefinitions |
| | | 8 | | { |
| | | 9 | | internal static class SearchFieldDefinitions |
| | | 10 | | { |
| | | 11 | | internal static async Task<Results<Ok<PagedSearchResult<FieldDefinitionModel>>, NotFound<string>, BadRequest<str |
| | | 12 | | Handle(IFieldDefinitionService fieldDefinitionService, string projectId, string className, FieldDefinitionPa |
| | 1 | 13 | | { |
| | | 14 | | try |
| | 1 | 15 | | { |
| | 1 | 16 | | return TypedResults.Ok(await fieldDefinitionService.SearchFieldsAsync(projectId, className, search)); |
| | | 17 | | } |
| | 0 | 18 | | catch (UnknownEntityException e) |
| | 0 | 19 | | { |
| | 0 | 20 | | return TypedResults.NotFound(e.Message); |
| | | 21 | | } |
| | 0 | 22 | | catch (SuperVException e) |
| | 0 | 23 | | { |
| | 0 | 24 | | return TypedResults.BadRequest(e.Message); |
| | | 25 | | } |
| | 1 | 26 | | } |
| | | 27 | | } |
| | | 28 | | } |