diff --git a/API/API.csproj b/API/API.csproj index 89a7bc5..4da8478 100644 --- a/API/API.csproj +++ b/API/API.csproj @@ -12,6 +12,7 @@ + all diff --git a/API/Program.cs b/API/Program.cs index cc90c1f..5a60e9a 100644 --- a/API/Program.cs +++ b/API/Program.cs @@ -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"); diff --git a/API/Schema/Notification.cs b/API/Schema/Notification.cs new file mode 100644 index 0000000..5ab6ca5 --- /dev/null +++ b/API/Schema/Notification.cs @@ -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 + } +} \ No newline at end of file diff --git a/API/Schema/PgsqlContext.cs b/API/Schema/PgsqlContext.cs index e19970e..9289e1c 100644 --- a/API/Schema/PgsqlContext.cs +++ b/API/Schema/PgsqlContext.cs @@ -18,6 +18,7 @@ public class PgsqlContext(DbContextOptions options) : DbContext(op public DbSet AltTitles { get; set; } public DbSet LibraryConnectors { get; set; } public DbSet NotificationConnectors { get; set; } + public DbSet Notifications { get; set; } protected override void OnModelCreating(ModelBuilder modelBuilder) { diff --git a/CLI/CLI.csproj b/CLI/CLI.csproj index becebd5..c905c4a 100644 --- a/CLI/CLI.csproj +++ b/CLI/CLI.csproj @@ -8,10 +8,6 @@ 12 - - - - diff --git a/Tranga/Tranga.csproj b/Tranga/Tranga.csproj index e7d5a27..c5d37fd 100644 --- a/Tranga/Tranga.csproj +++ b/Tranga/Tranga.csproj @@ -9,14 +9,12 @@ - -