Set parentId=0 for root folders returned by GetTree

This commit is contained in:
ig 2023-03-08 12:53:29 +01:00
parent 774e7d9110
commit 629d0a1626
1 changed files with 3 additions and 1 deletions

View File

@ -4,6 +4,7 @@ using Innovenergy.Backend.Database;
using Innovenergy.Backend.Model; using Innovenergy.Backend.Model;
using Innovenergy.Backend.Model.Relations; using Innovenergy.Backend.Model.Relations;
using Innovenergy.Backend.Utils; using Innovenergy.Backend.Utils;
using InnovEnergy.Lib.Utils;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using HttpContextAccessor = Microsoft.AspNetCore.Http.HttpContextAccessor; using HttpContextAccessor = Microsoft.AspNetCore.Http.HttpContextAccessor;
@ -173,7 +174,8 @@ public class Controller
using var db = Db.Connect(); using var db = Db.Connect();
var folders = db var folders = db
.GetDirectlyAccessibleFolders(caller) // ReSharper disable once AccessToDisposedClosure .GetDirectlyAccessibleFolders(caller)
.Do(f => f.ParentId = 0) // ReSharper disable once AccessToDisposedClosure
.Select(f => PopulateChildren(db, f)); .Select(f => PopulateChildren(db, f));
var installations = db.GetDirectlyAccessibleInstallations(caller); var installations = db.GetDirectlyAccessibleInstallations(caller);