public async Task <ActionResult> Invoke([FromBody] UpdateLayerDto dto)
        {
            await _validator.Validate(dto);

            var status = await _statusTable.GetStatus(WorkspaceId, LayerId);

            if (!status.HasValue)
            {
                return(NotFound());
            }

            if (dto.DataLocation != null)
            {
                // in other cases we will have to create a new conversion job
                var job = new ConversionJobData
                {
                    LayerId      = LayerId,
                    WorkspaceId  = WorkspaceId,
                    LayerName    = dto.Name,
                    DataLocation = dto.DataLocation,
                    Description  = dto.Description
                };
                await _gdConversionQueue.Queue(job);

                await _statusTable.UpdateStatus(WorkspaceId, LayerId, LayerStatus.Processing);
            }

            return(Accepted(new LayerStatusDto
            {
                Id = LayerId,
                Status = LayerStatus.Processing
            }));
        }
Esempio n. 2
0
        public async Task <LayerStatusDto> Invoke()
        {
            var status = await _statusTable.GetStatus(WorkspaceId, LayerId);

            return(new LayerStatusDto
            {
                Id = LayerId,
                Status = status ?? throw new EntityNotFoundException()
            });