Skip to content

Commit

Permalink
Release 1.1.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ChengYen-Tang committed Jul 3, 2021
1 parent 3ea18fa commit 79aed10
Show file tree
Hide file tree
Showing 17 changed files with 34 additions and 200 deletions.
138 changes: 0 additions & 138 deletions MicrosoftGraphAPIBot/MicrosoftGraph/CalendarApi.cs

This file was deleted.

1 change: 0 additions & 1 deletion MicrosoftGraphAPIBot/MicrosoftGraph/DefaultGraphApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ public class DefaultGraphApi
"offline_access user.read",
OutlookApi.Scope,
OneDriveApi.Scope,
CalendarApi.Scope,
PersonalContactsApi.Scope
};
public readonly static string Scope = string.Join(' ', scopes);
Expand Down
1 change: 1 addition & 0 deletions MicrosoftGraphAPIBot/MicrosoftGraph/FileApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public static async Task<DriveItem> CreateFolderAsync(IGraphServiceClient graphC
/// <returns></returns>
public static async Task DeleteDriveItemAsync(IGraphServiceClient graphClient, string itemId)
{
await Task.Delay(Utils.DeleteDelayTime);
await graphClient.Me.Drive.Items[itemId]
.Request()
.DeleteAsync();
Expand Down
1 change: 1 addition & 0 deletions MicrosoftGraphAPIBot/MicrosoftGraph/OutlookApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ private static async Task SendMessageAsync(IGraphServiceClient graphClient, stri
/// <returns></returns>
private static async Task DeleteMessageAsync(IGraphServiceClient graphClient, string mailId)
{
await Task.Delay(Utils.DeleteDelayTime);
await graphClient.Me.Messages[mailId].Request().DeleteAsync();
}

Expand Down
1 change: 1 addition & 0 deletions MicrosoftGraphAPIBot/MicrosoftGraph/PersonalContactsApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ public static async Task<Contact> CreateContact(IGraphServiceClient graphClient)
/// <returns></returns>
public static async Task DeleteContact(IGraphServiceClient graphClient, string Id)
{
await Task.Delay(Utils.DeleteDelayTime);
await graphClient.Me.Contacts[Id]
.Request()
.DeleteAsync();
Expand Down
20 changes: 10 additions & 10 deletions MicrosoftGraphAPIBot/MicrosoftGraphAPIBot.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="HangFire.Core" Version="1.7.19" />
<PackageReference Include="HangFire.SqlServer" Version="1.7.19" />
<PackageReference Include="HangFire.Core" Version="1.7.24" />
<PackageReference Include="HangFire.SqlServer" Version="1.7.24" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand All @@ -24,26 +24,26 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Analyzers" Version="5.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.2">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Analyzers" Version="5.0.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.7">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="5.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="5.0.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.7" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="5.0.0" />
<PackageReference Include="Microsoft.Graph" Version="3.21.0" />
<PackageReference Include="Microsoft.Graph" Version="3.35.0" />
<PackageReference Include="Serilog.Extensions.Logging.File" Version="2.0.0" />
<PackageReference Include="SonarAnalyzer.CSharp" Version="8.16.0.25740">
<PackageReference Include="SonarAnalyzer.CSharp" Version="8.25.0.33663">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="System.Linq.Async" Version="5.0.0" />
<PackageReference Include="Telegram.Bot" Version="15.7.1" />
<PackageReference Include="Telegram.Bot" Version="16.0.0" />
<PackageReference Include="Text.Analyzers" Version="2.6.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
1 change: 0 additions & 1 deletion MicrosoftGraphAPIBot/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ private static IHostBuilder CreateHostBuilder(string[] args) =>
services.AddScoped<GraphApi, OutlookApi>();
services.AddScoped<GraphApi, OneDriveApi>();
services.AddScoped<GraphApi, PermissionsApi>();
services.AddScoped<GraphApi, CalendarApi>();
services.AddScoped<GraphApi, PersonalContactsApi>();
services.AddTransient<ApiController>();
services.AddTransient<ApiCallManager>();
Expand Down
1 change: 1 addition & 0 deletions MicrosoftGraphAPIBot/Services/CrontabService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public async Task StartAsync(CancellationToken cancellationToken)
{
try
{
Utils.DeleteDelayTime = configuration.GetValue<int>("DeleteDelayTime");
StartReceiving();
isStart = true;
logger.LogInformation("Api call service is starting.");
Expand Down
3 changes: 3 additions & 0 deletions MicrosoftGraphAPIBot/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ namespace MicrosoftGraphAPIBot
{
public static class Utils
{
public static int DeleteDelayTime { get; set; } = 30000;

/// <summary>
/// 將 appsettings.json 中的 SQL 參數合併成連接字串
/// </summary>
Expand Down Expand Up @@ -134,6 +136,7 @@ public static void Assert(bool condition, [CallerLineNumber] int lineNumber = 0,
"CheckVerCron",
"PushResultCron",
"AdminPassword",
"DeleteDelayTime",
"Telegram:Token",
"MSSQL:Host",
"MSSQL:Port",
Expand Down
1 change: 0 additions & 1 deletion MicrosoftGraphBotTests/ApiCallManagerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ public ApiCallManagerTests()
services.AddScoped<GraphApi, OutlookApi>();
services.AddScoped<GraphApi, OneDriveApi>();
services.AddScoped<GraphApi, PermissionsApi>();
services.AddScoped<GraphApi, CalendarApi>();
services.AddScoped<GraphApi, PersonalContactsApi>();
services.AddScoped<ApiController>();
services.AddScoped<ApiCallManager>();
Expand Down
7 changes: 3 additions & 4 deletions MicrosoftGraphBotTests/ApiControllerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public ApiControllerTests()
services.AddScoped<GraphApi, OutlookApi>();
services.AddScoped<GraphApi, OneDriveApi>();
services.AddScoped<GraphApi, PermissionsApi>();
services.AddScoped<GraphApi, CalendarApi>();
services.AddScoped<GraphApi, PersonalContactsApi>();
services.AddScoped<ApiController>();
}
Expand All @@ -44,7 +43,7 @@ public async Task TestApiRunNoConfig()
ApiController apiController = serviceProvider.GetRequiredService<ApiController>();
IEnumerable<(string, string, bool)> results = await apiController.RunAsync(graphClient, "Test");

Assert.AreEqual(15, results.Count());
Assert.AreEqual(13, results.Count());
}

[TestMethod]
Expand All @@ -66,7 +65,7 @@ public async Task TestApiRunAll()
ApiController apiController = serviceProvider.GetRequiredService<ApiController>();
IEnumerable<(string, string, bool)> results = await apiController.RunAsync(graphClient, "Test");

Assert.AreEqual(15, results.Count());
Assert.AreEqual(13, results.Count());
}

[TestMethod]
Expand All @@ -88,7 +87,7 @@ public async Task TestApiRun1()
ApiController apiController = serviceProvider.GetRequiredService<ApiController>();
IEnumerable<(string, string, bool)> results = await apiController.RunAsync(graphClient, "Test");

Assert.AreEqual(5, results.Count());
Assert.AreEqual(4, results.Count());
}
}
}
1 change: 1 addition & 0 deletions MicrosoftGraphBotTests/BotUtilsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public void TestCheckConfig()
{ "CheckVerCron", string.Empty },
{ "PushResultCron", string.Empty },
{ "AdminPassword", string.Empty },
{ "DeleteDelayTime", string.Empty },
{ "Telegram:Token", string.Empty },
{ "MSSQL:Host", string.Empty },
{ "MSSQL:Port", string.Empty },
Expand Down
38 changes: 0 additions & 38 deletions MicrosoftGraphBotTests/CalendarApiTests.cs

This file was deleted.

8 changes: 2 additions & 6 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Microsoft Graph API 是一個 RESTful 的 Web API,可讓您存取 Microsoft Cl
"CheckVerCron": "0 */12 * * *",
"PushResultCron": "0 0 * * *",
"AdminPassword": "P@ssw0rd",
"DeleteDelayTime": 30000,
"Telegram": {
"Token": "1119104861:AAH4D1-ZdtwvFPeQARLJAdhBYPA1xK7px08"
},
Expand All @@ -61,6 +62,7 @@ Microsoft Graph API 是一個 RESTful 的 Web API,可讓您存取 Microsoft Cl
||CheckVerCron|檢查 **Bot** 是否有新版本的頻率,請參考 Crontab 格式|
||PushResultCron|推播使用者呼叫 **API** 結果的頻率,請參考 Crontab 格式|
||AdminPassword|管理者密碼,與 Bot 溝通後,輸入此密碼可取得管理者權限|
||DeleteDelayTime|任務執行完畢,刪除任務產生的垃圾資料前等待的時間|
|Telegram|Token|Telegram bot token,請與 [Telegram bot father](https://core.telegram.org/bots) 聊天建立 Telegram bot 並取得 Token|
|MSSQL|Host|SQL server 主機位置 (備註:使用 Docker compose 在 MSSQL 項不需要做任何更改)|
||Port|SQL server port|
Expand Down Expand Up @@ -161,12 +163,6 @@ Microsoft Graph API 是一個 RESTful 的 Web API,可讓您存取 Microsoft Cl
- Update sharing permission
- Delete a sharing permission from a file or folder
### [Calendar API](https://github.com/NTUT-SELab/MicrosoftGraphBot/issues/12)
- List calendars
- Create Calendar
- Update calendar
- Delete calendar
### [Personal contacts API](https://github.com/NTUT-SELab/MicrosoftGraphBot/issues/10)
- Get contact
- Create Contact
Expand Down
9 changes: 9 additions & 0 deletions ReleaseNotes/1.1.5.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## 新功能:

## 變更:
Remove Calendar API
Add the DeleteDelayTime parameter in the config file

## Bug 修復:

## 文檔:
1 change: 1 addition & 0 deletions appsettings.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"CheckVerCron": "0 */12 * * *",
"PushResultCron": "0 0 * * *",
"AdminPassword": "P@ssw0rd",
"DeleteDelayTime": 30000,
"Telegram": {
"Token": "1119104861:AAH4D1-ZdtwvFPeQARLJAdhBYPA1xK7px08"
},
Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
variables:
buildConfiguration: 'Release'
version: '1.1.4.0'
version: '1.1.5.0'

stages:
- stage: Build_and_Test
Expand Down

0 comments on commit 79aed10

Please sign in to comment.