-
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
86 changed files
with
1,612 additions
and
58 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
40 changes: 40 additions & 0 deletions
40
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,40 @@ | ||
using Inc.TeamAssistant.Connector.Domain; | ||
using Inc.TeamAssistant.Connector.Model.Commands.Begin; | ||
using Inc.TeamAssistant.DialogContinuations; | ||
using Inc.TeamAssistant.DialogContinuations.Model; | ||
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 async Task<CommandResult> Handle(BeginCommand command, CancellationToken token) | ||
{ | ||
if (command is null) | ||
throw new ArgumentNullException(nameof(command)); | ||
|
||
var nextStage = Enum.Parse<BotCommandStage>(command.NextStage); | ||
|
||
var dialogState = _dialogContinuation.TryBegin(command.MessageContext.PersonId, 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 CommandResult.Build(command.Notification); | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
...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,41 @@ | ||
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; | ||
|
||
public CreateTeamCommandHandler( | ||
ITeamRepository teamRepository, | ||
IDialogContinuation<BotCommandStage> dialogContinuation) | ||
{ | ||
_teamRepository = teamRepository ?? throw new ArgumentNullException(nameof(teamRepository)); | ||
_dialogContinuation = dialogContinuation ?? throw new ArgumentNullException(nameof(dialogContinuation)); | ||
} | ||
|
||
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); | ||
|
||
_dialogContinuation.End(command.MessageContext.PersonId, BotCommandStage.EnterText); | ||
|
||
return CommandResult.Build(NotificationMessage.Create( | ||
command.MessageContext.ChatId, | ||
$"https://t.me/{command.BotName}?start={team.Id:N}")); | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
src/Inc.TeamAssistant.Connector.Application/CommandHandlers/End/EndCommandHandler.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,37 @@ | ||
using Inc.TeamAssistant.Connector.Domain; | ||
using Inc.TeamAssistant.Connector.Model.Commands.End; | ||
using Inc.TeamAssistant.DialogContinuations; | ||
using Inc.TeamAssistant.DialogContinuations.Model; | ||
using Inc.TeamAssistant.Primitives; | ||
using MediatR; | ||
|
||
namespace Inc.TeamAssistant.Connector.Application.CommandHandlers.End; | ||
|
||
internal sealed class EndCommandHandler : IRequestHandler<EndCommand, CommandResult> | ||
{ | ||
private readonly IDialogContinuation<BotCommandStage> _dialogContinuation; | ||
|
||
public EndCommandHandler(IDialogContinuation<BotCommandStage> dialogContinuation) | ||
{ | ||
_dialogContinuation = dialogContinuation ?? throw new ArgumentNullException(nameof(dialogContinuation)); | ||
} | ||
|
||
public Task<CommandResult> Handle(EndCommand command, CancellationToken token) | ||
{ | ||
if (command is null) | ||
throw new ArgumentNullException(nameof(command)); | ||
|
||
var currentStage = Enum.Parse<BotCommandStage>(command.CurrentStage); | ||
|
||
var dialogState = _dialogContinuation.End(command.MessageContext.PersonId, currentStage); | ||
|
||
if (command.MessageContext.Shared) | ||
dialogState.TryAttachMessage(new ChatMessage( | ||
command.MessageContext.ChatId, | ||
command.MessageContext.MessageId)); | ||
|
||
// TODO: remove messages | ||
|
||
return Task.FromResult(CommandResult.Empty); | ||
} | ||
} |
Oops, something went wrong.