danylokhodus commited on
Commit
452ab3c
·
1 Parent(s): bc59888

fix: refactor Edge.Condition to string for precise handle-based connection persistence

Browse files
FlowAPI.Application/DTOs/Edge/EdgeDtos.cs CHANGED
@@ -1,5 +1,3 @@
1
- using FlowAPI.Domain.Enums;
2
-
3
  namespace FlowAPI.Application.DTOs.Edge
4
  {
5
  public class CreateEdgeDto
@@ -7,12 +5,12 @@ namespace FlowAPI.Application.DTOs.Edge
7
  public Guid GraphId { get; set; }
8
  public Guid FromNodeId { get; set; }
9
  public Guid ToNodeId { get; set; }
10
- public EdgeCondition Condition { get; set; } = EdgeCondition.True;
11
  }
12
 
13
  public class UpdateEdgeDto
14
  {
15
- public EdgeCondition? Condition { get; set; }
16
  }
17
 
18
  public class EdgeResponseDto
@@ -21,6 +19,6 @@ namespace FlowAPI.Application.DTOs.Edge
21
  public Guid GraphId { get; set; }
22
  public Guid FromNodeId { get; set; }
23
  public Guid ToNodeId { get; set; }
24
- public EdgeCondition Condition { get; set; }
25
  }
26
  }
 
 
 
1
  namespace FlowAPI.Application.DTOs.Edge
2
  {
3
  public class CreateEdgeDto
 
5
  public Guid GraphId { get; set; }
6
  public Guid FromNodeId { get; set; }
7
  public Guid ToNodeId { get; set; }
8
+ public string Condition { get; set; } = "True";
9
  }
10
 
11
  public class UpdateEdgeDto
12
  {
13
+ public string? Condition { get; set; }
14
  }
15
 
16
  public class EdgeResponseDto
 
19
  public Guid GraphId { get; set; }
20
  public Guid FromNodeId { get; set; }
21
  public Guid ToNodeId { get; set; }
22
+ public string Condition { get; set; } = "True";
23
  }
24
  }
FlowAPI.Application/Services/GraphService.cs CHANGED
@@ -232,7 +232,7 @@ namespace FlowAPI.Application.Services
232
  {
233
  FromNodeId = edgeDto.FromNodeId,
234
  ToNodeId = edgeDto.ToNodeId,
235
- Condition = Enum.TryParse<FlowAPI.Domain.Enums.EdgeCondition>(edgeDto.Condition, true, out var cond) ? cond : FlowAPI.Domain.Enums.EdgeCondition.True
236
  }).ToList();
237
 
238
  // Calculate deltas for achievements
 
232
  {
233
  FromNodeId = edgeDto.FromNodeId,
234
  ToNodeId = edgeDto.ToNodeId,
235
+ Condition = edgeDto.Condition ?? "True"
236
  }).ToList();
237
 
238
  // Calculate deltas for achievements
FlowAPI.Domain/Entities/Edge.cs CHANGED
@@ -1,5 +1,3 @@
1
- using FlowAPI.Domain.Enums;
2
-
3
  namespace FlowAPI.Domain.Entities
4
  {
5
  public class Edge
@@ -8,7 +6,7 @@ namespace FlowAPI.Domain.Entities
8
  public Guid GraphId { get; set; }
9
  public Guid FromNodeId { get; set; }
10
  public Guid ToNodeId { get; set; }
11
- public EdgeCondition Condition { get; set; } = EdgeCondition.True;
12
 
13
  // Navigation properties
14
  public Graph Graph { get; set; } = null!;
 
 
 
1
  namespace FlowAPI.Domain.Entities
2
  {
3
  public class Edge
 
6
  public Guid GraphId { get; set; }
7
  public Guid FromNodeId { get; set; }
8
  public Guid ToNodeId { get; set; }
9
+ public string Condition { get; set; } = "True";
10
 
11
  // Navigation properties
12
  public Graph Graph { get; set; } = null!;
FlowAPI.Infrastructure/Migrations/20260521162648_ChangeEdgeConditionToString.Designer.cs ADDED
@@ -0,0 +1,448 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // <auto-generated />
2
+ using System;
3
+ using FlowAPI.Infrastructure.Data;
4
+ using Microsoft.EntityFrameworkCore;
5
+ using Microsoft.EntityFrameworkCore.Infrastructure;
6
+ using Microsoft.EntityFrameworkCore.Migrations;
7
+ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
8
+
9
+ #nullable disable
10
+
11
+ namespace FlowAPI.Infrastructure.Migrations
12
+ {
13
+ [DbContext(typeof(AppDbContext))]
14
+ [Migration("20260521162648_ChangeEdgeConditionToString")]
15
+ partial class ChangeEdgeConditionToString
16
+ {
17
+ /// <inheritdoc />
18
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
19
+ {
20
+ #pragma warning disable 612, 618
21
+ modelBuilder.HasAnnotation("ProductVersion", "10.0.8");
22
+
23
+ modelBuilder.Entity("FlowAPI.Domain.Entities.Achievement", b =>
24
+ {
25
+ b.Property<Guid>("Id")
26
+ .ValueGeneratedOnAdd()
27
+ .HasColumnType("TEXT");
28
+
29
+ b.Property<string>("Category")
30
+ .IsRequired()
31
+ .HasMaxLength(100)
32
+ .HasColumnType("TEXT");
33
+
34
+ b.Property<string>("Description")
35
+ .IsRequired()
36
+ .HasColumnType("TEXT");
37
+
38
+ b.Property<string>("IconUrl")
39
+ .IsRequired()
40
+ .HasColumnType("TEXT");
41
+
42
+ b.Property<int>("RewardPoints")
43
+ .HasColumnType("INTEGER");
44
+
45
+ b.Property<int>("TargetValue")
46
+ .HasColumnType("INTEGER");
47
+
48
+ b.Property<string>("Title")
49
+ .IsRequired()
50
+ .HasMaxLength(200)
51
+ .HasColumnType("TEXT");
52
+
53
+ b.Property<string>("TriggerEventName")
54
+ .IsRequired()
55
+ .HasMaxLength(100)
56
+ .HasColumnType("TEXT");
57
+
58
+ b.Property<int>("Type")
59
+ .HasColumnType("INTEGER");
60
+
61
+ b.HasKey("Id");
62
+
63
+ b.ToTable("Achievements");
64
+ });
65
+
66
+ modelBuilder.Entity("FlowAPI.Domain.Entities.Edge", b =>
67
+ {
68
+ b.Property<Guid>("Id")
69
+ .ValueGeneratedOnAdd()
70
+ .HasColumnType("TEXT");
71
+
72
+ b.Property<string>("Condition")
73
+ .IsRequired()
74
+ .HasMaxLength(50)
75
+ .HasColumnType("TEXT");
76
+
77
+ b.Property<Guid>("FromNodeId")
78
+ .HasColumnType("TEXT");
79
+
80
+ b.Property<Guid>("GraphId")
81
+ .HasColumnType("TEXT");
82
+
83
+ b.Property<Guid>("ToNodeId")
84
+ .HasColumnType("TEXT");
85
+
86
+ b.HasKey("Id");
87
+
88
+ b.HasIndex("FromNodeId");
89
+
90
+ b.HasIndex("GraphId");
91
+
92
+ b.HasIndex("ToNodeId");
93
+
94
+ b.ToTable("Edges");
95
+ });
96
+
97
+ modelBuilder.Entity("FlowAPI.Domain.Entities.Graph", b =>
98
+ {
99
+ b.Property<Guid>("Id")
100
+ .ValueGeneratedOnAdd()
101
+ .HasColumnType("TEXT");
102
+
103
+ b.Property<DateTime>("CreatedAt")
104
+ .HasColumnType("TEXT");
105
+
106
+ b.Property<string>("Description")
107
+ .HasMaxLength(1000)
108
+ .HasColumnType("TEXT");
109
+
110
+ b.Property<string>("Title")
111
+ .IsRequired()
112
+ .HasMaxLength(200)
113
+ .HasColumnType("TEXT");
114
+
115
+ b.Property<DateTime>("UpdatedAt")
116
+ .HasColumnType("TEXT");
117
+
118
+ b.Property<Guid>("UserId")
119
+ .HasColumnType("TEXT");
120
+
121
+ b.HasKey("Id");
122
+
123
+ b.HasIndex("UserId");
124
+
125
+ b.ToTable("Graphs");
126
+ });
127
+
128
+ modelBuilder.Entity("FlowAPI.Domain.Entities.HabitRecord", b =>
129
+ {
130
+ b.Property<Guid>("Id")
131
+ .ValueGeneratedOnAdd()
132
+ .HasColumnType("TEXT");
133
+
134
+ b.Property<DateTime>("CheckedDate")
135
+ .HasColumnType("TEXT");
136
+
137
+ b.Property<string>("HabitName")
138
+ .IsRequired()
139
+ .HasMaxLength(100)
140
+ .HasColumnType("TEXT");
141
+
142
+ b.Property<int>("StreakCount")
143
+ .HasColumnType("INTEGER");
144
+
145
+ b.Property<Guid>("UserId")
146
+ .HasColumnType("TEXT");
147
+
148
+ b.HasKey("Id");
149
+
150
+ b.HasIndex("UserId");
151
+
152
+ b.ToTable("HabitRecords");
153
+ });
154
+
155
+ modelBuilder.Entity("FlowAPI.Domain.Entities.SharedGraph", b =>
156
+ {
157
+ b.Property<Guid>("Id")
158
+ .ValueGeneratedOnAdd()
159
+ .HasColumnType("TEXT");
160
+
161
+ b.Property<DateTime>("CreatedAt")
162
+ .HasColumnType("TEXT");
163
+
164
+ b.Property<Guid>("GraphId")
165
+ .HasColumnType("TEXT");
166
+
167
+ b.Property<string>("Permission")
168
+ .IsRequired()
169
+ .ValueGeneratedOnAdd()
170
+ .HasMaxLength(50)
171
+ .HasColumnType("TEXT")
172
+ .HasDefaultValue("Read");
173
+
174
+ b.Property<Guid>("SharedWithUserId")
175
+ .HasColumnType("TEXT");
176
+
177
+ b.HasKey("Id");
178
+
179
+ b.HasIndex("SharedWithUserId");
180
+
181
+ b.HasIndex("GraphId", "SharedWithUserId")
182
+ .IsUnique();
183
+
184
+ b.ToTable("SharedGraphs");
185
+ });
186
+
187
+ modelBuilder.Entity("FlowAPI.Domain.Entities.TaskNode", b =>
188
+ {
189
+ b.Property<Guid>("Id")
190
+ .ValueGeneratedOnAdd()
191
+ .HasColumnType("TEXT");
192
+
193
+ b.Property<string>("Color")
194
+ .HasMaxLength(100)
195
+ .HasColumnType("TEXT");
196
+
197
+ b.Property<DateTime>("CreatedAt")
198
+ .HasColumnType("TEXT");
199
+
200
+ b.Property<string>("Data")
201
+ .HasColumnType("TEXT");
202
+
203
+ b.Property<string>("Decision")
204
+ .HasMaxLength(10000)
205
+ .HasColumnType("TEXT");
206
+
207
+ b.Property<string>("Description")
208
+ .HasMaxLength(5000)
209
+ .HasColumnType("TEXT");
210
+
211
+ b.Property<Guid>("GraphId")
212
+ .HasColumnType("TEXT");
213
+
214
+ b.Property<double?>("Height")
215
+ .HasColumnType("REAL");
216
+
217
+ b.Property<bool>("IsPinned")
218
+ .HasColumnType("INTEGER");
219
+
220
+ b.Property<string>("Label")
221
+ .IsRequired()
222
+ .HasMaxLength(500)
223
+ .HasColumnType("TEXT");
224
+
225
+ b.Property<double>("PosX")
226
+ .HasColumnType("REAL");
227
+
228
+ b.Property<double>("PosY")
229
+ .HasColumnType("REAL");
230
+
231
+ b.Property<string>("State")
232
+ .IsRequired()
233
+ .ValueGeneratedOnAdd()
234
+ .HasColumnType("TEXT")
235
+ .HasDefaultValue("Pending");
236
+
237
+ b.Property<string>("Type")
238
+ .IsRequired()
239
+ .ValueGeneratedOnAdd()
240
+ .HasMaxLength(100)
241
+ .HasColumnType("TEXT")
242
+ .HasDefaultValue("sketch");
243
+
244
+ b.Property<double?>("Width")
245
+ .HasColumnType("REAL");
246
+
247
+ b.HasKey("Id");
248
+
249
+ b.HasIndex("GraphId");
250
+
251
+ b.ToTable("TaskNodes");
252
+ });
253
+
254
+ modelBuilder.Entity("FlowAPI.Domain.Entities.User", b =>
255
+ {
256
+ b.Property<Guid>("Id")
257
+ .ValueGeneratedOnAdd()
258
+ .HasColumnType("TEXT");
259
+
260
+ b.Property<string>("AvatarUrl")
261
+ .HasColumnType("TEXT");
262
+
263
+ b.Property<DateTime>("CreatedAt")
264
+ .HasColumnType("TEXT");
265
+
266
+ b.Property<string>("DisplayName")
267
+ .IsRequired()
268
+ .HasMaxLength(100)
269
+ .HasColumnType("TEXT");
270
+
271
+ b.Property<string>("Email")
272
+ .IsRequired()
273
+ .HasMaxLength(256)
274
+ .HasColumnType("TEXT");
275
+
276
+ b.Property<bool>("IsPremium")
277
+ .HasColumnType("INTEGER");
278
+
279
+ b.Property<string>("PasswordHash")
280
+ .IsRequired()
281
+ .HasColumnType("TEXT");
282
+
283
+ b.HasKey("Id");
284
+
285
+ b.HasIndex("Email")
286
+ .IsUnique();
287
+
288
+ b.ToTable("Users");
289
+ });
290
+
291
+ modelBuilder.Entity("FlowAPI.Domain.Entities.UserAchievement", b =>
292
+ {
293
+ b.Property<Guid>("Id")
294
+ .ValueGeneratedOnAdd()
295
+ .HasColumnType("TEXT");
296
+
297
+ b.Property<Guid>("AchievementId")
298
+ .HasColumnType("TEXT");
299
+
300
+ b.Property<int>("CurrentValue")
301
+ .HasColumnType("INTEGER");
302
+
303
+ b.Property<bool>("IsUnlocked")
304
+ .HasColumnType("INTEGER");
305
+
306
+ b.Property<DateTime?>("UnlockedAt")
307
+ .HasColumnType("TEXT");
308
+
309
+ b.Property<Guid>("UserId")
310
+ .HasColumnType("TEXT");
311
+
312
+ b.HasKey("Id");
313
+
314
+ b.HasIndex("AchievementId");
315
+
316
+ b.HasIndex("UserId");
317
+
318
+ b.ToTable("UserAchievements");
319
+ });
320
+
321
+ modelBuilder.Entity("FlowAPI.Domain.Entities.Edge", b =>
322
+ {
323
+ b.HasOne("FlowAPI.Domain.Entities.TaskNode", "FromNode")
324
+ .WithMany("OutgoingEdges")
325
+ .HasForeignKey("FromNodeId")
326
+ .OnDelete(DeleteBehavior.Cascade)
327
+ .IsRequired();
328
+
329
+ b.HasOne("FlowAPI.Domain.Entities.Graph", "Graph")
330
+ .WithMany("Edges")
331
+ .HasForeignKey("GraphId")
332
+ .OnDelete(DeleteBehavior.Cascade)
333
+ .IsRequired();
334
+
335
+ b.HasOne("FlowAPI.Domain.Entities.TaskNode", "ToNode")
336
+ .WithMany("IncomingEdges")
337
+ .HasForeignKey("ToNodeId")
338
+ .OnDelete(DeleteBehavior.Cascade)
339
+ .IsRequired();
340
+
341
+ b.Navigation("FromNode");
342
+
343
+ b.Navigation("Graph");
344
+
345
+ b.Navigation("ToNode");
346
+ });
347
+
348
+ modelBuilder.Entity("FlowAPI.Domain.Entities.Graph", b =>
349
+ {
350
+ b.HasOne("FlowAPI.Domain.Entities.User", "User")
351
+ .WithMany("Graphs")
352
+ .HasForeignKey("UserId")
353
+ .OnDelete(DeleteBehavior.Cascade)
354
+ .IsRequired();
355
+
356
+ b.Navigation("User");
357
+ });
358
+
359
+ modelBuilder.Entity("FlowAPI.Domain.Entities.HabitRecord", b =>
360
+ {
361
+ b.HasOne("FlowAPI.Domain.Entities.User", "User")
362
+ .WithMany("HabitRecords")
363
+ .HasForeignKey("UserId")
364
+ .OnDelete(DeleteBehavior.Cascade)
365
+ .IsRequired();
366
+
367
+ b.Navigation("User");
368
+ });
369
+
370
+ modelBuilder.Entity("FlowAPI.Domain.Entities.SharedGraph", b =>
371
+ {
372
+ b.HasOne("FlowAPI.Domain.Entities.Graph", "Graph")
373
+ .WithMany("SharedGraphs")
374
+ .HasForeignKey("GraphId")
375
+ .OnDelete(DeleteBehavior.Cascade)
376
+ .IsRequired();
377
+
378
+ b.HasOne("FlowAPI.Domain.Entities.User", "SharedWithUser")
379
+ .WithMany("SharedGraphs")
380
+ .HasForeignKey("SharedWithUserId")
381
+ .OnDelete(DeleteBehavior.Cascade)
382
+ .IsRequired();
383
+
384
+ b.Navigation("Graph");
385
+
386
+ b.Navigation("SharedWithUser");
387
+ });
388
+
389
+ modelBuilder.Entity("FlowAPI.Domain.Entities.TaskNode", b =>
390
+ {
391
+ b.HasOne("FlowAPI.Domain.Entities.Graph", "Graph")
392
+ .WithMany("Nodes")
393
+ .HasForeignKey("GraphId")
394
+ .OnDelete(DeleteBehavior.Cascade)
395
+ .IsRequired();
396
+
397
+ b.Navigation("Graph");
398
+ });
399
+
400
+ modelBuilder.Entity("FlowAPI.Domain.Entities.UserAchievement", b =>
401
+ {
402
+ b.HasOne("FlowAPI.Domain.Entities.Achievement", "Achievement")
403
+ .WithMany()
404
+ .HasForeignKey("AchievementId")
405
+ .OnDelete(DeleteBehavior.Cascade)
406
+ .IsRequired();
407
+
408
+ b.HasOne("FlowAPI.Domain.Entities.User", "User")
409
+ .WithMany("UserAchievements")
410
+ .HasForeignKey("UserId")
411
+ .OnDelete(DeleteBehavior.Cascade)
412
+ .IsRequired();
413
+
414
+ b.Navigation("Achievement");
415
+
416
+ b.Navigation("User");
417
+ });
418
+
419
+ modelBuilder.Entity("FlowAPI.Domain.Entities.Graph", b =>
420
+ {
421
+ b.Navigation("Edges");
422
+
423
+ b.Navigation("Nodes");
424
+
425
+ b.Navigation("SharedGraphs");
426
+ });
427
+
428
+ modelBuilder.Entity("FlowAPI.Domain.Entities.TaskNode", b =>
429
+ {
430
+ b.Navigation("IncomingEdges");
431
+
432
+ b.Navigation("OutgoingEdges");
433
+ });
434
+
435
+ modelBuilder.Entity("FlowAPI.Domain.Entities.User", b =>
436
+ {
437
+ b.Navigation("Graphs");
438
+
439
+ b.Navigation("HabitRecords");
440
+
441
+ b.Navigation("SharedGraphs");
442
+
443
+ b.Navigation("UserAchievements");
444
+ });
445
+ #pragma warning restore 612, 618
446
+ }
447
+ }
448
+ }
FlowAPI.Infrastructure/Migrations/20260521162648_ChangeEdgeConditionToString.cs ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ using Microsoft.EntityFrameworkCore.Migrations;
2
+
3
+ #nullable disable
4
+
5
+ namespace FlowAPI.Infrastructure.Migrations
6
+ {
7
+ /// <inheritdoc />
8
+ public partial class ChangeEdgeConditionToString : Migration
9
+ {
10
+ /// <inheritdoc />
11
+ protected override void Up(MigrationBuilder migrationBuilder)
12
+ {
13
+ migrationBuilder.AlterColumn<string>(
14
+ name: "Condition",
15
+ table: "Edges",
16
+ type: "TEXT",
17
+ maxLength: 50,
18
+ nullable: false,
19
+ oldClrType: typeof(int),
20
+ oldType: "INTEGER",
21
+ oldMaxLength: 50);
22
+ }
23
+
24
+ /// <inheritdoc />
25
+ protected override void Down(MigrationBuilder migrationBuilder)
26
+ {
27
+ migrationBuilder.AlterColumn<int>(
28
+ name: "Condition",
29
+ table: "Edges",
30
+ type: "INTEGER",
31
+ maxLength: 50,
32
+ nullable: false,
33
+ oldClrType: typeof(string),
34
+ oldType: "TEXT",
35
+ oldMaxLength: 50);
36
+ }
37
+ }
38
+ }
FlowAPI.Infrastructure/Migrations/AppDbContextModelSnapshot.cs CHANGED
@@ -66,9 +66,10 @@ namespace FlowAPI.Infrastructure.Migrations
66
  .ValueGeneratedOnAdd()
67
  .HasColumnType("TEXT");
68
 
69
- b.Property<int>("Condition")
 
70
  .HasMaxLength(50)
71
- .HasColumnType("INTEGER");
72
 
73
  b.Property<Guid>("FromNodeId")
74
  .HasColumnType("TEXT");
 
66
  .ValueGeneratedOnAdd()
67
  .HasColumnType("TEXT");
68
 
69
+ b.Property<string>("Condition")
70
+ .IsRequired()
71
  .HasMaxLength(50)
72
+ .HasColumnType("TEXT");
73
 
74
  b.Property<Guid>("FromNodeId")
75
  .HasColumnType("TEXT");
FlowAPI.Infrastructure/Repositories/GraphRepository.cs CHANGED
@@ -67,7 +67,7 @@ namespace FlowAPI.Infrastructure.Repositories
67
  var deletedNodeIds = nodesToDelete.Select(n => n.Id).ToHashSet();
68
 
69
  var edgesToDelete = existingEdges
70
- .Where(e => !incomingEdges.Any(i => i.FromNodeId == e.FromNodeId && i.ToNodeId == e.ToNodeId)
71
  || deletedNodeIds.Contains(e.FromNodeId)
72
  || deletedNodeIds.Contains(e.ToNodeId))
73
  .ToList();
@@ -120,7 +120,7 @@ namespace FlowAPI.Infrastructure.Repositories
120
  continue;
121
  }
122
 
123
- var existingEdge = existingEdges.FirstOrDefault(e => e.FromNodeId == edge.FromNodeId && e.ToNodeId == edge.ToNodeId);
124
  if (existingEdge != null)
125
  {
126
  existingEdge.Condition = edge.Condition;
 
67
  var deletedNodeIds = nodesToDelete.Select(n => n.Id).ToHashSet();
68
 
69
  var edgesToDelete = existingEdges
70
+ .Where(e => !incomingEdges.Any(i => i.FromNodeId == e.FromNodeId && i.ToNodeId == e.ToNodeId && i.Condition == e.Condition)
71
  || deletedNodeIds.Contains(e.FromNodeId)
72
  || deletedNodeIds.Contains(e.ToNodeId))
73
  .ToList();
 
120
  continue;
121
  }
122
 
123
+ var existingEdge = existingEdges.FirstOrDefault(e => e.FromNodeId == edge.FromNodeId && e.ToNodeId == edge.ToNodeId && e.Condition == edge.Condition);
124
  if (existingEdge != null)
125
  {
126
  existingEdge.Condition = edge.Condition;