Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 240d2e5b

Přidáno uživatelem Milan Hotovec před téměř 4 roky(ů)

Goals initial connected

Zobrazit rozdíly:

src/Core/Infrastructure/Leuze.Core.Infrastructure.Persistence/Migrations/20210511102009_EditPercentile.Designer.cs
1
// <auto-generated />
2
using System;
3
using Leuze.Core.Infrastructure.Persistence;
4
using Microsoft.EntityFrameworkCore;
5
using Microsoft.EntityFrameworkCore.Infrastructure;
6
using Microsoft.EntityFrameworkCore.Metadata;
7
using Microsoft.EntityFrameworkCore.Migrations;
8
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
9

  
10
namespace Leuze.Core.Infrastructure.Persistence.Migrations
11
{
12
    [DbContext(typeof(LeuzeDbContext))]
13
    [Migration("20210511102009_EditPercentile")]
14
    partial class EditPercentile
15
    {
16
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
17
        {
18
#pragma warning disable 612, 618
19
            modelBuilder
20
                .HasAnnotation("Relational:MaxIdentifierLength", 128)
21
                .HasAnnotation("ProductVersion", "5.0.4")
22
                .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
23

  
24
            modelBuilder.Entity("ApplicationPermissionApplicationRole", b =>
25
                {
26
                    b.Property<Guid>("PermissionsId")
27
                        .HasColumnType("uniqueidentifier");
28

  
29
                    b.Property<Guid>("RolesId")
30
                        .HasColumnType("uniqueidentifier");
31

  
32
                    b.HasKey("PermissionsId", "RolesId");
33

  
34
                    b.HasIndex("RolesId");
35

  
36
                    b.ToTable("Leuze_Roles_Assigned_Permissions");
37
                });
38

  
39
            modelBuilder.Entity("Leuze.Core.Application.Identity.ApplicationPermission", b =>
40
                {
41
                    b.Property<Guid>("Id")
42
                        .ValueGeneratedOnAdd()
43
                        .HasColumnType("uniqueidentifier");
44

  
45
                    b.Property<string>("Module")
46
                        .IsRequired()
47
                        .HasMaxLength(512)
48
                        .HasColumnType("nvarchar(512)");
49

  
50
                    b.Property<string>("Name")
51
                        .IsRequired()
52
                        .HasMaxLength(512)
53
                        .HasColumnType("nvarchar(512)");
54

  
55
                    b.Property<string>("Privilege")
56
                        .IsRequired()
57
                        .HasMaxLength(2048)
58
                        .HasColumnType("nvarchar(2048)");
59

  
60
                    b.HasKey("Id");
61

  
62
                    b.ToTable("Leuze_Application_Permissions");
63
                });
64

  
65
            modelBuilder.Entity("Leuze.Core.Application.Identity.ApplicationRole", b =>
66
                {
67
                    b.Property<Guid>("Id")
68
                        .ValueGeneratedOnAdd()
69
                        .HasColumnType("uniqueidentifier");
70

  
71
                    b.Property<string>("ConcurrencyStamp")
72
                        .IsConcurrencyToken()
73
                        .HasColumnType("nvarchar(max)");
74

  
75
                    b.Property<bool>("IsDefault")
76
                        .HasColumnType("bit");
77

  
78
                    b.Property<string>("Name")
79
                        .HasMaxLength(256)
80
                        .HasColumnType("nvarchar(256)");
81

  
82
                    b.Property<string>("NormalizedName")
83
                        .HasMaxLength(256)
84
                        .HasColumnType("nvarchar(256)");
85

  
86
                    b.HasKey("Id");
87

  
88
                    b.HasIndex("NormalizedName")
89
                        .IsUnique()
90
                        .HasDatabaseName("RoleNameIndex")
91
                        .HasFilter("[NormalizedName] IS NOT NULL");
92

  
93
                    b.ToTable("Leuze_Roles");
94
                });
95

  
96
            modelBuilder.Entity("Leuze.Core.Application.Identity.ApplicationRoleClaim", b =>
97
                {
98
                    b.Property<int>("Id")
99
                        .ValueGeneratedOnAdd()
100
                        .HasColumnType("int")
101
                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
102

  
103
                    b.Property<string>("ClaimType")
104
                        .HasColumnType("nvarchar(max)");
105

  
106
                    b.Property<string>("ClaimValue")
107
                        .HasColumnType("nvarchar(max)");
108

  
109
                    b.Property<Guid>("RoleId")
110
                        .HasColumnType("uniqueidentifier");
111

  
112
                    b.HasKey("Id");
113

  
114
                    b.HasIndex("RoleId");
115

  
116
                    b.ToTable("AspNetRoleClaims");
117
                });
118

  
119
            modelBuilder.Entity("Leuze.Core.Application.Identity.ApplicationUser", b =>
120
                {
121
                    b.Property<Guid>("Id")
122
                        .ValueGeneratedOnAdd()
123
                        .HasColumnType("uniqueidentifier");
124

  
125
                    b.Property<int>("AccessFailedCount")
126
                        .HasColumnType("int");
127

  
128
                    b.Property<string>("ConcurrencyStamp")
129
                        .IsConcurrencyToken()
130
                        .HasColumnType("nvarchar(max)");
131

  
132
                    b.Property<string>("Email")
133
                        .HasMaxLength(256)
134
                        .HasColumnType("nvarchar(256)");
135

  
136
                    b.Property<bool>("EmailConfirmed")
137
                        .HasColumnType("bit");
138

  
139
                    b.Property<bool>("IsAdUser")
140
                        .HasColumnType("bit");
141

  
142
                    b.Property<bool>("LockoutEnabled")
143
                        .HasColumnType("bit");
144

  
145
                    b.Property<DateTimeOffset?>("LockoutEnd")
146
                        .HasColumnType("datetimeoffset");
147

  
148
                    b.Property<string>("NormalizedEmail")
149
                        .HasMaxLength(256)
150
                        .HasColumnType("nvarchar(256)");
151

  
152
                    b.Property<string>("NormalizedUserName")
153
                        .HasMaxLength(256)
154
                        .HasColumnType("nvarchar(256)");
155

  
156
                    b.Property<string>("PasswordHash")
157
                        .HasColumnType("nvarchar(max)");
158

  
159
                    b.Property<string>("PhoneNumber")
160
                        .HasColumnType("nvarchar(max)");
161

  
162
                    b.Property<bool>("PhoneNumberConfirmed")
163
                        .HasColumnType("bit");
164

  
165
                    b.Property<string>("SecurityStamp")
166
                        .HasColumnType("nvarchar(max)");
167

  
168
                    b.Property<bool>("TwoFactorEnabled")
169
                        .HasColumnType("bit");
170

  
171
                    b.Property<string>("UserName")
172
                        .HasMaxLength(256)
173
                        .HasColumnType("nvarchar(256)");
174

  
175
                    b.HasKey("Id");
176

  
177
                    b.HasIndex("NormalizedEmail")
178
                        .HasDatabaseName("EmailIndex");
179

  
180
                    b.HasIndex("NormalizedUserName")
181
                        .IsUnique()
182
                        .HasDatabaseName("UserNameIndex")
183
                        .HasFilter("[NormalizedUserName] IS NOT NULL");
184

  
185
                    b.ToTable("Leuze_Users");
186
                });
187

  
188
            modelBuilder.Entity("Leuze.Core.Application.Identity.ApplicationUserClaim", b =>
189
                {
190
                    b.Property<int>("Id")
191
                        .ValueGeneratedOnAdd()
192
                        .HasColumnType("int")
193
                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
194

  
195
                    b.Property<string>("ClaimType")
196
                        .HasColumnType("nvarchar(max)");
197

  
198
                    b.Property<string>("ClaimValue")
199
                        .HasColumnType("nvarchar(max)");
200

  
201
                    b.Property<Guid>("UserId")
202
                        .HasColumnType("uniqueidentifier");
203

  
204
                    b.HasKey("Id");
205

  
206
                    b.HasIndex("UserId");
207

  
208
                    b.ToTable("AspNetUserClaims");
209
                });
210

  
211
            modelBuilder.Entity("Leuze.Core.Application.Identity.ApplicationUserLogin", b =>
212
                {
213
                    b.Property<string>("LoginProvider")
214
                        .HasColumnType("nvarchar(450)");
215

  
216
                    b.Property<string>("ProviderKey")
217
                        .HasColumnType("nvarchar(450)");
218

  
219
                    b.Property<string>("ProviderDisplayName")
220
                        .HasColumnType("nvarchar(max)");
221

  
222
                    b.Property<Guid>("UserId")
223
                        .HasColumnType("uniqueidentifier");
224

  
225
                    b.HasKey("LoginProvider", "ProviderKey");
226

  
227
                    b.HasIndex("UserId");
228

  
229
                    b.ToTable("AspNetUserLogins");
230
                });
231

  
232
            modelBuilder.Entity("Leuze.Core.Application.Identity.ApplicationUserRole", b =>
233
                {
234
                    b.Property<Guid>("UserId")
235
                        .HasColumnType("uniqueidentifier");
236

  
237
                    b.Property<Guid>("RoleId")
238
                        .HasColumnType("uniqueidentifier");
239

  
240
                    b.HasKey("UserId", "RoleId");
241

  
242
                    b.HasIndex("RoleId");
243

  
244
                    b.ToTable("AspNetUserRoles");
245
                });
246

  
247
            modelBuilder.Entity("Leuze.Core.Application.Identity.ApplicationUserToken", b =>
248
                {
249
                    b.Property<Guid>("UserId")
250
                        .HasColumnType("uniqueidentifier");
251

  
252
                    b.Property<string>("LoginProvider")
253
                        .HasColumnType("nvarchar(450)");
254

  
255
                    b.Property<string>("Name")
256
                        .HasColumnType("nvarchar(450)");
257

  
258
                    b.Property<string>("Value")
259
                        .HasColumnType("nvarchar(max)");
260

  
261
                    b.HasKey("UserId", "LoginProvider", "Name");
262

  
263
                    b.ToTable("AspNetUserTokens");
264
                });
265

  
266
            modelBuilder.Entity("Leuze.Core.Domain.Domains.Users.DomainUser", b =>
267
                {
268
                    b.Property<Guid>("UserId")
269
                        .HasColumnType("uniqueidentifier");
270

  
271
                    b.Property<Guid?>("SeniorUserId")
272
                        .HasColumnType("uniqueidentifier");
273

  
274
                    b.HasKey("UserId");
275

  
276
                    b.HasIndex("SeniorUserId");
277

  
278
                    b.ToTable("Leuze_Domain_Users");
279
                });
280

  
281
            modelBuilder.Entity("Leuze.Modules.Goal.Domain.Domains.Comment", b =>
282
                {
283
                    b.Property<Guid>("Id")
284
                        .ValueGeneratedOnAdd()
285
                        .HasColumnType("uniqueidentifier");
286

  
287
                    b.Property<Guid>("CreatorId")
288
                        .HasColumnType("uniqueidentifier");
289

  
290
                    b.Property<Guid>("GoalId")
291
                        .HasColumnType("uniqueidentifier");
292

  
293
                    b.Property<bool>("IsChanged")
294
                        .HasColumnType("bit");
295

  
296
                    b.Property<bool>("IsPrivate")
297
                        .HasColumnType("bit");
298

  
299
                    b.Property<string>("Text")
300
                        .IsRequired()
301
                        .HasColumnType("nvarchar(max)");
302

  
303
                    b.HasKey("Id");
304

  
305
                    b.HasIndex("CreatorId");
306

  
307
                    b.HasIndex("GoalId");
308

  
309
                    b.ToTable("Leuze_Modules_Goal_Domain_Comments");
310
                });
311

  
312
            modelBuilder.Entity("Leuze.Modules.Goal.Domain.Domains.GoalDefinition", b =>
313
                {
314
                    b.Property<Guid>("Id")
315
                        .ValueGeneratedOnAdd()
316
                        .HasColumnType("uniqueidentifier");
317

  
318
                    b.Property<Guid>("CreatorId")
319
                        .HasColumnType("uniqueidentifier");
320

  
321
                    b.Property<DateTime>("From")
322
                        .HasColumnType("datetime2");
323

  
324
                    b.Property<string>("Name")
325
                        .IsRequired()
326
                        .HasMaxLength(255)
327
                        .HasColumnType("nvarchar(255)");
328

  
329
                    b.Property<Guid>("OwnerId")
330
                        .HasColumnType("uniqueidentifier");
331

  
332
                    b.Property<bool>("OwnerLocked")
333
                        .HasColumnType("bit");
334

  
335
                    b.Property<bool>("SupervisorLocked")
336
                        .HasColumnType("bit");
337

  
338
                    b.Property<DateTime>("To")
339
                        .HasColumnType("datetime2");
340

  
341
                    b.Property<decimal?>("Vari")
342
                        .HasColumnType("decimal(18,2)");
343

  
344
                    b.HasKey("Id");
345

  
346
                    b.HasIndex("CreatorId");
347

  
348
                    b.HasIndex("OwnerId");
349

  
350
                    b.ToTable("Leuze_Modules_Goal_Domain_GoalDefinitions");
351
                });
352

  
353
            modelBuilder.Entity("Leuze.Modules.Goal.Domain.Domains.GoalItem", b =>
354
                {
355
                    b.Property<Guid>("Id")
356
                        .ValueGeneratedOnAdd()
357
                        .HasColumnType("uniqueidentifier");
358

  
359
                    b.Property<Guid>("CreatorId")
360
                        .HasColumnType("uniqueidentifier");
361

  
362
                    b.Property<string>("Description")
363
                        .IsRequired()
364
                        .HasColumnType("nvarchar(max)");
365

  
366
                    b.Property<Guid>("GoalDefinitionId")
367
                        .HasColumnType("uniqueidentifier");
368

  
369
                    b.Property<string>("Name")
370
                        .IsRequired()
371
                        .HasMaxLength(255)
372
                        .HasColumnType("nvarchar(255)");
373

  
374
                    b.Property<decimal>("PercentileFinal")
375
                        .HasColumnType("decimal(18,2)");
376

  
377
                    b.Property<decimal>("PercentileUser")
378
                        .HasColumnType("decimal(18,2)");
379

  
380
                    b.HasKey("Id");
381

  
382
                    b.HasIndex("CreatorId");
383

  
384
                    b.HasIndex("GoalDefinitionId");
385

  
386
                    b.ToTable("Leuze_Modules_Goal_Domain_GoalItems");
387
                });
388

  
389
            modelBuilder.Entity("Leuze.Modules.Goal.Domain.Domains.GoalUpdate", b =>
390
                {
391
                    b.Property<Guid>("Id")
392
                        .ValueGeneratedOnAdd()
393
                        .HasColumnType("uniqueidentifier");
394

  
395
                    b.Property<Guid>("CreatorId")
396
                        .HasColumnType("uniqueidentifier");
397

  
398
                    b.Property<Guid>("GoalId")
399
                        .HasColumnType("uniqueidentifier");
400

  
401
                    b.Property<string>("NewValue")
402
                        .IsRequired()
403
                        .HasColumnType("nvarchar(max)");
404

  
405
                    b.Property<string>("OldValue")
406
                        .IsRequired()
407
                        .HasColumnType("nvarchar(max)");
408

  
409
                    b.Property<int>("UpdatedType")
410
                        .HasColumnType("int");
411

  
412
                    b.HasKey("Id");
413

  
414
                    b.HasIndex("CreatorId");
415

  
416
                    b.HasIndex("GoalId");
417

  
418
                    b.ToTable("Leuze_Modules_Goal_Domain_GoalUpdates");
419
                });
420

  
421
            modelBuilder.Entity("Leuze.Modules.Goal.Domain.Domains.Review", b =>
422
                {
423
                    b.Property<Guid>("Id")
424
                        .ValueGeneratedOnAdd()
425
                        .HasColumnType("uniqueidentifier");
426

  
427
                    b.Property<string>("CommentCreator")
428
                        .IsRequired()
429
                        .HasColumnType("nvarchar(max)");
430

  
431
                    b.Property<string>("CommentOwner")
432
                        .IsRequired()
433
                        .HasColumnType("nvarchar(max)");
434

  
435
                    b.Property<Guid>("CreatorId")
436
                        .HasColumnType("uniqueidentifier");
437

  
438
                    b.Property<Guid>("GoalId")
439
                        .HasColumnType("uniqueidentifier");
440

  
441
                    b.Property<bool>("IsFinal")
442
                        .HasColumnType("bit");
443

  
444
                    b.HasKey("Id");
445

  
446
                    b.HasIndex("CreatorId");
447

  
448
                    b.HasIndex("GoalId");
449

  
450
                    b.ToTable("Leuze_Modules_Goal_Domain_Reviews");
451
                });
452

  
453
            modelBuilder.Entity("ApplicationPermissionApplicationRole", b =>
454
                {
455
                    b.HasOne("Leuze.Core.Application.Identity.ApplicationPermission", null)
456
                        .WithMany()
457
                        .HasForeignKey("PermissionsId")
458
                        .OnDelete(DeleteBehavior.Cascade)
459
                        .IsRequired();
460

  
461
                    b.HasOne("Leuze.Core.Application.Identity.ApplicationRole", null)
462
                        .WithMany()
463
                        .HasForeignKey("RolesId")
464
                        .OnDelete(DeleteBehavior.Cascade)
465
                        .IsRequired();
466
                });
467

  
468
            modelBuilder.Entity("Leuze.Core.Application.Identity.ApplicationRoleClaim", b =>
469
                {
470
                    b.HasOne("Leuze.Core.Application.Identity.ApplicationRole", null)
471
                        .WithMany()
472
                        .HasForeignKey("RoleId")
473
                        .OnDelete(DeleteBehavior.Cascade)
474
                        .IsRequired();
475
                });
476

  
477
            modelBuilder.Entity("Leuze.Core.Application.Identity.ApplicationUserClaim", b =>
478
                {
479
                    b.HasOne("Leuze.Core.Application.Identity.ApplicationUser", null)
480
                        .WithMany()
481
                        .HasForeignKey("UserId")
482
                        .OnDelete(DeleteBehavior.Cascade)
483
                        .IsRequired();
484
                });
485

  
486
            modelBuilder.Entity("Leuze.Core.Application.Identity.ApplicationUserLogin", b =>
487
                {
488
                    b.HasOne("Leuze.Core.Application.Identity.ApplicationUser", null)
489
                        .WithMany()
490
                        .HasForeignKey("UserId")
491
                        .OnDelete(DeleteBehavior.Cascade)
492
                        .IsRequired();
493
                });
494

  
495
            modelBuilder.Entity("Leuze.Core.Application.Identity.ApplicationUserRole", b =>
496
                {
497
                    b.HasOne("Leuze.Core.Application.Identity.ApplicationRole", "Role")
498
                        .WithMany()
499
                        .HasForeignKey("RoleId")
500
                        .OnDelete(DeleteBehavior.Cascade)
501
                        .IsRequired();
502

  
503
                    b.HasOne("Leuze.Core.Application.Identity.ApplicationUser", "User")
504
                        .WithMany()
505
                        .HasForeignKey("UserId")
506
                        .OnDelete(DeleteBehavior.Cascade)
507
                        .IsRequired();
508

  
509
                    b.Navigation("Role");
510

  
511
                    b.Navigation("User");
512
                });
513

  
514
            modelBuilder.Entity("Leuze.Core.Application.Identity.ApplicationUserToken", b =>
515
                {
516
                    b.HasOne("Leuze.Core.Application.Identity.ApplicationUser", null)
517
                        .WithMany()
518
                        .HasForeignKey("UserId")
519
                        .OnDelete(DeleteBehavior.Cascade)
520
                        .IsRequired();
521
                });
522

  
523
            modelBuilder.Entity("Leuze.Core.Domain.Domains.Users.DomainUser", b =>
524
                {
525
                    b.HasOne("Leuze.Core.Domain.Domains.Users.DomainUser", "SeniorUser")
526
                        .WithMany("Juniors")
527
                        .HasForeignKey("SeniorUserId");
528

  
529
                    b.HasOne("Leuze.Core.Application.Identity.ApplicationUser", "User")
530
                        .WithOne()
531
                        .HasForeignKey("Leuze.Core.Domain.Domains.Users.DomainUser", "UserId")
532
                        .OnDelete(DeleteBehavior.Cascade)
533
                        .IsRequired();
534

  
535
                    b.OwnsOne("Leuze.Core.Domain.Domains.Shared.ValueObjects.EmailAddress", "EmailAddress", b1 =>
536
                        {
537
                            b1.Property<Guid>("DomainUserUserId")
538
                                .HasColumnType("uniqueidentifier");
539

  
540
                            b1.Property<string>("Email")
541
                                .IsRequired()
542
                                .HasMaxLength(512)
543
                                .HasColumnType("nvarchar(512)");
544

  
545
                            b1.HasKey("DomainUserUserId");
546

  
547
                            b1.ToTable("Leuze_Domain_Users");
548

  
549
                            b1.WithOwner()
550
                                .HasForeignKey("DomainUserUserId");
551
                        });
552

  
553
                    b.OwnsOne("Leuze.Core.Domain.Domains.Shared.ValueObjects.PersonFullName", "Name", b1 =>
554
                        {
555
                            b1.Property<Guid>("DomainUserUserId")
556
                                .HasColumnType("uniqueidentifier");
557

  
558
                            b1.Property<string>("FullName")
559
                                .IsRequired()
560
                                .HasMaxLength(256)
561
                                .HasColumnType("nvarchar(256)");
562

  
563
                            b1.HasKey("DomainUserUserId");
564

  
565
                            b1.ToTable("Leuze_Domain_Users");
566

  
567
                            b1.WithOwner()
568
                                .HasForeignKey("DomainUserUserId");
569
                        });
570

  
571
                    b.Navigation("EmailAddress")
572
                        .IsRequired();
573

  
574
                    b.Navigation("Name")
575
                        .IsRequired();
576

  
577
                    b.Navigation("SeniorUser");
578

  
579
                    b.Navigation("User");
580
                });
581

  
582
            modelBuilder.Entity("Leuze.Modules.Goal.Domain.Domains.Comment", b =>
583
                {
584
                    b.HasOne("Leuze.Core.Domain.Domains.Users.DomainUser", "Creator")
585
                        .WithMany()
586
                        .HasForeignKey("CreatorId")
587
                        .OnDelete(DeleteBehavior.Cascade)
588
                        .IsRequired();
589

  
590
                    b.HasOne("Leuze.Modules.Goal.Domain.Domains.GoalItem", "Goal")
591
                        .WithMany("Comments")
592
                        .HasForeignKey("GoalId")
593
                        .OnDelete(DeleteBehavior.Cascade)
594
                        .IsRequired();
595

  
596
                    b.Navigation("Creator");
597

  
598
                    b.Navigation("Goal");
599
                });
600

  
601
            modelBuilder.Entity("Leuze.Modules.Goal.Domain.Domains.GoalDefinition", b =>
602
                {
603
                    b.HasOne("Leuze.Core.Domain.Domains.Users.DomainUser", "Creator")
604
                        .WithMany()
605
                        .HasForeignKey("CreatorId")
606
                        .OnDelete(DeleteBehavior.Cascade)
607
                        .IsRequired();
608

  
609
                    b.HasOne("Leuze.Core.Domain.Domains.Users.DomainUser", "Owner")
610
                        .WithMany()
611
                        .HasForeignKey("OwnerId")
612
                        .OnDelete(DeleteBehavior.Cascade)
613
                        .IsRequired();
614

  
615
                    b.Navigation("Creator");
616

  
617
                    b.Navigation("Owner");
618
                });
619

  
620
            modelBuilder.Entity("Leuze.Modules.Goal.Domain.Domains.GoalItem", b =>
621
                {
622
                    b.HasOne("Leuze.Core.Domain.Domains.Users.DomainUser", "Creator")
623
                        .WithMany()
624
                        .HasForeignKey("CreatorId")
625
                        .OnDelete(DeleteBehavior.Cascade)
626
                        .IsRequired();
627

  
628
                    b.HasOne("Leuze.Modules.Goal.Domain.Domains.GoalDefinition", "GoalDefinition")
629
                        .WithMany("Goals")
630
                        .HasForeignKey("GoalDefinitionId")
631
                        .OnDelete(DeleteBehavior.Cascade)
632
                        .IsRequired();
633

  
634
                    b.Navigation("Creator");
635

  
636
                    b.Navigation("GoalDefinition");
637
                });
638

  
639
            modelBuilder.Entity("Leuze.Modules.Goal.Domain.Domains.GoalUpdate", b =>
640
                {
641
                    b.HasOne("Leuze.Core.Domain.Domains.Users.DomainUser", "Creator")
642
                        .WithMany()
643
                        .HasForeignKey("CreatorId")
644
                        .OnDelete(DeleteBehavior.Cascade)
645
                        .IsRequired();
646

  
647
                    b.HasOne("Leuze.Modules.Goal.Domain.Domains.GoalItem", "Goal")
648
                        .WithMany("Updates")
649
                        .HasForeignKey("GoalId")
650
                        .OnDelete(DeleteBehavior.Cascade)
651
                        .IsRequired();
652

  
653
                    b.Navigation("Creator");
654

  
655
                    b.Navigation("Goal");
656
                });
657

  
658
            modelBuilder.Entity("Leuze.Modules.Goal.Domain.Domains.Review", b =>
659
                {
660
                    b.HasOne("Leuze.Core.Domain.Domains.Users.DomainUser", "Creator")
661
                        .WithMany()
662
                        .HasForeignKey("CreatorId")
663
                        .OnDelete(DeleteBehavior.Cascade)
664
                        .IsRequired();
665

  
666
                    b.HasOne("Leuze.Modules.Goal.Domain.Domains.GoalItem", "Goal")
667
                        .WithMany("Reviews")
668
                        .HasForeignKey("GoalId")
669
                        .OnDelete(DeleteBehavior.Cascade)
670
                        .IsRequired();
671

  
672
                    b.Navigation("Creator");
673

  
674
                    b.Navigation("Goal");
675
                });
676

  
677
            modelBuilder.Entity("Leuze.Core.Domain.Domains.Users.DomainUser", b =>
678
                {
679
                    b.Navigation("Juniors");
680
                });
681

  
682
            modelBuilder.Entity("Leuze.Modules.Goal.Domain.Domains.GoalDefinition", b =>
683
                {
684
                    b.Navigation("Goals");
685
                });
686

  
687
            modelBuilder.Entity("Leuze.Modules.Goal.Domain.Domains.GoalItem", b =>
688
                {
689
                    b.Navigation("Comments");
690

  
691
                    b.Navigation("Reviews");
692

  
693
                    b.Navigation("Updates");
694
                });
695
#pragma warning restore 612, 618
696
        }
697
    }
698
}
src/Core/Infrastructure/Leuze.Core.Infrastructure.Persistence/Migrations/20210511102009_EditPercentile.cs
1
using System;
2
using Microsoft.EntityFrameworkCore.Migrations;
3

  
4
namespace Leuze.Core.Infrastructure.Persistence.Migrations
5
{
6
    public partial class EditPercentile : Migration
7
    {
8
        protected override void Up(MigrationBuilder migrationBuilder)
9
        {
10
            migrationBuilder.AddColumn<bool>(
11
                name: "IsDefault",
12
                table: "Leuze_Roles",
13
                type: "bit",
14
                nullable: false,
15
                defaultValue: false);
16

  
17
            migrationBuilder.AlterColumn<decimal>(
18
                name: "PercentileUser",
19
                table: "Leuze_Modules_Goal_Domain_GoalItems",
20
                type: "decimal(18,2)",
21
                nullable: false,
22
                oldClrType: typeof(int),
23
                oldType: "int");
24

  
25
            migrationBuilder.AlterColumn<decimal>(
26
                name: "PercentileFinal",
27
                table: "Leuze_Modules_Goal_Domain_GoalItems",
28
                type: "decimal(18,2)",
29
                nullable: false,
30
                oldClrType: typeof(int),
31
                oldType: "int");
32

  
33
            migrationBuilder.AddColumn<Guid>(
34
                name: "SeniorUserId",
35
                table: "Leuze_Domain_Users",
36
                type: "uniqueidentifier",
37
                nullable: true);
38

  
39
            migrationBuilder.CreateIndex(
40
                name: "IX_Leuze_Domain_Users_SeniorUserId",
41
                table: "Leuze_Domain_Users",
42
                column: "SeniorUserId");
43

  
44
            migrationBuilder.AddForeignKey(
45
                name: "FK_Leuze_Domain_Users_Leuze_Domain_Users_SeniorUserId",
46
                table: "Leuze_Domain_Users",
47
                column: "SeniorUserId",
48
                principalTable: "Leuze_Domain_Users",
49
                principalColumn: "UserId",
50
                onDelete: ReferentialAction.Restrict);
51
        }
52

  
53
        protected override void Down(MigrationBuilder migrationBuilder)
54
        {
55
            migrationBuilder.DropForeignKey(
56
                name: "FK_Leuze_Domain_Users_Leuze_Domain_Users_SeniorUserId",
57
                table: "Leuze_Domain_Users");
58

  
59
            migrationBuilder.DropIndex(
60
                name: "IX_Leuze_Domain_Users_SeniorUserId",
61
                table: "Leuze_Domain_Users");
62

  
63
            migrationBuilder.DropColumn(
64
                name: "IsDefault",
65
                table: "Leuze_Roles");
66

  
67
            migrationBuilder.DropColumn(
68
                name: "SeniorUserId",
69
                table: "Leuze_Domain_Users");
70

  
71
            migrationBuilder.AlterColumn<int>(
72
                name: "PercentileUser",
73
                table: "Leuze_Modules_Goal_Domain_GoalItems",
74
                type: "int",
75
                nullable: false,
76
                oldClrType: typeof(decimal),
77
                oldType: "decimal(18,2)");
78

  
79
            migrationBuilder.AlterColumn<int>(
80
                name: "PercentileFinal",
81
                table: "Leuze_Modules_Goal_Domain_GoalItems",
82
                type: "int",
83
                nullable: false,
84
                oldClrType: typeof(decimal),
85
                oldType: "decimal(18,2)");
86
        }
87
    }
88
}
src/Core/Infrastructure/Leuze.Core.Infrastructure.Persistence/Migrations/LeuzeDbContextModelSnapshot.cs
70 70
                        .IsConcurrencyToken()
71 71
                        .HasColumnType("nvarchar(max)");
72 72

  
73
                    b.Property<bool>("IsDefault")
74
                        .HasColumnType("bit");
75

  
73 76
                    b.Property<string>("Name")
74 77
                        .HasMaxLength(256)
75 78
                        .HasColumnType("nvarchar(256)");
......
263 266
                    b.Property<Guid>("UserId")
264 267
                        .HasColumnType("uniqueidentifier");
265 268

  
269
                    b.Property<Guid?>("SeniorUserId")
270
                        .HasColumnType("uniqueidentifier");
271

  
266 272
                    b.HasKey("UserId");
267 273

  
274
                    b.HasIndex("SeniorUserId");
275

  
268 276
                    b.ToTable("Leuze_Domain_Users");
269 277
                });
270 278

  
......
361 369
                        .HasMaxLength(255)
362 370
                        .HasColumnType("nvarchar(255)");
363 371

  
364
                    b.Property<int>("PercentileFinal")
365
                        .HasColumnType("int");
372
                    b.Property<decimal>("PercentileFinal")
373
                        .HasColumnType("decimal(18,2)");
366 374

  
367
                    b.Property<int>("PercentileUser")
368
                        .HasColumnType("int");
375
                    b.Property<decimal>("PercentileUser")
376
                        .HasColumnType("decimal(18,2)");
369 377

  
370 378
                    b.HasKey("Id");
371 379

  
......
512 520

  
513 521
            modelBuilder.Entity("Leuze.Core.Domain.Domains.Users.DomainUser", b =>
514 522
                {
523
                    b.HasOne("Leuze.Core.Domain.Domains.Users.DomainUser", "SeniorUser")
524
                        .WithMany("Juniors")
525
                        .HasForeignKey("SeniorUserId");
526

  
515 527
                    b.HasOne("Leuze.Core.Application.Identity.ApplicationUser", "User")
516 528
                        .WithOne()
517 529
                        .HasForeignKey("Leuze.Core.Domain.Domains.Users.DomainUser", "UserId")
......
560 572
                    b.Navigation("Name")
561 573
                        .IsRequired();
562 574

  
575
                    b.Navigation("SeniorUser");
576

  
563 577
                    b.Navigation("User");
564 578
                });
565 579

  
......
658 672
                    b.Navigation("Goal");
659 673
                });
660 674

  
675
            modelBuilder.Entity("Leuze.Core.Domain.Domains.Users.DomainUser", b =>
676
                {
677
                    b.Navigation("Juniors");
678
                });
679

  
661 680
            modelBuilder.Entity("Leuze.Modules.Goal.Domain.Domains.GoalDefinition", b =>
662 681
                {
663 682
                    b.Navigation("Goals");
src/Modules/Goal/Application/Leuze.Modules.Goal.Application.UI/Pages/Components/CreateGoalAside.razor
1

1
@inject IMediator _mediator
2
@inject IToastService toastService
3

  
2 4
<aside class="@_aside review_detail">
3 5
    <div class="review_detail_header">
4 6
        <div>Vytvořit nový cíl</div>
......
10 12
    </div>
11 13
    <div class="review_detail_body">
12 14
        <div class="review_description_title">Název cíle</div>
13
        <input type="text" />
15
        <input type="text" @bind-value="Name" />
14 16
        <div class="review_description_title">Popis cíle</div>
15
        <textarea></textarea>
17
        <textarea @oninput="(item) => Description = item.Value.ToString()">@Description</textarea>
16 18
    </div>
17 19
    <div class="review_detail_footer">
18
        <button>Vytvořit</button>
20
        <button @onclick="Create">Vytvořit</button>
19 21
        <button>Zrušit</button>
20 22
    </div>
21 23
</aside>
......
123 125

  
124 126
    private string _aside;
125 127

  
128
    public string Name { get; set; }
129

  
130
    public string Description { get; set; }
131

  
126 132
    [Parameter]
127 133
    public bool Show { get; set; } = false;
128 134

  
135
    [Parameter]
136
    public Guid DefinitionId { get; set; } = default;
137

  
129 138
    [Parameter]
130 139
    public EventCallback CloseAside { get; set; }
131 140

  
141
    [Parameter]
142
    public EventCallback LoadGoalsInDefinitionView { get; set; }
143

  
144
    private async Task Create()
145
    {
146
        var response = await _mediator.Send(new CreateGoal.Command(DefinitionId, Name, Description));
147

  
148
        if (response.IsSuccess)
149
        {
150
            toastService.ShowSuccess("Cíl úspěšně vytvořen");
151
            await LoadGoalsInDefinitionView.InvokeAsync();
152
        }
153
        else toastService.ShowError("Cíl se nepodařilo vytvořit");
154

  
155
        await Close();
156
    }
157

  
132 158
    private async Task Close()
133 159
    {
134 160
        //ResetValues();
src/Modules/Goal/Application/Leuze.Modules.Goal.Application.UI/Pages/Components/GoalDetailAside.razor
1

1
@inject IMediator _mediator
2

  
2 3
<aside class="@_aside goal_detail">
3 4
    <div class="goal_detail_header">
4 5
        <div>
......
22 23
    </div>
23 24
    <div class="goal_detail_body">
24 25
        <div class="goal_detail_area">
25
            <input class="goal_name" type="text" placeholder="Zadejte název cíle" />
26
            <input class="goal_name" type="text" placeholder="Zadejte název cíle" value="@DetailItem.Name" />
26 27
            <div class="goal_description_title">Popis cíle</div>
27 28
            <textarea oninput='this.style.height = "";this.style.height = this.scrollHeight + "px"'
28
                      class="goal_description" placeholder="Vyplňte popis cíle"></textarea>
29
                      class="goal_description" placeholder="Vyplňte popis cíle">@DetailItem.Description</textarea>
29 30
        </div>
30 31
        <div class="goal_communication_area">
31 32
            <div class="goal_communication_item">
......
325 326
    [Parameter]
326 327
    public bool Show { get; set; } = false;
327 328

  
329
    private Guid _detailId;
330
    [Parameter]
331
    public Guid DetailId
332
    {
333
        get { return _detailId; }
334
        set
335
        {
336
            _detailId = value;
337
            GetDetails().Wait();
338
        }
339
    }
340

  
328 341
    [Parameter]
329
    public Guid DetailId { get; set; } = default;
342
    public GoalItem DetailItem { get; set; } = GoalItem.Default();
330 343

  
331 344
    [Parameter]
332 345
    public EventCallback CloseAside { get; set; }
......
337 350

  
338 351
    public void CloseReview() => ReviewId = default(Guid);
339 352

  
353
    private async Task GetDetails()
354
    {
355
        var response = await _mediator.Send(new GetGoalById.Query(DetailId));
356

  
357
        if (response.IsSuccess)
358
        {
359
            DetailItem = response.Result.item;
360
        }
361
    }
362

  
340 363
    private async Task Close()
341 364
    {
342 365
        //ResetValues();
src/Modules/Goal/Application/Leuze.Modules.Goal.Application.UI/Pages/GoalDefinitionDetail.razor
1
@page "/goals/detail/{id}"
1
@page "/goals/detail/{Id:guid}"
2 2
@attribute [Authorize]
3 3
@layout MainLayout
4 4
@inject IMediator _mediator
......
24 24
        <tr>
25 25
            <th>Název</th>
26 26
            <th>Vytvořil</th>
27
            <th>Datum vytvoření</th>
28 27
            <th>Hodnocení uživatel</th>
29 28
            <th>Hodnocení nadřízený</th>
30 29
            <th>Akce</th>
......
32 31
        @foreach (var range in Goals)
33 32
        {
34 33
            <tr>
35
                <td>Název cíle</td>
36
                <td>David Vytvořílek</td>
37
                <td>3.5.2021</td>
38
                <td>80%</td>
39
                <td>150%</td>
34
                <td>@range.Name</td>
35
                <td>@range.Creator.Name</td>
36
                <td>@range.PercentileUser</td>
37
                <td>@range.PercentileFinal</td>
40 38
                <td>
41 39
                    <div class="flex">
42 40
                        <div></div>
43
                        <div @onclick='() => SetDetailId(Guid.NewGuid())'>
41
                        <div @onclick='() => SetDetailId(range.Id)'>
44 42
                            <i class="fal fa-eye"></i>
45 43
                            Otevřít
46 44
                        </div>
......
56 54
}
57 55

  
58 56
<Leuze.Modules.Goal.Application.UI.Pages.Components.GoalDetailAside Show="DetailId != default(Guid)" DetailId="DetailId" CloseAside="CloseDetailAside" />
59
<Leuze.Modules.Goal.Application.UI.Pages.Components.CreateGoalAside Show="ShowCreate" CloseAside="CloseCreateAside" />
57
<Leuze.Modules.Goal.Application.UI.Pages.Components.CreateGoalAside Show="ShowCreate" DefinitionId="Id" CloseAside="CloseCreateAside" LoadGoalsInDefinitionView="GetGoals" />
60 58

  
61 59
<BlazorStyled.Styled>
62 60
    .section_header {
......
161 159
@code {
162 160

  
163 161
    [Parameter]
164
    public string Id { get; set; }
162
    public Guid Id { get; set; }
165 163

  
166
    public List<Guid> Goals { get; set; } = new() { Guid.NewGuid() };
164
    public List<GoalItem> Goals { get; set; } = new();
167 165

  
168 166
    public Guid DetailId { get; set; } = default(Guid);
169 167

  
......
177 175

  
178 176
    private void CloseCreateAside() => ShowCreate = false;
179 177

  
178
    private async Task GetGoals()
179
    {
180
        var response = await _mediator.Send(new GetGoalsForDefinition.Query(Id));
181

  
182
        if (response.IsSuccess)
183
        {
184
            Goals = response.Result.list;
185
        }
186
    }
187

  
188
    protected async override Task OnInitializedAsync()
189
    {
190
        await base.OnInitializedAsync();
191
        await GetGoals();
192
    }
193

  
180 194

  
181 195
}
src/Modules/Goal/Application/Leuze.Modules.Goal.Application.UI/Pages/MyGoalDefinition.razor
18 18
        @foreach (var range in Definitions)
19 19
        {
20 20
            <tr>
21
                <td>Název definice</td>
22
                <td>David Vytvořílek</td>
21
                <td>@range.Name</td>
22
                <td>@range.Creator.Name</td>
23 23
                <td>
24 24
                    <div class="flex">
25 25
                        <div></div>
26
                        <div @onclick='() => _nav.NavigateTo("/goals/detail/test")'>
26
                        <div @onclick='() => _nav.NavigateTo($"/goals/detail/{range.Id}")'>
27 27
                            <i class="fal fa-eye"></i>
28 28
                            Otevřít
29 29
                        </div>
......
113 113

  
114 114
@code {
115 115

  
116
    public List<Guid> Definitions { get; set; } = new() { Guid.NewGuid() };
116
    public List<GoalDefinition> Definitions { get; set; } = new();
117 117

  
118 118
    public Guid DetailId { get; set; } = default(Guid);
119 119

  
......
133 133

  
134 134
    private void CloseCreateAside() => ShowCreate = false;
135 135

  
136
    private async Task GetMyDefinitions()
137
    {
138
        var response = await _mediator.Send(new GetMyGoalDefinitions.Query());
139

  
140
        if (response.IsSuccess)
141
        {
142
            Definitions = response.Result.list;
143
        }
144
    }
145

  
146
    protected async override Task OnInitializedAsync()
147
    {
148
        await base.OnInitializedAsync();
149
        await GetMyDefinitions();
150
    }
151

  
136 152
}
src/Modules/Goal/Application/Leuze.Modules.Goal.Application.UI/_Imports.razor
23 23
@using Leuze.Core.Application.CQRS.Roles.Queries
24 24
@using Blazored.Toast
25 25
@using Blazored.Toast.Services
26
@using Leuze.Core.Domain.Domains.Users
26
@using Leuze.Core.Domain.Domains.Users
27
@using Leuze.Modules.Goal.Application.CQRS.Goals.Commands
28
@using Leuze.Modules.Goal.Application.CQRS.Goals.Queries
29
@using Leuze.Modules.Goal.Application.CQRS.GoalDefinitions.Queries
30
@using Leuze.Modules.Goal.Domain.Domains
src/Modules/Goal/Application/Leuze.Modules.Goal.Application/CQRS/GoalDefinitions/Queries/GetMyGoalDefinitions.cs
1
using Leuze.Core.Application.CQRS;
2
using Leuze.Core.Domain.Repositories;
3
using Leuze.Modules.Goal.Domain.Domains;
4
using Leuze.Modules.Goal.Domain.Repositories;
5
using Microsoft.AspNetCore.Components.Authorization;
6
using System;
7
using System.Collections.Generic;
8
using System.Linq;
9
using System.Security.Claims;
10
using System.Text;
11
using System.Threading;
12
using System.Threading.Tasks;
13

  
14
namespace Leuze.Modules.Goal.Application.CQRS.GoalDefinitions.Queries
15
{
16
    public static class GetMyGoalDefinitions
17
    {
18
        public record Query() : IBaseRequest<Response>;
19

  
20
        public record Response(List<GoalDefinition> list);
21

  
22

  
23
        public class Handler : IBaseRequestHandler<Query, Response>
24
        {
25
            private readonly IGoalDefinitionRepository _goalDefinitionRepo;
26
            private readonly AuthenticationStateProvider _authenticationStateProvider;
27
            private readonly IDomainUserRepository _domainUserRepository;
28

  
29
            public Handler(IGoalDefinitionRepository goalDefinitionRepo,
30
                AuthenticationStateProvider authenticationStateProvider, IDomainUserRepository domainUserRepository)
31
            {
32
                _goalDefinitionRepo = goalDefinitionRepo;
33
                _authenticationStateProvider = authenticationStateProvider;
34
                _domainUserRepository = domainUserRepository;
35
            }
36

  
37
            public async Task<RequestResponse<Response>> Handle(Query request, CancellationToken cancellationToken)
38
            {
39
                var state = await _authenticationStateProvider.GetAuthenticationStateAsync();
40
                var id = Guid.Parse(state.User!.FindFirst(ClaimTypes.NameIdentifier)!.Value);
41
                var goalDefs = await _goalDefinitionRepo.GetAllForUserAsync(id);
42

  
43
                if (goalDefs == null)
44
                {
45
                    return RequestResponse<Response>.CreateErrorResponse($"Goal definitions for user: {id} not found!");
46
                }
47

  
48
                return RequestResponse<Response>.CreateSuccessResponse(new(goalDefs));
49
            }
50
        }
51
    }
52
}
src/Modules/Goal/Application/Leuze.Modules.Goal.Application/CQRS/Goals/Queries/GetGoalById.cs
15 15
{
16 16
    public static class GetGoalById
17 17
    {
18
        public record Command(Guid GoalDefinitionId, string Name, string Description) : IBaseRequest<Response>;
18
        public record Query(Guid goalId) : IBaseRequest<Response>;
19 19

  
20 20
        public record Response(GoalItem item);
21 21

  
22 22

  
23
        public class Handler : IBaseRequestHandler<Command, Response>
23
        public class Handler : IBaseRequestHandler<Query, Response>
24 24
        {
25 25
            private readonly IGoalItemRepository _goalItemRepo;
26
            private readonly IGoalDefinitionRepository _goalDefinitionRepo;
27
            private readonly AuthenticationStateProvider _authenticationStateProvider;
28
            private readonly IDomainUserRepository _domainUserRepo;
29 26

  
30
            public Handler(IGoalItemRepository goalItemRepo, IGoalDefinitionRepository goalDefinitionRepo, AuthenticationStateProvider authStateProvider, IDomainUserRepository domainUserRepo)
27
            public Handler(IGoalItemRepository goalItemRepo)
31 28
            {
32 29
                _goalItemRepo = goalItemRepo;
33
                _goalDefinitionRepo = goalDefinitionRepo;
34
                _authenticationStateProvider = authStateProvider;
35
                _domainUserRepo = domainUserRepo;
36 30
            }
37 31

  
38
            public async Task<RequestResponse<Response>> Handle(Command request, CancellationToken cancellationToken)
32
            public async Task<RequestResponse<Response>> Handle(Query request, CancellationToken cancellationToken)
39 33
            {
40
                //TODO: user muze byt null, ale to my nechceme!!!
41
                var state = await _authenticationStateProvider.GetAuthenticationStateAsync();
42
                var id = Guid.Parse(state.User!.FindFirst(ClaimTypes.NameIdentifier)!.Value);
43
                var user = await _domainUserRepo.GetByIdAsync(id);
44
                var goalDef = await _goalDefinitionRepo.GetByIdAsync(request.GoalDefinitionId);
34
                var goal = await _goalItemRepo.GetByIdAsync(request.goalId);
45 35

  
46
                if(goalDef == null)
36
                if(goal == null)
47 37
                {
48
                    return RequestResponse<Response>.CreateErrorResponse($"Goal definition with id: {request.GoalDefinitionId} not found!");
38
                    return RequestResponse<Response>.CreateErrorResponse($"Goal with id: {request.goalId} not found!");
49 39
                }
50 40

  
51
                GoalItem item = new(goalDef, user, request.Name, request.Description);
52

  
53
                await _goalItemRepo.AddAsync(item);
54

  
55
                return RequestResponse<Response>.CreateSuccessResponse(new(item));
41
                return RequestResponse<Response>.CreateSuccessResponse(new(goal));
56 42
            }
57 43
        }
58 44

  
src/Modules/Goal/Application/Leuze.Modules.Goal.Application/CQRS/Goals/Queries/GetGoalsForDefinition.cs
1
using Leuze.Core.Application.CQRS;
2
using Leuze.Core.Domain.Repositories;
3
using Leuze.Modules.Goal.Domain.Domains;
4
using Leuze.Modules.Goal.Domain.Repositories;
5
using Microsoft.AspNetCore.Components.Authorization;
6
using System;
7
using System.Collections.Generic;
8
using System.Linq;
9
using System.Security.Claims;
10
using System.Text;
11
using System.Threading;
12
using System.Threading.Tasks;
13

  
14
namespace Leuze.Modules.Goal.Application.CQRS.Goals.Queries
15
{
16
    public static class GetGoalsForDefinition
17
    {
18
        public record Query(Guid goalDefinition) : IBaseRequest<Response>;
19

  
20
        public record Response(List<GoalItem> list);
21

  
22

  
23
        public class Handler : IBaseRequestHandler<Query, Response>
24
        {
25
            private readonly IGoalItemRepository _goalItemRepo;
26
            private readonly AuthenticationStateProvider _authenticationStateProvider;
27
            private readonly IDomainUserRepository _domainUserRepository;
28

  
29
            public Handler(IGoalItemRepository goalItemRepo,
30
                AuthenticationStateProvider authenticationStateProvider, IDomainUserRepository domainUserRepository)
31
            {
32
                _goalItemRepo = goalItemRepo;
33
                _authenticationStateProvider = authenticationStateProvider;
34
                _domainUserRepository = domainUserRepository;
35
            }
36

  
37
            public async Task<RequestResponse<Response>> Handle(Query request, CancellationToken cancellationToken)
38
            {
39
                var state = await _authenticationStateProvider.GetAuthenticationStateAsync();
40
                var id = Guid.Parse(state.User!.FindFirst(ClaimTypes.NameIdentifier)!.Value);
41
                var goals = await _goalItemRepo.GetAllForUserDefinitionAsync(request.goalDefinition);
42

  
43
                if (goals == null)
44
                {
45
                    return RequestResponse<Response>.CreateErrorResponse($"Goals for definition: {request.goalDefinition} not found!");
46
                }
47

  
48
                return RequestResponse<Response>.CreateSuccessResponse(new(goals));
49
            }
50
        }
51
    }
52
}
src/Modules/Goal/Domain/Leuze.Modules.Goal.Domain/Domains/GoalDefinition.cs
39 39
        public bool SupervisorLocked { get; private set; }
40 40
        public decimal? Vari { get; private set; }
41 41

  
42
        private List<GoalItem> _goals { get; set; }
42
        private List<GoalItem> _goals = new List<GoalItem>();
43 43
        public IReadOnlyList<GoalItem> Goals => _goals.AsReadOnly();
44 44

  
45 45
        public void SetName(string name)
src/Modules/Goal/Domain/Leuze.Modules.Goal.Domain/Domains/GoalItem.cs
25 25
            this.Description = description;
26 26
        }
27 27

  
28
        public static GoalItem Default()
29
        {
30
            GoalItem item = new GoalItem();
31
            return item;
32
        }
33

  
28 34
        public Guid Id { get; private set; }
29 35
        public GoalDefinition GoalDefinition { get; private set; }
30 36
        public Guid GoalDefinitionId { get; private set; }
......
35 41
        public decimal PercentileUser { get; private set; }
36 42
        public decimal PercentileFinal { get; private set; }
37 43

  
38
        private List<Comment> _comments { get; set; }
44
        private List<Comment> _comments = new();
39 45
        public IReadOnlyList<Comment> Comments => _comments.AsReadOnly();
40 46

  
41
        private List<GoalUpdate> _updates { get; set; }
47
        private List<GoalUpdate> _updates = new();
42 48
        public IReadOnlyList<GoalUpdate> Updates => _updates.AsReadOnly();
43 49

  
44
        private List<Review> _reviews { get; set; }
50
        private List<Review> _reviews = new();
45 51
        public IReadOnlyList<Review> Reviews => _reviews.AsReadOnly();
46 52

  
47 53
        public void SetName(string name)
src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/DependencyInjection.cs
1 1
using ExtCore.Infrastructure.Actions;
2
using Leuze.Core.Application.Configuration;
3
using Leuze.Core.Domain.Domains.Users;
4
using Leuze.Core.Infrastructure.Persistence;
5
using Leuze.Modules.Goal.Domain.Domains;
2 6
using Leuze.Modules.Goal.Infrastructure.Persistence.Extensions;
3 7
using Microsoft.AspNetCore.Builder;
4 8
using Microsoft.Extensions.DependencyInjection;
9
using Microsoft.Extensions.Options;
5 10
using System;
11
using System.Linq;
6 12

  
7 13
namespace Leuze.Modules.Goal.Infrastructure.Persistence
8 14
{
......
44 50
        /// <param name="serviceProvider"></param>
45 51
        public void Execute(IApplicationBuilder applicationBuilder, IServiceProvider serviceProvider)
46 52
        {
53
            using (var serviceScope = serviceProvider.GetRequiredService<IServiceScopeFactory>().CreateScope())
54
            {
55
                var context = serviceScope.ServiceProvider.GetRequiredService<LeuzeDbContext>();
56
                var appSettings = serviceScope.ServiceProvider.GetRequiredService<IOptions<AppSettings>>().Value;
47 57

  
58
                var user = context.Set<DomainUser>().Where(item => item.EmailAddress.Email == "ma@test.cz").FirstOrDefault();
59
                GoalDefinition gd = new GoalDefinition(user, user, "Test Goal definition", DateTime.Now, DateTime.Now.AddDays(10));
60
                context.Add(gd);
61
                context.SaveChanges();
62
            }
48 63
        }
49 64
    }
50 65
}
src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/Extensions/RepositoriesExtension.cs
20 20
            services.AddTransient<IGoalItemRepository,GoalItemRepository>();
21 21
            services.AddTransient<IGoalUpdateRepository,GoalUpdateRepository>();
22 22
            services.AddTransient<IReviewRepository,ReviewRepository>();
23

  
24

  
23 25
        }
24 26

  
25 27
    }
src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/Repositories/GoalDefinitionRepository.cs
40 40

  
41 41
        public async Task<List<GoalDefinition>> GetAllForUserAsync(Guid userId)
42 42
        {
43
            return await dbSet.Where(item => item.OwnerId == userId).ToListAsync();
43
            return await dbSet.Include(item => item.Creator).Where(item => item.OwnerId == userId).ToListAsync();
44 44
        }
45 45

  
46 46
        public async Task<List<GoalDefinition>> GetAllAsync()
src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/Repositories/GoalItemRepository.cs
3 3
using Leuze.Core.Infrastructure.Persistence;
4 4
using Leuze.Modules.Goal.Domain.Domains;
5 5
using Leuze.Modules.Goal.Domain.Repositories;
6
using Microsoft.EntityFrameworkCore;
6 7
using System;
7 8
using System.Collections.Generic;
8 9
using System.Linq;
......
42 43

  
43 44
        public async Task<List<GoalItem>> GetAllForUserDefinitionAsync(Guid definitionId)
44 45
        {
45
            return dbSet.Where(item => item.GoalDefinitionId == definitionId).ToList(); //TODO: await??
46
            return await dbSet.Include(item => item.Creator).Where(item => item.GoalDefinitionId == definitionId).ToListAsync();
46 47
        }
47 48

  
48 49
        public async Task<List<GoalItem>> GetAllAsync()

Také k dispozici: Unified diff