mirror of
https://github.com/C9Glax/tranga.git
synced 2025-05-22 06:03:01 +02:00
Add ToString Overriddes
This commit is contained in:
parent
2d69b30e83
commit
b49b11828c
@ -12,4 +12,9 @@ public class Author(string authorName)
|
||||
[StringLength(128)]
|
||||
[Required]
|
||||
public string AuthorName { get; init; } = authorName;
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{AuthorId} {AuthorName}";
|
||||
}
|
||||
}
|
@ -84,4 +84,9 @@ public abstract class Job
|
||||
}
|
||||
|
||||
protected abstract IEnumerable<Job> RunInternal(PgsqlContext context);
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{JobId}";
|
||||
}
|
||||
}
|
@ -16,4 +16,9 @@ public class Link(string linkProvider, string linkUrl)
|
||||
[Required]
|
||||
[Url]
|
||||
public string LinkUrl { get; init; } = linkUrl;
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{LinkId} {LinkProvider} {LinkUrl}";
|
||||
}
|
||||
}
|
@ -14,4 +14,9 @@ public class LocalLibrary(string basePath, string libraryName)
|
||||
[StringLength(512)]
|
||||
[Required]
|
||||
public string LibraryName { get; internal set; } = libraryName;
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{LocalLibraryId} {LibraryName} - {BasePath}";
|
||||
}
|
||||
}
|
@ -15,4 +15,9 @@ public class MangaAltTitle(string language, string title)
|
||||
[StringLength(256)]
|
||||
[Required]
|
||||
public string Title { get; set; } = title;
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{AltTitleId} {Language} {Title}";
|
||||
}
|
||||
}
|
@ -9,4 +9,9 @@ public class MangaTag(string tag)
|
||||
[StringLength(64)]
|
||||
[Required]
|
||||
public string Tag { get; init; } = tag;
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{Tag}";
|
||||
}
|
||||
}
|
@ -4,25 +4,49 @@ using Microsoft.EntityFrameworkCore;
|
||||
namespace API.Schema;
|
||||
|
||||
[PrimaryKey("NotificationId")]
|
||||
public class Notification(string title, string message = "", NotificationUrgency urgency = NotificationUrgency.Normal, DateTime? date = null)
|
||||
public class Notification
|
||||
{
|
||||
[StringLength(64)]
|
||||
[Required]
|
||||
public string NotificationId { get; init; } = TokenGen.CreateToken("Notification");
|
||||
public string NotificationId { get; init; }
|
||||
|
||||
[Required]
|
||||
public NotificationUrgency Urgency { get; init; } = urgency;
|
||||
public NotificationUrgency Urgency { get; init; }
|
||||
|
||||
[StringLength(128)]
|
||||
[Required]
|
||||
public string Title { get; init; } = title;
|
||||
public string Title { get; init; }
|
||||
|
||||
[StringLength(512)]
|
||||
[Required]
|
||||
public string Message { get; init; } = message;
|
||||
public string Message { get; init; }
|
||||
|
||||
[Required]
|
||||
public DateTime Date { get; init; } = date ?? DateTime.UtcNow;
|
||||
public DateTime Date { get; init; }
|
||||
|
||||
public Notification() : this("") { }
|
||||
public Notification(string title, string message = "", NotificationUrgency urgency = NotificationUrgency.Normal, DateTime? date = null)
|
||||
{
|
||||
this.NotificationId = TokenGen.CreateToken("Notification");
|
||||
this.Title = title;
|
||||
this.Message = message;
|
||||
this.Urgency = urgency;
|
||||
this.Date = date ?? DateTime.UtcNow;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// EF ONLY!!!
|
||||
/// </summary>
|
||||
public Notification(string notificationId, string title, string message, NotificationUrgency urgency, DateTime date)
|
||||
{
|
||||
this.NotificationId = notificationId;
|
||||
this.Title = title;
|
||||
this.Message = message;
|
||||
this.Urgency = urgency;
|
||||
this.Date = date;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{NotificationId} {Urgency} {Title}";
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user