Skip to content

Commit bda7160

Browse files
authored
Merge pull request #22 from GGrouppFoundation/feature/improve-value-steps
Feature/improve value steps
2 parents 76e94be + 1f2b3e9 commit bda7160

35 files changed

+628
-107
lines changed

src/Application/Application.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<InvariantGlobalization>false</InvariantGlobalization>
99
<RootNamespace>GGroupp.Internal.Timesheet</RootNamespace>
1010
<AssemblyName>GGroupp.Internal.Timesheet.Bot.Application</AssemblyName>
11-
<Version>1.4.0</Version>
11+
<Version>1.5.0</Version>
1212
</PropertyGroup>
1313

1414
<PropertyGroup Condition=" '$(RunConfiguration)' == 'Application' " />
@@ -19,7 +19,7 @@
1919
<PackageReference Include="GGroupp.Infra.Bot.Builder.Command.Stop" Version="1.1.1" />
2020
<PackageReference Include="GGroupp.Infra.Bot.Builder.Integration.AspNet.Core" Version="1.4.0" />
2121
<PackageReference Include="GGroupp.Infra.Bot.Builder.Integration.CosmosDb" Version="1.0.0" />
22-
<PackageReference Include="GGroupp.Infra.Dataverse.Api" Version="2.7.4" />
22+
<PackageReference Include="GGroupp.Infra.Dataverse.Api" Version="2.7.5" />
2323
<PackageReference Include="GGroupp.Infra.Http.SocketsHandlerProvider" Version="2.2.0" />
2424
<PackageReference Include="GGroupp.Internal.Timesheet.FavoriteProjectSet.Get.Api" Version="1.4.2" />
2525
<PackageReference Include="GGroupp.Internal.Timesheet.ProjectSet.Search.Api" Version="1.4.4" />
@@ -30,6 +30,7 @@
3030
</ItemGroup>
3131

3232
<ItemGroup>
33+
<ProjectReference Include="..\Menu.Show\Menu.Show.csproj" />
3334
<ProjectReference Include="..\Timesheet.Create\Timesheet.Create.csproj" />
3435
<ProjectReference Include="..\DateTimesheet.Get\DateTimesheet.Get.csproj" />
3536
</ItemGroup>

src/Application/BotBuilder/Command.BotInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ namespace GGroupp.Internal.Timesheet;
88

99
partial class GTimesheetBotBuilder
1010
{
11-
internal static IBotBuilder UseGTimesheetBotInfo(this IBotBuilder botBuilder, string commandName)
11+
internal static IBotBuilder UseGTimesheetBotInfo(this IBotBuilder botBuilder)
1212
=>
13-
botBuilder.UseBotInfo(commandName, GetBotInfoData);
13+
botBuilder.UseBotInfo(BotInfoCommand, GetBotInfoData);
1414

1515
private static BotInfoData GetBotInfoData(IBotContext botContext)
1616
=>

src/Application/BotBuilder/Command.BotStop.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ namespace GGroupp.Internal.Timesheet;
44

55
partial class GTimesheetBotBuilder
66
{
7-
internal static IBotBuilder UseGTimesheetBotStop(this IBotBuilder botBuilder, string commandName)
7+
internal static IBotBuilder UseGTimesheetBotStop(this IBotBuilder botBuilder)
88
=>
9-
botBuilder.UseBotStop(commandName, static () => new(successText: "Операция остановлена"));
10-
}
9+
botBuilder.UseBotStop(StopCommand, static () => new(successText: "Операция остановлена"));
10+
}

src/Application/BotBuilder/Command.DateTimesheetGet.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ namespace GGroupp.Internal.Timesheet;
77

88
partial class GTimesheetBotBuilder
99
{
10-
internal static IBotBuilder UseGDateTimesheetGet(this IBotBuilder botBuilder, string commandName)
10+
internal static IBotBuilder UseGDateTimesheetGet(this IBotBuilder botBuilder)
1111
=>
12-
botBuilder.UseDateTimesheetGet(commandName, GetTimesheetSetApi);
12+
botBuilder.UseDateTimesheetGet("datetimesheet", GetTimesheetSetApi);
1313

1414
private static ITimesheetSetGetFunc GetTimesheetSetApi(IBotContext botContext)
1515
=>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using GGroupp.Infra.Bot.Builder;
2+
3+
namespace GGroupp.Internal.Timesheet;
4+
5+
partial class GTimesheetBotBuilder
6+
{
7+
internal static IBotBuilder UseGTimesheetLogout(this IBotBuilder botBuilder)
8+
=>
9+
botBuilder.UseLogout(LogoutCommand);
10+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using System;
2+
using System.Threading;
3+
using GGroupp.Infra.Bot.Builder;
4+
5+
namespace GGroupp.Internal.Timesheet;
6+
7+
partial class GTimesheetBotBuilder
8+
{
9+
internal static IBotBuilder UseGTimesheetBotMenu(this IBotBuilder botBuilder)
10+
=>
11+
botBuilder.UseBotMenu(lazyMenuData.Value);
12+
13+
private static readonly Lazy<BotMenuData> lazyMenuData = new(CreateMenuData, LazyThreadSafetyMode.ExecutionAndPublication);
14+
15+
private static BotMenuData CreateMenuData()
16+
=>
17+
new(
18+
text: "Меню бота",
19+
commands: new BotMenuCommand[]
20+
{
21+
new(Guid.Parse("31f7730f-5d18-468c-b540-1cd03e27c268"), TimesheetCreateCommand, "Списать время"),
22+
new(Guid.Parse("a5622d66-5b63-4d3b-a0c6-c5123ac8e538"), DateTimesheetGetCommand, "Показать мои списания времени"),
23+
new(Guid.Parse("49919c45-ef85-4fc9-a21d-8b5683303360"), BotInfoCommand, "О боте")
24+
});
25+
}

src/Application/BotBuilder/Command.TimesheetCreate.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ namespace GGroupp.Internal.Timesheet;
1212

1313
partial class GTimesheetBotBuilder
1414
{
15-
internal static IBotBuilder UseGTimesheetCreate(this IBotBuilder botBuilder, string commandName)
15+
internal static IBotBuilder UseGTimesheetCreate(this IBotBuilder botBuilder)
1616
=>
17-
botBuilder.UseTimesheetCreate(commandName, GetFavoriteProjectSetGetApi, GetProjectSetSearchApi, GetTimesheetCreateApi);
17+
botBuilder.UseTimesheetCreate(TimesheetCreateCommand, GetFavoriteProjectSetGetApi, GetProjectSetSearchApi, GetTimesheetCreateApi);
1818

1919
private static IFavoriteProjectSetGetFunc GetFavoriteProjectSetGetApi(IBotContext botContext)
2020
=>

src/Application/BotBuilder/GTimesheetBotBuilder.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@ namespace GGroupp.Internal.Timesheet;
1010

1111
internal static partial class GTimesheetBotBuilder
1212
{
13+
private const string TimesheetCreateCommand = "newtimesheet";
14+
15+
private const string DateTimesheetGetCommand = "datetimesheet";
16+
17+
private const string BotInfoCommand = "info";
18+
19+
private const string StopCommand = "stop";
20+
21+
private const string LogoutCommand = "logout";
22+
1323
private static Dependency<LoggerDelegatingHandler> CreateStandardHttpHandlerDependency(string loggerCategoryName)
1424
=>
1525
PrimaryHandler.UseStandardSocketsHttpHandler()

src/Application/Program.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@ private static Task RunAsync(string[] args)
2424

2525
private static IBotBuilder ConfigureGTimesheetBot(IBotBuilder bot)
2626
=>
27-
bot.UseLogout("logout")
28-
.UseGTimesheetBotStop("stop")
27+
bot
28+
.UseGTimesheetLogout()
29+
.UseGTimesheetBotStop()
2930
.UseGTimesheetAuthorization()
30-
.UseGTimesheetBotInfo("info")
31-
.UseGTimesheetCreate("newtimesheet")
32-
.UseGDateTimesheetGet("datetimesheet");
31+
.UseGTimesheetBotInfo()
32+
.UseGTimesheetCreate()
33+
.UseGDateTimesheetGet()
34+
.UseGTimesheetBotMenu();
3335
}

src/DateTimesheet.Get/DateTimesheet.Get.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212

1313
<ItemGroup>
1414
<PackageReference Include="EarlyFuncPack.Core.AsyncPipeline" Version="0.1.0" />
15-
<PackageReference Include="GGroupp.Infra.Bot.Builder.ChatFlow.Step.Date" Version="2.0.0" />
16-
<PackageReference Include="GGroupp.Infra.Bot.Builder.TurnContext.Extensions" Version="1.1.0" />
15+
<PackageReference Include="GGroupp.Infra.Bot.Builder.ChatFlow.Step.Date" Version="2.2.0" />
16+
<PackageReference Include="GGroupp.Infra.Bot.Builder.TurnContext.Extensions" Version="1.1.1" />
1717
<PackageReference Include="GGroupp.Internal.Timesheet.TimesheetSet.Get.InOut" Version="1.0.1" />
1818
<PackageReference Include="PrimeFuncPack.Core.Failure" Version="2.0.0" />
1919
<PackageReference Include="PrimeFuncPack.Primitives.Pipeline" Version="2.0.1" />

0 commit comments

Comments
 (0)