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

            return(entity?.ToOperationValidation());
        }
Ejemplo n.º 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());
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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));
            }
        }