diff --git a/App/Modules/Cyan/Data/Repositories/PluginRepository.cs b/App/Modules/Cyan/Data/Repositories/PluginRepository.cs index f3eccb3..22e620b 100644 --- a/App/Modules/Cyan/Data/Repositories/PluginRepository.cs +++ b/App/Modules/Cyan/Data/Repositories/PluginRepository.cs @@ -414,18 +414,20 @@ public async Task>> GetAllVersion(IEn query = query.Where(predicate); - var pluginReferences = await query.ToArrayAsync(); - this._logger.LogInformation("Plugin References: {@PluginReferences}", pluginReferences.Select(x => x.Id)); - if (pluginReferences.Length != pluginRefs.Length) + var plugins = await query.Select(x => x.ToPrincipal()).ToArrayAsync(); + + this._logger.LogInformation("Plugin References: {@PluginReferences}", plugins.Select(x => x.Id)); + + if (plugins.Length != pluginRefs.Length) { - var found = pluginReferences.Select(x => $"{x.Plugin.User.Username}/{x.Plugin.Name}:{x.Version}").ToArray(); + var found = await query.Select(x => $"{x.Plugin.User.Username}/{x.Plugin.Name}:{x.Version}").ToArrayAsync(); var search = pluginRefs.Select(x => $"{x.Username}/{x.Name}:{x.Version}"); var notFound = search.Except(found); return new MultipleEntityNotFound("Plugins not found", typeof(PluginPrincipal), notFound.ToArray(), found.ToArray()).ToException(); } - return pluginReferences.Select(x => x.ToPrincipal()).ToResult(); + return plugins; } catch (Exception e) { diff --git a/App/Modules/Cyan/Data/Repositories/ProcessorRepository.cs b/App/Modules/Cyan/Data/Repositories/ProcessorRepository.cs index a96ce8c..ec14893 100644 --- a/App/Modules/Cyan/Data/Repositories/ProcessorRepository.cs +++ b/App/Modules/Cyan/Data/Repositories/ProcessorRepository.cs @@ -420,21 +420,19 @@ public async Task>> GetAllVersion( query = query.Where(predicate); - var processorReferences = await query.ToArrayAsync(); - this._logger.LogInformation("Processor References: {@ProcessorReferences}", - processorReferences.Select(x => x.Id)); + var processors = await query.Select(x => x.ToPrincipal()).ToArrayAsync(); + this._logger.LogInformation("Processor References: {@ProcessorReferences}", processors.Select(x => x.Id)); - if (processorReferences.Length != processorRefs.Length) + if (processors.Length != processorRefs.Length) { - var found = processorReferences.Select(x => $"{x.Processor.User.Username}/{x.Processor.Name}:{x.Version}") - .ToArray(); + var found = await query.Select(x => $"{x.Processor.User.Username}/{x.Processor.Name}:{x.Version}") + .ToArrayAsync(); var search = processorRefs.Select(x => $"{x.Username}/{x.Name}:{x.Version}"); var notFound = search.Except(found).ToArray(); return new MultipleEntityNotFound("Processors not found", typeof(ProcessorPrincipal), notFound, found) .ToException(); } - - return processorReferences.Select(x => x.ToPrincipal()).ToResult(); + return processors; } catch (Exception e) {