2023-01-04 01:46:31 -06:00
|
|
|
|
using Microsoft.AspNetCore.Identity;
|
2024-10-15 23:48:16 -05:00
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
2023-01-04 01:46:31 -06:00
|
|
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
|
|
|
2024-08-04 18:44:33 -05:00
|
|
|
|
namespace LANCommander.Server.Data.Models
|
2023-01-04 01:46:31 -06:00
|
|
|
|
{
|
|
|
|
|
|
[Table("Roles")]
|
2024-10-15 23:48:16 -05:00
|
|
|
|
public class Role : IdentityRole<Guid>, IBaseModel
|
2023-01-04 01:46:31 -06:00
|
|
|
|
{
|
2024-11-27 01:51:47 -06:00
|
|
|
|
public ICollection<Collection> Collections { get; set; }
|
2025-03-09 01:43:12 -06:00
|
|
|
|
public ICollection<UserRole> UserRoles { get; set; }
|
2026-06-28 14:09:02 -05:00
|
|
|
|
|
|
|
|
|
|
[Display(Name = "Storage Quota (MB)")]
|
|
|
|
|
|
public int? StorageQuotaMB { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
[Display(Name = "Download Speed (KB/s)")]
|
|
|
|
|
|
public int? DownloadSpeedKBps { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
[Display(Name = "Enable Saves")]
|
|
|
|
|
|
public bool? EnableSaves { get; set; }
|
|
|
|
|
|
|
2024-10-16 16:29:55 -05:00
|
|
|
|
[NotMapped]
|
2025-04-14 23:12:16 +02:00
|
|
|
|
public ICollection<User> Users
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return UserRoles?.Select(ur => ur.User).ToArray() ?? [];
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-10-15 23:48:16 -05:00
|
|
|
|
|
|
|
|
|
|
[Display(Name = "Created On")]
|
2025-04-14 23:52:20 +02:00
|
|
|
|
public DateTime CreatedOn { get; set; } = DateTime.UtcNow;
|
2024-10-15 23:48:16 -05:00
|
|
|
|
|
2024-10-23 01:59:17 -05:00
|
|
|
|
public Guid? CreatedById { get; set; }
|
|
|
|
|
|
[ForeignKey(nameof(CreatedById))]
|
|
|
|
|
|
|
2024-10-15 23:48:16 -05:00
|
|
|
|
[Display(Name = "Created By")]
|
2024-11-27 01:51:47 -06:00
|
|
|
|
public User? CreatedBy { get; set; }
|
2024-10-15 23:48:16 -05:00
|
|
|
|
|
|
|
|
|
|
[Display(Name = "Updated On")]
|
2025-04-14 23:52:20 +02:00
|
|
|
|
public DateTime UpdatedOn { get; set; } = DateTime.UtcNow;
|
2024-10-15 23:48:16 -05:00
|
|
|
|
|
2024-10-23 01:59:17 -05:00
|
|
|
|
public Guid? UpdatedById { get; set; }
|
|
|
|
|
|
[ForeignKey(nameof(UpdatedById))]
|
|
|
|
|
|
|
2024-10-15 23:48:16 -05:00
|
|
|
|
[Display(Name = "Updated By")]
|
2024-11-27 01:51:47 -06:00
|
|
|
|
public User? UpdatedBy { get; set; }
|
2023-01-04 01:46:31 -06:00
|
|
|
|
}
|
|
|
|
|
|
}
|