mirror of
https://github.com/Jetsparrow/jetherald.git
synced 2026-01-20 23:56:08 +03:00
fixes
This commit is contained in:
parent
05c491ff0d
commit
4e3da2e917
@ -1,7 +1,8 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@ -12,7 +13,6 @@
|
||||
<PackageReference Include="Dapper" Version="2.0.123" />
|
||||
<PackageReference Include="DSharpPlus" Version="4.1.0" />
|
||||
<PackageReference Include="DSharpPlus.CommandsNext" Version="4.1.0" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.1" />
|
||||
<PackageReference Include="MySql.Data" Version="8.0.28" />
|
||||
<PackageReference Include="NLog.Web.AspNetCore" Version="5.0.0-rc2" />
|
||||
<PackageReference Include="Telegram.Bot.Extensions.Polling" Version="1.0.2" />
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using NLog.Web;
|
||||
@ -18,6 +17,8 @@ try
|
||||
{
|
||||
log.Info("init main");
|
||||
|
||||
DapperConverters.Register();
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
builder.WebHost.ConfigureAppConfiguration((hostingContext, config) =>
|
||||
@ -45,6 +46,7 @@ try
|
||||
services.AddSingleton<Db>();
|
||||
services.AddSingleton<JetHeraldBot>().AddHostedService(s => s.GetService<JetHeraldBot>());
|
||||
services.AddSingleton<LeakyBucket>();
|
||||
services.AddHostedService<HeartMonitor>();
|
||||
services.AddMvc();
|
||||
|
||||
|
||||
|
||||
@ -26,15 +26,15 @@ public class Db
|
||||
new { name });
|
||||
}
|
||||
|
||||
public async Task<Topic> GetTopicForSub(string token, NamespacedId chat)
|
||||
public async Task<Topic> GetTopicForSub(string token, NamespacedId sub)
|
||||
{
|
||||
using var c = GetConnection();
|
||||
return await c.QuerySingleOrDefaultAsync<Topic>(
|
||||
" SELECT t.*, ts.Sub " +
|
||||
" FROM topic t " +
|
||||
" LEFT JOIN topic_sub ts ON t.TopicId = ts.TopicId AND ts.Chat = @chat " +
|
||||
" LEFT JOIN topic_sub ts ON t.TopicId = ts.TopicId AND ts.Sub = @sub " +
|
||||
" WHERE ReadToken = @token",
|
||||
new { token, chat });
|
||||
new { token, sub });
|
||||
}
|
||||
|
||||
public async Task<Topic> CreateTopic(NamespacedId user, string name, string descr)
|
||||
@ -95,7 +95,7 @@ public class Db
|
||||
" DELETE ts " +
|
||||
" FROM topic_sub ts" +
|
||||
" JOIN topic t USING (TopicId) " +
|
||||
" WHERE t.Name = @topicName AND tc.Sub = @sub;",
|
||||
" WHERE t.Name = @topicName AND ts.Sub = @sub;",
|
||||
new { topicName, sub });
|
||||
}
|
||||
|
||||
@ -125,7 +125,7 @@ public class Db
|
||||
public async Task MarkHeartAttackReported(ulong id)
|
||||
{
|
||||
using var c = GetConnection();
|
||||
await c.ExecuteAsync("UPDATE heartevent SET Status = 'reported' WHERE HeartattackId = @id", new { id });
|
||||
await c.ExecuteAsync("UPDATE heartevent SET Status = 'reported' WHERE HeartEventId = @id", new { id });
|
||||
}
|
||||
|
||||
public Db(IOptionsMonitor<ConnectionStrings> cfg)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user