예제 #1
0
        public async Task <OperationValidation> TryGetAsync(Guid operationId)
        {
            var entity = await _storage.GetDataAsync(
                OperationValidationEntity.Partition(operationId),
                OperationValidationEntity.Row());

            return(entity?.ToOperationValidation());
        }
예제 #2
0
        public async Task <IReadOnlyList <OperationValidation> > GetResolutionRequiredAsync()
        {
            var indexes = await _index.GetDataAsync(OperationValidationEntity.IndexPk());

            var entities = await _storage.GetDataAsync(indexes);

            return(entities.Select(x => x.ToOperationValidation()).ToList());
        }
예제 #3
0
        public async Task SaveAsync(OperationValidation validation)
        {
            var entity = new OperationValidationEntity(validation);
            await _storage.InsertOrReplaceAsync(entity);

            if (validation.Resolution != OperationValidationResolution.Unconfirmed)
            {
                await _index.DeleteIfExistAsync(OperationValidationEntity.IndexPk(), entity.PartitionKey);
            }
        }
예제 #4
0
        public async Task AddAsync(OperationValidation validation)
        {
            var entity = new OperationValidationEntity(validation);
            await _storage.CreateIfNotExistsAsync(entity);

            if (validation.Risk.IsResolutionRequired)
            {
                await _index.CreateIfNotExistsAsync(new AzureIndex(OperationValidationEntity.IndexPk(), entity.PartitionKey, entity));
            }
        }