Revize 2bf6ed39
Přidáno uživatelem Milan Hotovec před téměř 4 roky(ů)
src/Modules/Goal/Application/Leuze.Modules.Goal.Application.UI/Pages/Components/GoalDetailAside.razor | ||
---|---|---|
31 | 31 |
<button @onclick="EditGoal">Uložit změny</button> |
32 | 32 |
</div> |
33 | 33 |
<div class="goal_communication_area"> |
34 |
<div class="goal_communication_item"> |
|
35 |
Dominik Chlouba vytvořil tento cíl. <span class="date">3. 5. 2021</span> |
|
36 |
</div> |
|
37 |
<div class="goal_communication_item"> |
|
38 |
<div class="item_tool"> |
|
39 |
<div>Dominik Chlouba přidal komentář. <span class="date">3. 5. 2021</span></div> |
|
40 |
<div> |
|
41 |
<div class="action_buttons" style="display: none"> |
|
42 |
<i class="fal fa-edit"></i> |
|
43 |
<i class="fal fa-trash"></i> |
|
44 |
</div> |
|
45 |
<div class="action_buttons" style="display: block"> |
|
46 |
<i class="green fal fa-check"></i> |
|
47 |
<i class="red fal fa-times"></i> |
|
34 |
@foreach (var comment in Comments) |
|
35 |
{ |
|
36 |
if (comment.IsSystem) |
|
37 |
{ |
|
38 |
<div class="goal_communication_item"> |
|
39 |
System: Uživatel @comment.Creator.Name.FullName @comment.type.GetStringValue() z @comment.OldText na @comment.Text <span class="date">@comment.CreatedAt.ToShortDateString() @comment.CreatedAt.ToShortTimeString()</span> |
|
40 |
</div> |
|
41 |
} |
|
42 |
else |
|
43 |
{ |
|
44 |
<div class="goal_communication_item"> |
|
45 |
<div class="item_tool"> |
|
46 |
<div> |
|
47 |
@comment.Creator.Name.FullName: @comment.Text <span class="date">>@comment.CreatedAt.ToShortDateString() @comment.CreatedAt.ToShortTimeString()</span> |
|
48 |
</div> |
|
49 |
<div> |
|
50 |
<div class="action_buttons" style="display: none"> |
|
51 |
<i class="fal fa-edit"></i> |
|
52 |
<i class="fal fa-trash"></i> |
|
53 |
</div> |
|
54 |
<div class="action_buttons" style="display: block"> |
|
55 |
<i class="green fal fa-check"></i> |
|
56 |
<i class="red fal fa-times"></i> |
|
57 |
</div> |
|
58 |
</div> |
|
48 | 59 |
</div> |
60 |
<textarea class="comment-textarea noedit" |
|
61 |
oninput='this.style.height = "";this.style.height = this.scrollHeight + "px"' |
|
62 |
placeholder="Upravte komentář"></textarea> |
|
49 | 63 |
</div> |
50 |
</div> |
|
51 |
<textarea class="comment-textarea noedit" |
|
52 |
oninput='this.style.height = "";this.style.height = this.scrollHeight + "px"' |
|
53 |
placeholder="Upravte komentář"></textarea> |
|
54 |
</div> |
|
55 |
<div class="goal_communication_item"> |
|
56 |
Dominik Chlouba aktualizoval popis cíle. <span class="date">3. 5. 2021</span> |
|
57 |
</div> |
|
58 |
<div class="goal_communication_item"> |
|
59 |
Dominik Chlouba aktualizoval popis cíle. <span class="date">3. 5. 2021</span> |
|
60 |
</div> |
|
61 |
<div class="goal_communication_item"> |
|
62 |
Dominik Chlouba aktualizoval popis cíle. <span class="date">3. 5. 2021</span> |
|
63 |
</div> |
|
64 |
<div class="goal_communication_item"> |
|
65 |
Dominik Chlouba aktualizoval popis cíle. <span class="date">3. 5. 2021</span> |
|
66 |
</div> |
|
67 |
<div class="goal_communication_item"> |
|
68 |
Dominik Chlouba aktualizoval popis cíle. <span class="date">3. 5. 2021</span> |
|
69 |
</div> |
|
64 |
} |
|
65 |
} |
|
70 | 66 |
</div> |
71 | 67 |
</div> |
72 | 68 |
<div class="goal_detail_footer"> |
73 |
<textarea placeholder="Přidat soukromý či veřejný komentář"></textarea> |
|
69 |
<textarea placeholder="Přidat soukromý či veřejný komentář" @bind="CommentText"></textarea>
|
|
74 | 70 |
<div class="goal_comment_tools"> |
75 |
<select> |
|
76 |
<option value="private">Soukromý</option> |
|
71 |
<select @bind="CommentVisibility"> |
|
77 | 72 |
<option value="public">Veřejný</option> |
73 |
<option value="private">Soukromý</option> |
|
78 | 74 |
</select> |
79 |
<button>Přidat komentář</button> |
|
75 |
<button @onclick="SendComment">Přidat komentář</button>
|
|
80 | 76 |
</div> |
81 | 77 |
</div> |
82 | 78 |
</aside> |
... | ... | |
334 | 330 |
|
335 | 331 |
public string Description { get; set; } = ""; |
336 | 332 |
|
333 |
private string CommentText { get; set; } = ""; |
|
334 |
|
|
335 |
private string CommentVisibility { get; set; } = "public"; |
|
336 |
|
|
337 |
|
|
337 | 338 |
|
338 | 339 |
private Guid _detailId; |
339 | 340 |
[Parameter] |
... | ... | |
350 | 351 |
[Parameter] |
351 | 352 |
public GoalItem DetailItem { get; set; } = GoalItem.Default(); |
352 | 353 |
|
354 |
private List<CommentGenericDto> Comments { get; set; } = new List<CommentGenericDto>(); |
|
355 |
|
|
353 | 356 |
[Parameter] |
354 | 357 |
public EventCallback CloseAside { get; set; } |
355 | 358 |
|
... | ... | |
369 | 372 |
Name = DetailItem.Name; |
370 | 373 |
Description = DetailItem.Description; |
371 | 374 |
} |
375 |
|
|
376 |
var response2 = await _mediator.Send(new GetAllForGoal.Query(DetailId)); |
|
377 |
|
|
378 |
if (response2.IsSuccess) |
|
379 |
{ |
|
380 |
Comments = response2.Result.list; |
|
381 |
} |
|
372 | 382 |
} |
373 | 383 |
|
374 | 384 |
private async Task EditGoal() |
... | ... | |
378 | 388 |
if (response.IsSuccess) |
379 | 389 |
{ |
380 | 390 |
toastService.ShowSuccess("Cíl úspěšně editován"); |
391 |
await GetDetails(); //Refresh |
|
381 | 392 |
} |
382 | 393 |
else toastService.ShowError($"Cíl se nepodařilo editovat {response.Errors.FirstOrDefault() ?? ""}"); |
383 | 394 |
} |
384 | 395 |
|
396 |
private async Task SendComment() |
|
397 |
{ |
|
398 |
var response = await _mediator.Send(new AddCommentToGoal.Command(DetailId, CommentText, CommentVisibility != "public")); |
|
399 |
|
|
400 |
if (response.IsSuccess) |
|
401 |
{ |
|
402 |
//toastService.ShowSuccess("Komentář úspěšně přidán"); |
|
403 |
await GetDetails(); //Refresh |
|
404 |
} |
|
405 |
else toastService.ShowError($"Komentář se nepodařil opřidat {response.Errors.FirstOrDefault() ?? ""}"); |
|
406 |
} |
|
407 |
|
|
385 | 408 |
private async Task Close() |
386 | 409 |
{ |
387 | 410 |
//ResetValues(); |
src/Modules/Goal/Application/Leuze.Modules.Goal.Application.UI/_Imports.razor | ||
---|---|---|
30 | 30 |
@using Leuze.Modules.Goal.Application.CQRS.GoalDefinitions.Commands |
31 | 31 |
@using Leuze.Modules.Goal.Application.CQRS.GoalDefinitionAreas.Commands |
32 | 32 |
@using Leuze.Modules.Goal.Application.CQRS.GoalDefinitionAreas.Queries |
33 |
@using Leuze.Modules.Goal.Application.CQRS.Comments.Commands |
|
34 |
@using Leuze.Modules.Goal.Application.CQRS.Comments.Queries |
|
33 | 35 |
@using Leuze.Modules.Goal.Domain.Domains |
36 |
@using Leuze.Modules.Goal.Domain.Domains.DTOs |
|
34 | 37 |
@using Microsoft.Extensions.Localization |
35 | 38 |
@using Microsoft.AspNetCore.Localization |
src/Modules/Goal/Application/Leuze.Modules.Goal.Application/CQRS/Comments/Commands/AddCommentToGoal.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.Comments.Commands |
|
15 |
{ |
|
16 |
public static class AddCommentToGoal |
|
17 |
{ |
|
18 |
public record Command(Guid goalId, string text, bool isPrivate) : IBaseRequest<Response>; |
|
19 |
|
|
20 |
public record Response(); |
|
21 |
|
|
22 |
|
|
23 |
public class Handler : IBaseRequestHandler<Command, Response> |
|
24 |
{ |
|
25 |
private readonly ICommentRepository _commentRepo; |
|
26 |
private readonly IGoalItemRepository _goalItemRepo; |
|
27 |
private readonly AuthenticationStateProvider _authenticationStateProvider; |
|
28 |
private readonly IDomainUserRepository _domainUserRepo; |
|
29 |
|
|
30 |
public Handler(ICommentRepository commentRepo, IGoalItemRepository goalItemRepo, AuthenticationStateProvider authStateProvider, IDomainUserRepository domainUserRepo) |
|
31 |
{ |
|
32 |
_commentRepo = commentRepo; |
|
33 |
_goalItemRepo = goalItemRepo; |
|
34 |
_authenticationStateProvider = authStateProvider; |
|
35 |
_domainUserRepo = domainUserRepo; |
|
36 |
} |
|
37 |
|
|
38 |
public async Task<RequestResponse<Response>> Handle(Command request, CancellationToken cancellationToken) |
|
39 |
{ |
|
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 creator = await _domainUserRepo.GetByIdAsync(id); |
|
44 |
var goal = await _goalItemRepo.GetByIdAsync(request.goalId); |
|
45 |
|
|
46 |
if (creator == null) |
|
47 |
{ |
|
48 |
return RequestResponse<Response>.CreateErrorResponse($"Creator user with id: {id} not found!"); |
|
49 |
} |
|
50 |
if (goal == null) |
|
51 |
{ |
|
52 |
return RequestResponse<Response>.CreateErrorResponse($"Goal with id: {request.goalId} not found!"); |
|
53 |
} |
|
54 |
if (string.IsNullOrWhiteSpace(request.text)) |
|
55 |
{ |
|
56 |
return RequestResponse<Response>.CreateErrorResponse($"Comment text is empty!"); |
|
57 |
} |
|
58 |
|
|
59 |
var comment = new Comment(creator, goal, request.text, request.isPrivate); |
|
60 |
|
|
61 |
await _commentRepo.AddAsync(comment); |
|
62 |
|
|
63 |
return RequestResponse<Response>.CreateSuccessResponse(new()); |
|
64 |
} |
|
65 |
} |
|
66 |
} |
|
67 |
} |
src/Modules/Goal/Application/Leuze.Modules.Goal.Application/CQRS/Comments/Queries/GetAllForGoal.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.Domains.DTOs; |
|
5 |
using Leuze.Modules.Goal.Domain.Repositories; |
|
6 |
using Microsoft.AspNetCore.Components.Authorization; |
|
7 |
using System; |
|
8 |
using System.Collections.Generic; |
|
9 |
using System.Linq; |
|
10 |
using System.Security.Claims; |
|
11 |
using System.Text; |
|
12 |
using System.Threading; |
|
13 |
using System.Threading.Tasks; |
|
14 |
|
|
15 |
namespace Leuze.Modules.Goal.Application.CQRS.Comments.Queries |
|
16 |
{ |
|
17 |
public static class GetAllForGoal |
|
18 |
{ |
|
19 |
public record Query(Guid goalId) : IBaseRequest<Response>; |
|
20 |
|
|
21 |
public record Response(List<CommentGenericDto> list); |
|
22 |
|
|
23 |
|
|
24 |
public class Handler : IBaseRequestHandler<Query, Response> |
|
25 |
{ |
|
26 |
private readonly IGoalUpdateRepository _goalUpdateRepo; |
|
27 |
private readonly ICommentRepository _commentRepo; |
|
28 |
private readonly AuthenticationStateProvider _authenticationStateProvider; |
|
29 |
private readonly IDomainUserRepository _domainUserRepo; |
|
30 |
|
|
31 |
public Handler(IDomainUserRepository domainUserRepo, AuthenticationStateProvider authStateProvider, ICommentRepository commentRepo, IGoalUpdateRepository goalUpdateRepo) |
|
32 |
{ |
|
33 |
_goalUpdateRepo = goalUpdateRepo; |
|
34 |
_commentRepo = commentRepo; |
|
35 |
_domainUserRepo = domainUserRepo; |
|
36 |
_authenticationStateProvider = authStateProvider; |
|
37 |
} |
|
38 |
|
|
39 |
public async Task<RequestResponse<Response>> Handle(Query request, CancellationToken cancellationToken) |
|
40 |
{ |
|
41 |
//TODO Predelat kvuli testum? |
|
42 |
var state = await _authenticationStateProvider.GetAuthenticationStateAsync(); |
|
43 |
var id = Guid.Parse(state.User!.FindFirst(ClaimTypes.NameIdentifier)!.Value); |
|
44 |
var userShortDto = await _domainUserRepo.GetDtoByIdAsync(id); |
|
45 |
|
|
46 |
if (userShortDto == null) |
|
47 |
{ |
|
48 |
return RequestResponse<Response>.CreateErrorResponse($"Nelze načíst komentáře pro uživatele: {id}!"); |
|
49 |
} |
|
50 |
|
|
51 |
var comments = await _commentRepo.GetAllForGoalAsync(request.goalId); |
|
52 |
|
|
53 |
if (comments == null) |
|
54 |
{ |
|
55 |
return RequestResponse<Response>.CreateErrorResponse($"Nelze načíst komentáře pro cíl: {request.goalId}!"); |
|
56 |
} |
|
57 |
|
|
58 |
comments = comments.Where(o => (o.IsPrivate == false || (o.CreatorId == id))).ToList(); |
|
59 |
|
|
60 |
var updates = await _goalUpdateRepo.GetAllForGoalAsync(request.goalId); |
|
61 |
|
|
62 |
if (updates == null) |
|
63 |
{ |
|
64 |
return RequestResponse<Response>.CreateErrorResponse($"Nelze načíst změny pro cíl: {request.goalId}!"); |
|
65 |
} |
|
66 |
|
|
67 |
var genericComments = new List<CommentGenericDto>(); |
|
68 |
comments.ForEach(o => genericComments.Add(new CommentGenericDto(o.Id, o.CreatedAt, o.Creator, o.Text, "", false, o.IsPrivate, o.IsChanged, UpdateType.None))); |
|
69 |
updates.ForEach(o => genericComments.Add(new CommentGenericDto(o.Id, o.CreatedAt, o.Creator, o.NewValue, o.OldValue, true, false, true, o.UpdatedType))); |
|
70 |
|
|
71 |
|
|
72 |
genericComments = genericComments.OrderBy(o => o.CreatedAt).ToList(); |
|
73 |
|
|
74 |
return RequestResponse<Response>.CreateSuccessResponse(new(genericComments)); |
|
75 |
} |
|
76 |
} |
|
77 |
} |
|
78 |
} |
src/Modules/Goal/Application/Leuze.Modules.Goal.Application/CQRS/Goals/Commands/CreateGoal.cs | ||
---|---|---|
22 | 22 |
|
23 | 23 |
public class Handler : IBaseRequestHandler<Command, Response> |
24 | 24 |
{ |
25 |
private readonly IGoalUpdateRepository _goalUpdateRepo; |
|
25 | 26 |
private readonly IGoalItemRepository _goalItemRepo; |
26 | 27 |
private readonly IGoalDefinitionRepository _goalDefinitionRepo; |
27 | 28 |
private readonly AuthenticationStateProvider _authenticationStateProvider; |
28 | 29 |
private readonly IDomainUserRepository _domainUserRepository; |
29 | 30 |
|
30 |
public Handler(IGoalItemRepository goalItemRepo, IGoalDefinitionRepository goalDefinitionRepo, |
|
31 |
public Handler(IGoalUpdateRepository goalUpdateRepo, IGoalItemRepository goalItemRepo, IGoalDefinitionRepository goalDefinitionRepo,
|
|
31 | 32 |
AuthenticationStateProvider authenticationStateProvider, IDomainUserRepository domainUserRepository) |
32 | 33 |
{ |
34 |
_goalUpdateRepo = goalUpdateRepo; |
|
33 | 35 |
_goalItemRepo = goalItemRepo; |
34 | 36 |
_goalDefinitionRepo = goalDefinitionRepo; |
35 | 37 |
_authenticationStateProvider = authenticationStateProvider; |
... | ... | |
50 | 52 |
} |
51 | 53 |
|
52 | 54 |
GoalItem item = new(goalDef, user, request.Name, request.Description); |
53 |
|
|
54 | 55 |
await _goalItemRepo.AddAsync(item); |
55 | 56 |
|
57 |
GoalUpdate update = new(user, item, UpdateType.Name, "", item.Name); |
|
58 |
await _goalUpdateRepo.AddAsync(update); |
|
59 |
|
|
60 |
if (!string.IsNullOrWhiteSpace(item.Description)) |
|
61 |
{ |
|
62 |
GoalUpdate descUpdate = new(user, item, UpdateType.Description, "", item.Description); |
|
63 |
await _goalUpdateRepo.AddAsync(descUpdate); |
|
64 |
} |
|
65 |
|
|
56 | 66 |
return RequestResponse<Response>.CreateSuccessResponse(new(item)); |
57 | 67 |
} |
58 | 68 |
} |
src/Modules/Goal/Application/Leuze.Modules.Goal.Application/CQRS/Goals/Commands/EditGoal.cs | ||
---|---|---|
23 | 23 |
public class Handler : IBaseRequestHandler<Command, Response> |
24 | 24 |
{ |
25 | 25 |
private readonly IGoalItemRepository _goalItemRepo; |
26 |
private readonly IGoalDefinitionRepository _goalDefinitionRepo;
|
|
26 |
private readonly IGoalUpdateRepository _goalUpdateRepo;
|
|
27 | 27 |
private readonly AuthenticationStateProvider _authenticationStateProvider; |
28 | 28 |
private readonly IDomainUserRepository _domainUserRepository; |
29 | 29 |
|
30 |
public Handler(IGoalItemRepository goalItemRepo, IGoalDefinitionRepository goalDefinitionRepo,
|
|
30 |
public Handler(IGoalItemRepository goalItemRepo, IGoalUpdateRepository goalUpdateRepo,
|
|
31 | 31 |
AuthenticationStateProvider authenticationStateProvider, IDomainUserRepository domainUserRepository) |
32 | 32 |
{ |
33 | 33 |
_goalItemRepo = goalItemRepo; |
34 |
_goalDefinitionRepo = goalDefinitionRepo;
|
|
34 |
_goalUpdateRepo = goalUpdateRepo;
|
|
35 | 35 |
_authenticationStateProvider = authenticationStateProvider; |
36 | 36 |
_domainUserRepository = domainUserRepository; |
37 | 37 |
} |
... | ... | |
55 | 55 |
return RequestResponse<Response>.CreateErrorResponse($"Nelze změnit název cíle"); |
56 | 56 |
} |
57 | 57 |
|
58 |
await _goalItemRepo.SetNameAsync(request.goalId, request.name); |
|
59 |
await _goalItemRepo.SetDescriptionAsync(request.goalId, request.description); |
|
58 |
bool sendState = false; |
|
59 |
if (goal.Name != request.name) |
|
60 |
{ |
|
61 |
GoalUpdate nameUpdate = new(user, goal, UpdateType.Name, goal.Name, request.name); |
|
62 |
|
|
63 |
await _goalItemRepo.SetNameAsync(request.goalId, request.name); |
|
64 |
await _goalUpdateRepo.AddAsync(nameUpdate); |
|
65 |
|
|
66 |
sendState = true; |
|
67 |
} |
|
68 |
|
|
69 |
if (goal.Description != request.description) |
|
70 |
{ |
|
71 |
GoalUpdate descUpdate = new(user, goal, UpdateType.Description, goal.Description, request.description); |
|
72 |
|
|
73 |
await _goalItemRepo.SetDescriptionAsync(request.goalId, request.description); |
|
74 |
await _goalUpdateRepo.AddAsync(descUpdate); |
|
75 |
|
|
76 |
sendState = true; |
|
77 |
} |
|
78 |
|
|
79 |
if (sendState) |
|
80 |
{ |
|
81 |
return RequestResponse<Response>.CreateSuccessResponse(new()); |
|
82 |
} |
|
60 | 83 |
|
61 |
return RequestResponse<Response>.CreateSuccessResponse(new());
|
|
84 |
return RequestResponse<Response>.CreateErrorResponse($"Nic se nezměnilo!");
|
|
62 | 85 |
} |
63 | 86 |
} |
64 | 87 |
|
src/Modules/Goal/Application/Leuze.Modules.Goal.Application/Leuze.Modules.Goal.Application.csproj | ||
---|---|---|
24 | 24 |
</ItemGroup> |
25 | 25 |
|
26 | 26 |
<ItemGroup> |
27 |
<Folder Include="CQRS\Comments\Commands\" /> |
|
28 |
<Folder Include="CQRS\Comments\Queries\" /> |
|
29 | 27 |
<Folder Include="CQRS\Reviews\Commands\" /> |
30 | 28 |
<Folder Include="CQRS\Reviews\Queries\" /> |
31 | 29 |
</ItemGroup> |
src/Modules/Goal/Domain/Leuze.Modules.Goal.Domain/Domains/DTOs/CommentGenericConvertor.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Linq; |
|
4 |
using System.Text; |
|
5 |
using System.Threading.Tasks; |
|
6 |
|
|
7 |
namespace Leuze.Modules.Goal.Domain.Domains.DTOs |
|
8 |
{ |
|
9 |
public static class CommentGenericConvertor |
|
10 |
{ |
|
11 |
public static string GetStringValue(this UpdateType type) |
|
12 |
{ |
|
13 |
switch (type) |
|
14 |
{ |
|
15 |
case UpdateType.Name: |
|
16 |
return "UpdatedName"; |
|
17 |
case UpdateType.Description: |
|
18 |
return "UpdatedDescription"; |
|
19 |
case UpdateType.PercentileUser: |
|
20 |
return "UpdatedPercentileUser"; |
|
21 |
case UpdateType.PercentileFinal: |
|
22 |
return "UpdatedPercentileFinal"; |
|
23 |
default: |
|
24 |
return "NOT IMPLEMENTED"; |
|
25 |
} |
|
26 |
} |
|
27 |
} |
|
28 |
} |
src/Modules/Goal/Domain/Leuze.Modules.Goal.Domain/Domains/DTOs/CommentGenericDto.cs | ||
---|---|---|
1 |
using Leuze.Core.Domain.Domains.Users; |
|
2 |
using System; |
|
3 |
using System.Collections.Generic; |
|
4 |
using System.Linq; |
|
5 |
using System.Text; |
|
6 |
using System.Threading.Tasks; |
|
7 |
|
|
8 |
namespace Leuze.Modules.Goal.Domain.Domains.DTOs |
|
9 |
{ |
|
10 |
public record CommentGenericDto(Guid Id, DateTime CreatedAt, DomainUser Creator, string Text, string OldText, bool IsSystem, bool IsPrivate, bool IsChanged, UpdateType type); |
|
11 |
} |
src/Modules/Goal/Domain/Leuze.Modules.Goal.Domain/Domains/UpdateType.cs | ||
---|---|---|
8 | 8 |
{ |
9 | 9 |
public enum UpdateType |
10 | 10 |
{ |
11 |
Name, Description, PercentileUser, PercentileFinal |
|
11 |
Name, Description, PercentileUser, PercentileFinal, None
|
|
12 | 12 |
} |
13 | 13 |
} |
src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/Repositories/CommentRepository.cs | ||
---|---|---|
44 | 44 |
|
45 | 45 |
public async Task<List<Comment>> GetAllForGoalAsync(Guid goalId) |
46 | 46 |
{ |
47 |
return await dbSet.Where(item => item.GoalId == goalId).ToListAsync(); |
|
47 |
return await dbSet.Where(item => item.GoalId == goalId).Include(o => o.Creator).ToListAsync();
|
|
48 | 48 |
} |
49 | 49 |
|
50 | 50 |
public async Task<List<Comment>> GetAllAsync() |
src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/Repositories/GoalUpdateRepository.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; |
... | ... | |
43 | 44 |
|
44 | 45 |
public async Task<List<GoalUpdate>> GetAllForGoalAsync(Guid goalId) |
45 | 46 |
{ |
46 |
return dbSet.Where(item => item.GoalId == goalId).ToList(); //TODO: await??
|
|
47 |
return await dbSet.Where(item => item.GoalId == goalId).Include(o => o.Creator).ToListAsync();
|
|
47 | 48 |
} |
48 | 49 |
|
49 | 50 |
public async Task<List<GoalUpdate>> GetAllAsync() |
Také k dispozici: Unified diff
Comments logic connected