Exemple #1
0
        public async Task <IEnumerable <Job> > QueueSendRecallsAsync(
            [GraphQLType(typeof(QueueSendRecallsInputType))][GraphQLName("input")]
            QueueSendRecallsCommand input, [Service] ISheaftMediatr mediatr,
            JobsByIdBatchDataLoader dataLoader, CancellationToken token)
        {
            var result = await ExecuteAsync <QueueSendRecallsCommand, IEnumerable <Guid> >(mediatr, input, token);

            return(await dataLoader.LoadAsync(result.ToList(), token));
        }
Exemple #2
0
        public async Task <Job> ExportTransactionsAsync(
            [GraphQLType(typeof(QueueExportTransactionsInputType))][GraphQLName("input")]
            QueueExportTransactionsCommand input, [Service] ISheaftMediatr mediatr,
            JobsByIdBatchDataLoader jobsDataLoader, CancellationToken token)
        {
            var result = await ExecuteAsync <QueueExportTransactionsCommand, Guid>(mediatr, input, token);

            return(await jobsDataLoader.LoadAsync(result, token));
        }
Exemple #3
0
        public async Task <Job> ImportProducts(IFile file, [Service] ISheaftMediatr mediatr,
                                               JobsByIdBatchDataLoader jobsDataLoader, CancellationToken token)
        {
            using (var stream = file.OpenReadStream())
            {
                using (var content = new MemoryStream())
                {
                    await stream.CopyToAsync(content, token);

                    var input = new QueueImportProductsCommand(CurrentUser)
                    {
                        ProducerId = CurrentUser.Id, FileName = file.Name, FileStream = content.ToArray()
                    };

                    var result = await mediatr.Process(input, token);

                    return(await jobsDataLoader.LoadAsync(result.Data, token));
                }
            }
        }
Exemple #4
0
        public async Task <Job> ExportUserDataAsync([Service] ISheaftMediatr mediatr, JobsByIdBatchDataLoader jobsDataLoader, CancellationToken token)
        {
            var result = await ExecuteAsync <QueueExportUserDataCommand, Guid>(mediatr, new QueueExportUserDataCommand(CurrentUser), token);

            return(await jobsDataLoader.LoadAsync(result, token));
        }