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

fix: resolve canvas image persistence and increase database field limits

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