-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTreeNode.cs
More file actions
53 lines (45 loc) · 1.71 KB
/
Copy pathTreeNode.cs
File metadata and controls
53 lines (45 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using System.ComponentModel.DataAnnotations;
namespace TreeDataApi.Models
{
// MongoDB document model
public class TreeNode
{
[BsonId]
[BsonRepresentation(BsonType.ObjectId)]
public string Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
[BsonRepresentation(BsonType.ObjectId)]
public string? ParentId { get; set; }
public int Level { get; set; }
public int SortOrder { get; set; }
public DateTime CreatedDate { get; set; }
public bool IsActive { get; set; }
// Additional properties for your business logic
public string NodeType { get; set; }
public Dictionary<string, object> Metadata { get; set; } = new();
}
// Flattened model for ag-Grid
public class FlatTreeNode
{
public string Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public string? ParentId { get; set; }
public int Level { get; set; }
public int SortOrder { get; set; }
public DateTime CreatedDate { get; set; }
public bool IsActive { get; set; }
public string NodeType { get; set; }
// ag-Grid specific properties
public List<string> OrgHierarchy { get; set; } = new();
public string FullPath { get; set; }
public bool HasChildren { get; set; }
public int ChildCount { get; set; }
// Computed display properties
public string DisplayName { get; set; }
public string IndentedName { get; set; }
}
}