-
Notifications
You must be signed in to change notification settings - Fork 1
feat: redesign board UI, add real-time comments #39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
danielprokopowicz
wants to merge
6
commits into
Pandetthe:main
Choose a base branch
from
danielprokopowicz:feature/board-updates
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2f11051
Feature: Board UI refactoring, real-time comments and DND fixes
danielprokopowicz cb147b9
fix: resolve TypeScript errors and warnings
danielprokopowicz a6be1e4
refactor: apply copilot code review suggestions
danielprokopowicz 1c0ec3e
fix: restore MediatR package reference
danielprokopowicz 8cdd1d3
fix: resolve migration naming, clean up empty migration, fix EF relat…
danielprokopowicz 3b80836
fix: naprawa wizualnych bledow
danielprokopowicz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
server/src/Application/Cards/AppComment/AddCardCommentCommand.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| using Snapflow.Application.Abstractions.Messaging; | ||
| using Snapflow.Application.Boards.GetById; | ||
|
|
||
| namespace Snapflow.Application.Cards.AddComment; | ||
|
|
||
| public sealed record AddCardCommentCommand(int CardId, int UserId, string Content) | ||
| : ICommand<GetBoardByIdResponse.CardCommentDto>; |
46 changes: 46 additions & 0 deletions
46
server/src/Application/Cards/AppComment/AddCardCommentHandler.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| using Microsoft.EntityFrameworkCore; | ||
| using Snapflow.Application.Abstractions.Messaging; | ||
| using Snapflow.Application.Abstractions.Persistence; | ||
| using Snapflow.Application.Boards.GetById; | ||
| using Snapflow.Common; | ||
| using Snapflow.Domain.Cards; | ||
|
|
||
| namespace Snapflow.Application.Cards.AddComment; | ||
|
|
||
| internal sealed class AddCardCommentCommandHandler( | ||
| IAppDbContext context) : ICommandHandler<AddCardCommentCommand, GetBoardByIdResponse.CardCommentDto> // <--- ZMIANA 1: Zwracamy DTO zamiast int | ||
| { | ||
| public async Task<Result<GetBoardByIdResponse.CardCommentDto>> Handle(AddCardCommentCommand request, CancellationToken cancellationToken = default) | ||
| { | ||
| var card = await context.Cards | ||
| .FirstOrDefaultAsync(c => c.Id == request.CardId && !c.IsDeleted, cancellationToken); | ||
|
|
||
| if (card is null) | ||
| { | ||
| return Result.Failure<GetBoardByIdResponse.CardCommentDto>(CardErrors.NotFound(request.CardId)); | ||
| } | ||
|
|
||
| var user = await context.Users | ||
| .FirstOrDefaultAsync(u => u.Id == request.UserId, cancellationToken); | ||
|
|
||
| if (user is null) | ||
| { | ||
| return Result.Failure<GetBoardByIdResponse.CardCommentDto>(new Error("User.NotFound", "User not found", ErrorType.NotFound)); | ||
| } | ||
|
|
||
| var comment = CardComment.Create(request.CardId, request.UserId, request.Content); | ||
|
|
||
| context.CardComments.Add(comment); | ||
| await context.SaveChangesAsync(cancellationToken); | ||
|
|
||
| var dto = new GetBoardByIdResponse.CardCommentDto( | ||
| comment.Id, | ||
| user.Id, | ||
| user.UserName ?? "Unknown", | ||
| comment.Content, | ||
| comment.CreatedAt | ||
| ); | ||
|
|
||
| return dto; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| using Snapflow.Domain.Users; | ||
| using Snapflow.Common; | ||
|
|
||
| namespace Snapflow.Domain.Cards; | ||
|
|
||
| public class CardComment : Entity<int, CardComment> | ||
| { | ||
| public int CardId { get; private set; } | ||
| public int UserId { get; private set; } | ||
| public string Content { get; private set; } = null!; | ||
| public DateTimeOffset CreatedAt { get; private set; } | ||
| public virtual IUser User { get; private set; } = null!; | ||
|
|
||
| public static CardComment Create(int cardId, int userId, string content) | ||
| { | ||
| return new CardComment | ||
| { | ||
| CardId = cardId, | ||
| UserId = userId, | ||
| Content = content, | ||
| CreatedAt = DateTimeOffset.UtcNow | ||
| }; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.