From 3ee3a07565dbd12e7f24da245baad0e48d9f08e3 Mon Sep 17 00:00:00 2001 From: Glax Date: Mon, 16 Dec 2024 17:58:25 +0100 Subject: [PATCH] Urgency --- API/Program.cs | 2 +- API/Schema/Notification.cs | 11 ++--------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/API/Program.cs b/API/Program.cs index 5a60e9a..07c3b9e 100644 --- a/API/Program.cs +++ b/API/Program.cs @@ -115,7 +115,7 @@ 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.Notifications.Add(new Notification("Tranga Started", emojis[Random.Shared.Next(0, emojis.Length - 1)], 2)); context.SaveChanges(); diff --git a/API/Schema/Notification.cs b/API/Schema/Notification.cs index 5ab6ca5..2be36ad 100644 --- a/API/Schema/Notification.cs +++ b/API/Schema/Notification.cs @@ -4,21 +4,14 @@ using Microsoft.EntityFrameworkCore; namespace API.Schema; [PrimaryKey("AltTitleId")] -public class Notification(string title, string message = "", Notification.NotificationUrgency notificationUrgency = Notification.NotificationUrgency.Normal) +public class Notification(string title, string message = "", byte urgency = 2) { [MaxLength(64)] public string NotificationId { get; init; } = TokenGen.CreateToken("Notification", 64); - public NotificationUrgency Urgency { get; init; } = notificationUrgency; + public byte Urgency { get; init; } = urgency; 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