mirror of
https://github.com/C9Glax/tranga.git
synced 2025-04-14 04:13:18 +02:00
28 lines
805 B
C#
28 lines
805 B
C#
using System.ComponentModel.DataAnnotations;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace API.Schema;
|
|
|
|
[PrimaryKey("NotificationId")]
|
|
public class Notification(string title, string message = "", NotificationUrgency urgency = NotificationUrgency.Normal, DateTime? date = null)
|
|
{
|
|
[StringLength(64)]
|
|
[Required]
|
|
public string NotificationId { get; init; } = TokenGen.CreateToken("Notification");
|
|
|
|
[Required]
|
|
public NotificationUrgency Urgency { get; init; } = urgency;
|
|
|
|
[StringLength(128)]
|
|
[Required]
|
|
public string Title { get; init; } = title;
|
|
|
|
[StringLength(512)]
|
|
[Required]
|
|
public string Message { get; init; } = message;
|
|
|
|
[Required]
|
|
public DateTime Date { get; init; } = date ?? DateTime.UtcNow;
|
|
|
|
public Notification() : this("") { }
|
|
} |