-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
103 changed files
with
2,003 additions
and
85 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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 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
2 changes: 1 addition & 1 deletion
2
...lication/CommandHandlers/CreateAssessmentSession/CreateAssessmentSessionCommandHandler.cs
This file contains 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 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 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 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 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 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 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 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 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
1 change: 1 addition & 0 deletions
1
src/Inc.TeamAssistant.Appraiser.Model/Commands/AcceptEstimate/AcceptEstimateCommand.cs
This file contains 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
1 change: 1 addition & 0 deletions
1
...nc.TeamAssistant.Appraiser.Model/Commands/ActivateAssessment/ActivateAssessmentCommand.cs
This file contains 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
1 change: 1 addition & 0 deletions
1
....TeamAssistant.Appraiser.Model/Commands/AddStoryForEstimate/AddStoryForEstimateCommand.cs
This file contains 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
1 change: 1 addition & 0 deletions
1
...nt.Appraiser.Model/Commands/ExitFromAssessmentSession/ExitFromAssessmentSessionCommand.cs
This file contains 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
1 change: 1 addition & 0 deletions
1
...istant.Appraiser.Model/Commands/FinishAssessmentSession/FinishAssessmentSessionCommand.cs
This file contains 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
1 change: 1 addition & 0 deletions
1
src/Inc.TeamAssistant.Appraiser.Model/Commands/ReVoteEstimate/ReVoteEstimateCommand.cs
This file contains 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
1 change: 1 addition & 0 deletions
1
....TeamAssistant.Appraiser.Model/Commands/SetEstimateForStory/SetEstimateForStoryCommand.cs
This file contains 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
1 change: 1 addition & 0 deletions
1
....TeamAssistant.Appraiser.Model/Commands/StartStorySelection/StartStorySelectionCommand.cs
This file contains 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
3 changes: 0 additions & 3 deletions
3
src/Inc.TeamAssistant.Appraiser.Model/Inc.TeamAssistant.Appraiser.Model.csproj
This file contains 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
3 changes: 0 additions & 3 deletions
3
src/Inc.TeamAssistant.CheckIn.Model/Inc.TeamAssistant.CheckIn.Model.csproj
This file contains 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
36 changes: 36 additions & 0 deletions
36
src/Inc.TeamAssistant.Connector.Application/CommandHandlers/Begin/BeginCommandHandler.cs
This file contains 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,36 @@ | ||
using Inc.TeamAssistant.Connector.Model.Commands.Begin; | ||
using Inc.TeamAssistant.DialogContinuations; | ||
using Inc.TeamAssistant.Primitives; | ||
using MediatR; | ||
|
||
namespace Inc.TeamAssistant.Connector.Application.CommandHandlers.Begin; | ||
|
||
internal sealed class BeginCommandHandler : IRequestHandler<BeginCommand, CommandResult> | ||
{ | ||
private readonly IDialogContinuation<BotCommandStage> _dialogContinuation; | ||
|
||
public BeginCommandHandler(IDialogContinuation<BotCommandStage> dialogContinuation) | ||
{ | ||
_dialogContinuation = dialogContinuation ?? throw new ArgumentNullException(nameof(dialogContinuation)); | ||
} | ||
|
||
public Task<CommandResult> Handle(BeginCommand command, CancellationToken token) | ||
{ | ||
if (command is null) | ||
throw new ArgumentNullException(nameof(command)); | ||
|
||
var dialogState = _dialogContinuation.TryBegin(command.MessageContext.PersonId, command.NextStage); | ||
|
||
if (dialogState is null) | ||
throw new ApplicationException("Can not start command dialog."); | ||
|
||
dialogState.AddItem(command.Command); | ||
|
||
if (command.MessageContext.Shared) | ||
dialogState.TryAttachMessage(new ChatMessage( | ||
command.MessageContext.ChatId, | ||
command.MessageContext.MessageId)); | ||
|
||
return Task.FromResult(CommandResult.Build(command.Notification)); | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
...eamAssistant.Connector.Application/CommandHandlers/CreateTeam/CreateTeamCommandHandler.cs
This file contains 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,58 @@ | ||
using Inc.TeamAssistant.Connector.Application.Contracts; | ||
using Inc.TeamAssistant.Connector.Domain; | ||
using Inc.TeamAssistant.Connector.Model.Commands.CreateTeam; | ||
using Inc.TeamAssistant.DialogContinuations; | ||
using Inc.TeamAssistant.Primitives; | ||
using MediatR; | ||
|
||
namespace Inc.TeamAssistant.Connector.Application.CommandHandlers.CreateTeam; | ||
|
||
internal sealed class CreateTeamCommandHandler : IRequestHandler<CreateTeamCommand, CommandResult> | ||
{ | ||
private readonly ITeamRepository _teamRepository; | ||
private readonly IDialogContinuation<BotCommandStage> _dialogContinuation; | ||
private readonly IMessageBuilder _messageBuilder; | ||
|
||
public CreateTeamCommandHandler( | ||
ITeamRepository teamRepository, | ||
IDialogContinuation<BotCommandStage> dialogContinuation, | ||
IMessageBuilder messageBuilder) | ||
{ | ||
_teamRepository = teamRepository ?? throw new ArgumentNullException(nameof(teamRepository)); | ||
_dialogContinuation = dialogContinuation ?? throw new ArgumentNullException(nameof(dialogContinuation)); | ||
_messageBuilder = messageBuilder ?? throw new ArgumentNullException(nameof(messageBuilder)); | ||
} | ||
|
||
public async Task<CommandResult> Handle(CreateTeamCommand command, CancellationToken token) | ||
{ | ||
if (command is null) | ||
throw new ArgumentNullException(nameof(command)); | ||
|
||
var team = new Team( | ||
command.MessageContext.BotId, | ||
command.MessageContext.ChatId, | ||
command.Name); | ||
|
||
await _teamRepository.Upsert(team, token); | ||
|
||
var dialogState = _dialogContinuation.TryEnd(command.MessageContext.PersonId, BotCommandStage.EnterText); | ||
var message = await _messageBuilder.Build(Messages.Connector_JoinToTeam, command.MessageContext.LanguageId, team.Name, $"https://t.me/{command.BotName}?start={team.Id:N}"); | ||
var notifications = new List<NotificationMessage> | ||
{ | ||
NotificationMessage.Create(command.MessageContext.ChatId, message, pinned: true) | ||
}; | ||
|
||
if (dialogState is not null) | ||
{ | ||
if (command.MessageContext.Shared) | ||
dialogState.TryAttachMessage(new ChatMessage( | ||
command.MessageContext.ChatId, | ||
command.MessageContext.MessageId)); | ||
|
||
if (dialogState.ChatMessages.Any()) | ||
notifications.Add(NotificationMessage.Delete(dialogState.ChatMessages)); | ||
} | ||
|
||
return CommandResult.Build(notifications.ToArray()); | ||
} | ||
} |
Oops, something went wrong.