changes
This commit is contained in:
36
Models/Node.cs
Normal file
36
Models/Node.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace public_valetax.Models
|
||||
{
|
||||
[Table("nodes")]
|
||||
public class Node
|
||||
{
|
||||
[Key]
|
||||
[Column("id")]
|
||||
public long Id { get; set; }
|
||||
|
||||
[Required]
|
||||
[Column("tree_id")]
|
||||
public long TreeId { get; set; }
|
||||
|
||||
[Column("parent_id")]
|
||||
public long? ParentId { get; set; }
|
||||
|
||||
[Required]
|
||||
[Column("name")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
[Column("created_at")]
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
// Navigation properties
|
||||
[ForeignKey("TreeId")]
|
||||
public Tree Tree { get; set; } = null!;
|
||||
|
||||
[ForeignKey("ParentId")]
|
||||
public Node? Parent { get; set; }
|
||||
|
||||
public ICollection<Node> Children { get; set; } = [];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user