Spaces:
Running
Running
Commit ·
e0e601c
1
Parent(s): 16d5815
Extend TaskNode with visual and data fields to support images, drawing and custom text
Browse filesFiles changed (7)
- FlowAPI.Application/DTOs/Graph/GraphDtos.cs+45-31
- FlowAPI.Application/Services/GraphService.cs+14-2
- FlowAPI.Domain/Entities/TaskNode.cs+11-3
- FlowAPI.Infrastructure/Migrations/20260521020134_AddTaskNodeVisualFields.Designer.csAdded+445
- FlowAPI.Infrastructure/Migrations/20260521020134_AddTaskNodeVisualFields.csAdded+79
- FlowAPI.Infrastructure/Migrations/AppDbContextModelSnapshot.cs+18
- FlowAPI.Infrastructure/Repositories/GraphRepository.cs+6
121234656789101112131415161718192021222324252627282930313233343536373839404142434445464748495051529 unmodified lines62636426272829303132336566676869707139727374754 unmodified lines8081825051525354555657585960616263646566676883using System;using System.Collections.Generic;using FlowAPI.Domain.Enums;
namespace FlowAPI.Application.DTOs.Graph{ public class CreateGraphDto public class FullGraphResponseDto { public Guid Id { get; set; } public Guid UserId { get; set; } public string Title { get; set; } = string.Empty; public string? Description { get; set; } public DateTime CreatedAt { get; set; } public bool IsShared { get; set; } public string Permission { get; set; } = "Owner";
public List<NodeDto> Nodes { get; set; } = new(); public List<EdgeDto> Edges { get; set; } = new(); }
public class NodeDto { public Guid Id { get; set; } public string Label { get; set; } = string.Empty; public double PosX { get; set; } public double PosY { get; set; } public string Type { get; set; } = "sketch"; public int State { get; set; } public string? Decision { get; set; } // Extended visual/content fields public string? Description { get; set; } public string? Color { get; set; } public bool IsPinned { get; set; } public double? Width { get; set; } public double? Height { get; set; } public string? Data { get; set; } }
public class EdgeDto { public Guid Id { get; set; } public Guid FromNodeId { get; set; } public Guid ToNodeId { get; set; } public string Condition { get; set; } = "True"; }
public class CreateGraphDto { public string Title { get; set; } = string.Empty; public string? Description { get; set; } }
public class UpdateGraphDto9 unmodified lines public string Title { get; set; } = string.Empty; public string? Description { get; set; } public DateTime CreatedAt { get; set; } public bool IsShared { get; set; } = false; public string Permission { get; set; } = "Owner"; // "Owner", "Read", "Edit" }
public class FullGraphResponseDto : GraphResponseDto { public List<NodeDto> Nodes { get; set; } = new(); public List<EdgeDto> Edges { get; set; } = new(); public bool IsShared { get; set; } public string Permission { get; set; } = "Owner"; }
public class ShareGraphRequestDto { public string Email { get; set; } = string.Empty; public string Permission { get; set; } = "Read"; // "Read" or "Edit" public string Permission { get; set; } = "Read"; }
public class SharedUserResponseDto4 unmodified lines public string DisplayName { get; set; } = string.Empty; public string Permission { get; set; } = "Read"; }
public class NodeDto { public Guid Id { get; set; } public string Label { get; set; } = string.Empty; public double PosX { get; set; } public double PosY { get; set; } public string Type { get; set; } = "sketch"; public int State { get; set; } public string? Decision { get; set; } }
public class EdgeDto { public Guid Id { get; set; } public Guid FromNodeId { get; set; } public Guid ToNodeId { get; set; } public string? Condition { get; set; } }}116 unmodified lines11711811912012012112212312412512612712812989 unmodified lines219220221216222223224225226227228229230231116 unmodified lines PosY = n.PosY, Type = n.Type, State = (int)n.State, Decision = n.Decision Decision = n.Decision, Description = n.Description, Color = n.Color, IsPinned = n.IsPinned, Width = n.Width, Height = n.Height, Data = n.Data }).ToList(), Edges = graph.Edges.Select(e => new EdgeDto {89 unmodified lines PosY = nodeDto.PosY, Type = nodeDto.Type, Decision = nodeDto.Decision, State = (FlowAPI.Domain.Enums.NodeState)nodeDto.State State = (FlowAPI.Domain.Enums.NodeState)nodeDto.State, Description = nodeDto.Description, Color = nodeDto.Color, IsPinned = nodeDto.IsPinned, Width = nodeDto.Width, Height = nodeDto.Height, Data = nodeDto.Data }).ToList();
var mappedEdges = dto.Edges.Select(edgeDto => new Edge121235 unmodified lines910111412131415161718192021222324252627using FlowAPI.Domain.Enums;
namespace FlowAPI.Domain.Entities{ public class TaskNode5 unmodified lines public double PosY { get; set; } public string Type { get; set; } = "sketch"; public string? Decision { get; set; } public NodeState State { get; set; } = NodeState.Pending; public FlowAPI.Domain.Enums.NodeState State { get; set; } = FlowAPI.Domain.Enums.NodeState.Pending; public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
// Visual properties (JSON serialized in backend or kept as extra fields) public string? Description { get; set; } public string? Color { get; set; } public bool IsPinned { get; set; } public double? Width { get; set; } public double? Height { get; set; } // Specific data (Image URL, Text formatting, etc.) public string? Data { get; set; }
// Navigation properties public Graph Graph { get; set; } = null!; public ICollection<Edge> OutgoingEdges { get; set; } = new List<Edge>();123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445// <auto-generated />using System;using FlowAPI.Infrastructure.Data;using Microsoft.EntityFrameworkCore;using Microsoft.EntityFrameworkCore.Infrastructure;using Microsoft.EntityFrameworkCore.Migrations;using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace FlowAPI.Infrastructure.Migrations{ [DbContext(typeof(AppDbContext))] [Migration("20260521020134_AddTaskNodeVisualFields")] partial class AddTaskNodeVisualFields { /// <inheritdoc /> protected override void BuildTargetModel(ModelBuilder modelBuilder) {#pragma warning disable 612, 618 modelBuilder.HasAnnotation("ProductVersion", "10.0.8");
modelBuilder.Entity("FlowAPI.Domain.Entities.Achievement", b => { b.Property<Guid>("Id") .ValueGeneratedOnAdd() .HasColumnType("TEXT");
b.Property<string>("Category") .IsRequired() .HasMaxLength(100) .HasColumnType("TEXT");
b.Property<string>("Description") .IsRequired() .HasColumnType("TEXT");
b.Property<string>("IconUrl") .IsRequired() .HasColumnType("TEXT");
b.Property<int>("RewardPoints") .HasColumnType("INTEGER");
b.Property<int>("TargetValue") .HasColumnType("INTEGER");
b.Property<string>("Title") .IsRequired() .HasMaxLength(200) .HasColumnType("TEXT");
b.Property<string>("TriggerEventName") .IsRequired() .HasMaxLength(100) .HasColumnType("TEXT");
b.Property<int>("Type") .HasColumnType("INTEGER");
b.HasKey("Id");
b.ToTable("Achievements"); });
modelBuilder.Entity("FlowAPI.Domain.Entities.Edge", b => { b.Property<Guid>("Id") .ValueGeneratedOnAdd() .HasColumnType("TEXT");
b.Property<int>("Condition") .HasMaxLength(50) .HasColumnType("INTEGER");
b.Property<Guid>("FromNodeId") .HasColumnType("TEXT");
b.Property<Guid>("GraphId") .HasColumnType("TEXT");
b.Property<Guid>("ToNodeId") .HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("FromNodeId");
b.HasIndex("GraphId");
b.HasIndex("ToNodeId");
b.ToTable("Edges"); });
modelBuilder.Entity("FlowAPI.Domain.Entities.Graph", b => { b.Property<Guid>("Id") .ValueGeneratedOnAdd() .HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt") .HasColumnType("TEXT");
b.Property<string>("Description") .HasMaxLength(1000) .HasColumnType("TEXT");
b.Property<string>("Title") .IsRequired() .HasMaxLength(200) .HasColumnType("TEXT");
b.Property<DateTime>("UpdatedAt") .HasColumnType("TEXT");
b.Property<Guid>("UserId") .HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("Graphs"); });
modelBuilder.Entity("FlowAPI.Domain.Entities.HabitRecord", b => { b.Property<Guid>("Id") .ValueGeneratedOnAdd() .HasColumnType("TEXT");
b.Property<DateTime>("CheckedDate") .HasColumnType("TEXT");
b.Property<string>("HabitName") .IsRequired() .HasMaxLength(100) .HasColumnType("TEXT");
b.Property<int>("StreakCount") .HasColumnType("INTEGER");
b.Property<Guid>("UserId") .HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("HabitRecords"); });
modelBuilder.Entity("FlowAPI.Domain.Entities.SharedGraph", b => { b.Property<Guid>("Id") .ValueGeneratedOnAdd() .HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt") .HasColumnType("TEXT");
b.Property<Guid>("GraphId") .HasColumnType("TEXT");
b.Property<string>("Permission") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(50) .HasColumnType("TEXT") .HasDefaultValue("Read");
b.Property<Guid>("SharedWithUserId") .HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("SharedWithUserId");
b.HasIndex("GraphId", "SharedWithUserId") .IsUnique();
b.ToTable("SharedGraphs"); });
modelBuilder.Entity("FlowAPI.Domain.Entities.TaskNode", b => { b.Property<Guid>("Id") .ValueGeneratedOnAdd() .HasColumnType("TEXT");
b.Property<string>("Color") .HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt") .HasColumnType("TEXT");
b.Property<string>("Data") .HasColumnType("TEXT");
b.Property<string>("Decision") .HasMaxLength(50) .HasColumnType("TEXT");
b.Property<string>("Description") .HasColumnType("TEXT");
b.Property<Guid>("GraphId") .HasColumnType("TEXT");
b.Property<double?>("Height") .HasColumnType("REAL");
b.Property<bool>("IsPinned") .HasColumnType("INTEGER");
b.Property<string>("Label") .IsRequired() .HasMaxLength(30) .HasColumnType("TEXT");
b.Property<double>("PosX") .HasColumnType("REAL");
b.Property<double>("PosY") .HasColumnType("REAL");
b.Property<string>("State") .IsRequired() .ValueGeneratedOnAdd() .HasColumnType("TEXT") .HasDefaultValue("Pending");
b.Property<string>("Type") .IsRequired() .ValueGeneratedOnAdd() .HasMaxLength(50) .HasColumnType("TEXT") .HasDefaultValue("sketch");
b.Property<double?>("Width") .HasColumnType("REAL");
b.HasKey("Id");
b.HasIndex("GraphId");
b.ToTable("TaskNodes"); });
modelBuilder.Entity("FlowAPI.Domain.Entities.User", b => { b.Property<Guid>("Id") .ValueGeneratedOnAdd() .HasColumnType("TEXT");
b.Property<string>("AvatarUrl") .HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt") .HasColumnType("TEXT");
b.Property<string>("DisplayName") .IsRequired() .HasMaxLength(100) .HasColumnType("TEXT");
b.Property<string>("Email") .IsRequired() .HasMaxLength(256) .HasColumnType("TEXT");
b.Property<bool>("IsPremium") .HasColumnType("INTEGER");
b.Property<string>("PasswordHash") .IsRequired() .HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("Email") .IsUnique();
b.ToTable("Users"); });
modelBuilder.Entity("FlowAPI.Domain.Entities.UserAchievement", b => { b.Property<Guid>("Id") .ValueGeneratedOnAdd() .HasColumnType("TEXT");
b.Property<Guid>("AchievementId") .HasColumnType("TEXT");
b.Property<int>("CurrentValue") .HasColumnType("INTEGER");
b.Property<bool>("IsUnlocked") .HasColumnType("INTEGER");
b.Property<DateTime?>("UnlockedAt") .HasColumnType("TEXT");
b.Property<Guid>("UserId") .HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("AchievementId");
b.HasIndex("UserId");
b.ToTable("UserAchievements"); });
modelBuilder.Entity("FlowAPI.Domain.Entities.Edge", b => { b.HasOne("FlowAPI.Domain.Entities.TaskNode", "FromNode") .WithMany("OutgoingEdges") .HasForeignKey("FromNodeId") .OnDelete(DeleteBehavior.Cascade) .IsRequired();
b.HasOne("FlowAPI.Domain.Entities.Graph", "Graph") .WithMany("Edges") .HasForeignKey("GraphId") .OnDelete(DeleteBehavior.Cascade) .IsRequired();
b.HasOne("FlowAPI.Domain.Entities.TaskNode", "ToNode") .WithMany("IncomingEdges") .HasForeignKey("ToNodeId") .OnDelete(DeleteBehavior.Cascade) .IsRequired();
b.Navigation("FromNode");
b.Navigation("Graph");
b.Navigation("ToNode"); });
modelBuilder.Entity("FlowAPI.Domain.Entities.Graph", b => { b.HasOne("FlowAPI.Domain.Entities.User", "User") .WithMany("Graphs") .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired();
b.Navigation("User"); });
modelBuilder.Entity("FlowAPI.Domain.Entities.HabitRecord", b => { b.HasOne("FlowAPI.Domain.Entities.User", "User") .WithMany("HabitRecords") .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired();
b.Navigation("User"); });
modelBuilder.Entity("FlowAPI.Domain.Entities.SharedGraph", b => { b.HasOne("FlowAPI.Domain.Entities.Graph", "Graph") .WithMany("SharedGraphs") .HasForeignKey("GraphId") .OnDelete(DeleteBehavior.Cascade) .IsRequired();
b.HasOne("FlowAPI.Domain.Entities.User", "SharedWithUser") .WithMany("SharedGraphs") .HasForeignKey("SharedWithUserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired();
b.Navigation("Graph");
b.Navigation("SharedWithUser"); });
modelBuilder.Entity("FlowAPI.Domain.Entities.TaskNode", b => { b.HasOne("FlowAPI.Domain.Entities.Graph", "Graph") .WithMany("Nodes") .HasForeignKey("GraphId") .OnDelete(DeleteBehavior.Cascade) .IsRequired();
b.Navigation("Graph"); });
modelBuilder.Entity("FlowAPI.Domain.Entities.UserAchievement", b => { b.HasOne("FlowAPI.Domain.Entities.Achievement", "Achievement") .WithMany() .HasForeignKey("AchievementId") .OnDelete(DeleteBehavior.Cascade) .IsRequired();
b.HasOne("FlowAPI.Domain.Entities.User", "User") .WithMany("UserAchievements") .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired();
b.Navigation("Achievement");
b.Navigation("User"); });
modelBuilder.Entity("FlowAPI.Domain.Entities.Graph", b => { b.Navigation("Edges");
b.Navigation("Nodes");
b.Navigation("SharedGraphs"); });
modelBuilder.Entity("FlowAPI.Domain.Entities.TaskNode", b => { b.Navigation("IncomingEdges");
b.Navigation("OutgoingEdges"); });
modelBuilder.Entity("FlowAPI.Domain.Entities.User", b => { b.Navigation("Graphs");
b.Navigation("HabitRecords");
b.Navigation("SharedGraphs");
b.Navigation("UserAchievements"); });#pragma warning restore 612, 618 } }}12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace FlowAPI.Infrastructure.Migrations{ /// <inheritdoc /> public partial class AddTaskNodeVisualFields : Migration { /// <inheritdoc /> protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn<string>( name: "Color", table: "TaskNodes", type: "TEXT", nullable: true);
migrationBuilder.AddColumn<string>( name: "Data", table: "TaskNodes", type: "TEXT", nullable: true);
migrationBuilder.AddColumn<string>( name: "Description", table: "TaskNodes", type: "TEXT", nullable: true);
migrationBuilder.AddColumn<double>( name: "Height", table: "TaskNodes", type: "REAL", nullable: true);
migrationBuilder.AddColumn<bool>( name: "IsPinned", table: "TaskNodes", type: "INTEGER", nullable: false, defaultValue: false);
migrationBuilder.AddColumn<double>( name: "Width", table: "TaskNodes", type: "REAL", nullable: true); }
/// <inheritdoc /> protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropColumn( name: "Color", table: "TaskNodes");
migrationBuilder.DropColumn( name: "Data", table: "TaskNodes");
migrationBuilder.DropColumn( name: "Description", table: "TaskNodes");
migrationBuilder.DropColumn( name: "Height", table: "TaskNodes");
migrationBuilder.DropColumn( name: "IsPinned", table: "TaskNodes");
migrationBuilder.DropColumn( name: "Width", table: "TaskNodes"); } }}185 unmodified lines18618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521618 unmodified lines235236237238239240241242243185 unmodified lines .ValueGeneratedOnAdd() .HasColumnType("TEXT");
b.Property<string>("Color") .HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt") .HasColumnType("TEXT");
b.Property<string>("Data") .HasColumnType("TEXT");
b.Property<string>("Decision") .HasMaxLength(50) .HasColumnType("TEXT");
b.Property<string>("Description") .HasColumnType("TEXT");
b.Property<Guid>("GraphId") .HasColumnType("TEXT");
b.Property<double?>("Height") .HasColumnType("REAL");
b.Property<bool>("IsPinned") .HasColumnType("INTEGER");
b.Property<string>("Label") .IsRequired() .HasMaxLength(30)18 unmodified lines .HasColumnType("TEXT") .HasDefaultValue("sketch");
b.Property<double?>("Width") .HasColumnType("REAL");
b.HasKey("Id");
b.HasIndex("GraphId");96 unmodified lines97989910010110210310410510610710896 unmodified lines existingNode.Type = node.Type; existingNode.Decision = node.Decision; existingNode.State = node.State; existingNode.Description = node.Description; existingNode.Color = node.Color; existingNode.IsPinned = node.IsPinned; existingNode.Width = node.Width; existingNode.Height = node.Height; existingNode.Data = node.Data; } else {FlowAPI.Application/DTOs/Graph/GraphDtos.cs+45-31
FlowAPI.Application/Services/GraphService.cs+14-2
FlowAPI.Domain/Entities/TaskNode.cs+11-3
FlowAPI.Infrastructure/Migrations/20260521020134_AddTaskNodeVisualFields.Designer.csAdded+445
FlowAPI.Infrastructure/Migrations/20260521020134_AddTaskNodeVisualFields.csAdded+79
FlowAPI.Infrastructure/Migrations/AppDbContextModelSnapshot.cs+18
FlowAPI.Infrastructure/Repositories/GraphRepository.cs+6