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

            return(entity?.ToOperationValidation());
        }
Beispiel #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());
        }
Beispiel #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);
            }
        }
Beispiel #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));
            }
        }