add new API: GetAllFoldersAndInstallations
This commit is contained in:
parent
faf35be6cf
commit
72293807ee
|
@ -184,6 +184,25 @@ public class Controller
|
||||||
.ToList(); // important!
|
.ToList(); // important!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Returns<TreeNode[]>] // 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<TreeNode>;
|
||||||
|
var installations = db.GetAllAccessibleInstallations(caller);
|
||||||
|
|
||||||
|
return folders
|
||||||
|
.Concat(installations)
|
||||||
|
.ToList(); // important!
|
||||||
|
}
|
||||||
|
|
||||||
private static Folder PopulateChildren(Db db, Folder folder, HashSet<Int64>? hs = null)
|
private static Folder PopulateChildren(Db db, Folder folder, HashSet<Int64>? hs = null)
|
||||||
{
|
{
|
||||||
// TODO: remove cycle detector
|
// TODO: remove cycle detector
|
||||||
|
|
Loading…
Reference in New Issue