Tranga/API/Schema/Notification.cs

21 lines
683 B
C#
Raw Normal View History

2024-12-16 17:35:36 +01:00
using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore;
namespace API.Schema;
2024-12-16 18:02:48 +01:00
[PrimaryKey("NotificationId")]
2024-12-16 20:14:28 +01:00
public class Notification(string title, string message = "", NotificationUrgency urgency = NotificationUrgency.Normal, DateTime? date = null)
2024-12-16 17:35:36 +01:00
{
[MaxLength(64)]
public string NotificationId { get; init; } = TokenGen.CreateToken("Notification", 64);
2024-12-16 20:14:28 +01:00
public NotificationUrgency Urgency { get; init; } = urgency;
2024-12-16 17:35:36 +01:00
public string Title { get; init; } = title;
public string Message { get; init; } = message;
2024-12-16 20:03:45 +01:00
2024-12-16 20:34:20 +01:00
public DateTime Date { get; init; } = date ?? DateTime.UtcNow;
2024-12-16 20:35:25 +01:00
public Notification() : this("") { }
2024-12-16 17:35:36 +01:00
}