mirror of
https://github.com/C9Glax/tranga.git
synced 2025-02-23 07:40:13 +01:00
Schema add Notifications
This commit is contained in:
parent
538e6fa60b
commit
84833acdeb
@ -12,6 +12,7 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Asp.Versioning.Mvc.ApiExplorer" Version="8.1.0" />
|
||||
<PackageReference Include="HtmlAgilityPack" Version="1.11.71" />
|
||||
<PackageReference Include="log4net" Version="3.0.3" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
|
@ -4,9 +4,12 @@ using API;
|
||||
using API.Schema;
|
||||
using API.Schema.Jobs;
|
||||
using API.Schema.MangaConnectors;
|
||||
using API.Schema.NotificationConnectors;
|
||||
using Asp.Versioning;
|
||||
using Asp.Versioning.Builder;
|
||||
using Asp.Versioning.Conventions;
|
||||
using log4net;
|
||||
using log4net.Config;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
@ -111,7 +114,18 @@ using (var scope = app.Services.CreateScope())
|
||||
|
||||
context.Jobs.RemoveRange(context.Jobs.Where(j => j.state == JobState.Completed && j.RecurrenceMs < 1));
|
||||
|
||||
string[] emojis = { "(•‿•)", "(づ \u25d5‿\u25d5 )づ", "( \u02d8\u25bd\u02d8)っ\u2668", "=\uff3e\u25cf \u22cf \u25cf\uff3e=", "(ΦωΦ)", "(\u272a\u3268\u272a)", "( ノ・o・ )ノ", "(〜^\u2207^ )〜", "~(\u2267ω\u2266)~","૮ \u00b4• ﻌ \u00b4• ა", "(\u02c3ᆺ\u02c2)", "(=\ud83d\udf66 \u0f1d \ud83d\udf66=)"};
|
||||
context.Notifications.Add(new Notification("Tranga Started", emojis[Random.Shared.Next(0, emojis.Length - 1)], Notification.NotificationUrgency.High));
|
||||
|
||||
context.SaveChanges();
|
||||
|
||||
|
||||
string TRANGA = "\n\n _______ \n|_ _|.----..---.-..-----..-----..---.-.\n | | | _|| _ || || _ || _ |\n |___| |__| |___._||__|__||___ ||___._|\n |_____| \n\n";
|
||||
ILog Log = LogManager.GetLogger("Tranga");
|
||||
BasicConfigurator.Configure();
|
||||
|
||||
Log.Info(TRANGA);
|
||||
Log.Info(TrangaSettings.Serialize());
|
||||
}
|
||||
|
||||
app.UseCors("AllowAll");
|
||||
|
24
API/Schema/Notification.cs
Normal file
24
API/Schema/Notification.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace API.Schema;
|
||||
|
||||
[PrimaryKey("AltTitleId")]
|
||||
public class Notification(string title, string message = "", Notification.NotificationUrgency notificationUrgency = Notification.NotificationUrgency.Normal)
|
||||
{
|
||||
[MaxLength(64)]
|
||||
public string NotificationId { get; init; } = TokenGen.CreateToken("Notification", 64);
|
||||
|
||||
public NotificationUrgency Urgency { get; init; } = notificationUrgency;
|
||||
|
||||
public string Title { get; init; } = title;
|
||||
|
||||
public string Message { get; init; } = message;
|
||||
|
||||
public enum NotificationUrgency : byte
|
||||
{
|
||||
Low = 0,
|
||||
Normal = 1,
|
||||
High = 3
|
||||
}
|
||||
}
|
@ -18,6 +18,7 @@ public class PgsqlContext(DbContextOptions<PgsqlContext> options) : DbContext(op
|
||||
public DbSet<MangaAltTitle> AltTitles { get; set; }
|
||||
public DbSet<LibraryConnector> LibraryConnectors { get; set; }
|
||||
public DbSet<NotificationConnector> NotificationConnectors { get; set; }
|
||||
public DbSet<Notification> Notifications { get; set; }
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
|
@ -8,10 +8,6 @@
|
||||
<LangVersion>12</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Spectre.Console.Cli" Version="0.49.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Tranga\Tranga.csproj" />
|
||||
</ItemGroup>
|
||||
|
@ -9,14 +9,12 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="GlaxArguments" Version="1.1.0" />
|
||||
<PackageReference Include="HtmlAgilityPack" Version="1.11.71" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.5" />
|
||||
<PackageReference Include="PuppeteerSharp" Version="20.0.5" />
|
||||
<PackageReference Include="Soenneker.Utils.String.NeedlemanWunsch" Version="2.1.301" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="9.0.0-preview.7.24405.4" />
|
||||
<PackageReference Include="ZstdSharp.Port" Version="0.8.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
Loading…
x
Reference in New Issue
Block a user