| | | 1 | | using pva.SuperV.Api.Mappers; |
| | | 2 | | using pva.SuperV.Engine; |
| | | 3 | | using pva.SuperV.Model.Instances; |
| | | 4 | | using pva.SuperV.Model.Services; |
| | | 5 | | |
| | | 6 | | namespace pva.SuperV.Api.Services.Instances |
| | | 7 | | { |
| | | 8 | | public class FieldValueService : BaseService, IFieldValueService |
| | | 9 | | { |
| | | 10 | | private readonly ILogger logger; |
| | | 11 | | |
| | 15 | 12 | | public FieldValueService(ILoggerFactory loggerFactory) |
| | 15 | 13 | | { |
| | 15 | 14 | | this.logger = loggerFactory.CreateLogger(this.GetType()); |
| | 15 | 15 | | } |
| | | 16 | | |
| | | 17 | | public async Task<FieldModel> GetFieldAsync(string projectId, string instanceName, string fieldName) |
| | 55 | 18 | | { |
| | 55 | 19 | | logger.LogDebug("Getting field {FieldName} for {InstanceName} of project {ProjectId}", |
| | 55 | 20 | | fieldName, instanceName, projectId); |
| | 55 | 21 | | return await Task.FromResult(FieldMapper.ToDto(GetFieldEntity(projectId, instanceName, fieldName))); |
| | 55 | 22 | | } |
| | | 23 | | |
| | | 24 | | public async Task<FieldValueModel> UpdateFieldValueAsync(string projectId, string instanceName, string fieldName |
| | 103 | 25 | | { |
| | 103 | 26 | | logger.LogDebug("Updating field value {FieldValue} for {FieldName} for {InstanceName} of project {ProjectId} |
| | 103 | 27 | | value.FormattedValue, fieldName, instanceName, projectId); |
| | 103 | 28 | | IField field = GetFieldEntity(projectId, instanceName, fieldName); |
| | 103 | 29 | | FieldValueMapper.SetFieldValue(field, value); |
| | 103 | 30 | | return await Task.FromResult(FieldValueMapper.ToDto(field)); |
| | 103 | 31 | | } |
| | | 32 | | |
| | | 33 | | } |
| | | 34 | | } |