diff --git a/csharp/App/Backend/Controllers/Controller.cs b/csharp/App/Backend/Controllers/Controller.cs index b7935922b..9136ac151 100644 --- a/csharp/App/Backend/Controllers/Controller.cs +++ b/csharp/App/Backend/Controllers/Controller.cs @@ -184,6 +184,25 @@ public class Controller .ToList(); // important! } + [Returns] // assuming swagger knows about arrays but not lists (JSON) + [Returns(HttpStatusCode.Unauthorized)] + [HttpGet($"{nameof(GetAllFoldersAndInstallations)}/")] + public Object GetAllFoldersAndInstallations() + { + var caller = GetCaller(); + if (caller == null) + return new HttpResponseMessage(HttpStatusCode.Unauthorized); + + using var db = Db.Connect(); + + var folders = db.GetAllAccessibleFolders(caller) as IEnumerable; + var installations = db.GetAllAccessibleInstallations(caller); + + return folders + .Concat(installations) + .ToList(); // important! + } + private static Folder PopulateChildren(Db db, Folder folder, HashSet? hs = null) { // TODO: remove cycle detector