-
-
Notifications
You must be signed in to change notification settings - Fork 163
Expand file tree
/
Copy pathTreeNode.cs
More file actions
23 lines (19 loc) · 1022 Bytes
/
TreeNode.cs
File metadata and controls
23 lines (19 loc) · 1022 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
using JetBrains.Annotations;
using JsonApiDotNetCore.Configuration;
using JsonApiDotNetCore.Controllers;
using JsonApiDotNetCore.Resources;
using JsonApiDotNetCore.Resources.Annotations;
namespace AnnotationTests.Models;
[PublicAPI]
[Resource(PublicName = "tree-node", ClientIdGeneration = ClientIdGenerationMode.Required, ControllerNamespace = "Models",
GenerateControllerEndpoints = JsonApiEndpoints.Query)]
public sealed class TreeNode : Identifiable<long>
{
[Attr(PublicName = "name", Capabilities = AttrCapabilities.AllowSort)]
public string? DisplayName { get; set; }
[HasOne(PublicName = "orders", Capabilities = HasOneCapabilities.AllowView | HasOneCapabilities.AllowInclude, Links = LinkTypes.All)]
public TreeNode? Parent { get; set; }
[HasMany(PublicName = "orders", Capabilities = HasManyCapabilities.AllowView | HasManyCapabilities.AllowFilter, Links = LinkTypes.All,
DisablePagination = true)]
public ISet<TreeNode> Children { get; set; } = new HashSet<TreeNode>();
}