Fix bug where properties were missing in json of installations and folders (were serialized as TreeNodes)

This commit is contained in:
ig 2023-03-21 11:42:49 +01:00
parent e25de16f65
commit 1b5baf90ae
1 changed files with 7 additions and 2 deletions

View File

@ -162,14 +162,19 @@ public class Controller : ControllerBase
[HttpGet(nameof(GetAllFoldersAndInstallations))]
public ActionResult<IEnumerable<TreeNode>> GetAllFoldersAndInstallations(Token authToken)
public ActionResult<IEnumerable<Object>> GetAllFoldersAndInstallations(Token authToken)
{
var user = Db.GetSession(authToken)?.User;
if (user is null)
return Unauthorized();
var foldersAndInstallations = user
.AccessibleFoldersAndInstallations()
.OfType<Object>(); // Important! JSON serializer must see Objects otherwise
// it will just serialize the members of TreeNode %&@#!!!
return new (user.AccessibleFoldersAndInstallations());
return new (foldersAndInstallations);
}