Beispiel #1
0
        public async Task <IEnumerable <BatchDto> > ListBatches(string orgSlug, string dsSlug)
        {
            await _utils.GetOrganization(orgSlug);

            var dataset = await _utils.GetDataset(orgSlug, dsSlug);

            _logger.LogInformation("Listing batches of '{OrgSlug}/{DsSlug}'", orgSlug, dsSlug);

            var batches = from batch in _context.Batches
                          .Include(x => x.Entries)
                          .Include(x => x.Dataset)
                          where batch.Dataset.Id == dataset.Id
                          select new BatchDto
            {
                End      = batch.End,
                Start    = batch.Start,
                Token    = batch.Token,
                UserName = batch.UserName,
                Status   = batch.Status,
                Entries  = from entry in batch.Entries
                           select new BatchEntryDto
                {
                    Hash    = entry.Hash,
                    Type    = entry.Type,
                    Size    = entry.Size,
                    AddedOn = entry.AddedOn,
                    Path    = entry.Path
                }
            };


            return(batches);
        }
Beispiel #2
0
        public async Task <IEnumerable <DatasetDto> > List(string orgSlug)
        {
            var org = await _utils.GetOrganization(orgSlug);

            var res = new List <DatasetDto>();

            foreach (var ds in org.Datasets.ToArray())
            {
                var ddb  = _ddbManager.Get(orgSlug, ds.InternalRef);
                var info = await ddb.GetInfoAsync();

                var attributes = new EntryProperties(info.Properties);

                res.Add(new DatasetDto
                {
                    Slug         = ds.Slug,
                    CreationDate = ds.CreationDate,
                    Properties   = attributes.Properties,
                    Size         = info.Size
                });
            }

            return(res.ToArray());
        }
        public async Task <OrganizationDto> Get(string orgSlug)
        {
            var org = await _utils.GetOrganization(orgSlug);

            return(org.ToDto());
        }