2023-06-01 00:03:23 -04:00
|
|
|
namespace vassago.Models;
|
|
|
|
|
2023-05-23 19:03:58 -04:00
|
|
|
using System;
|
2023-06-01 00:03:23 -04:00
|
|
|
using System.Collections.Generic;
|
2023-06-05 14:55:48 -04:00
|
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
using System.Reflection;
|
2025-02-03 20:41:11 -05:00
|
|
|
using Microsoft.EntityFrameworkCore;
|
2023-05-23 19:03:58 -04:00
|
|
|
|
2023-06-19 12:56:40 -04:00
|
|
|
public class User
|
2023-05-23 19:03:58 -04:00
|
|
|
{
|
2023-06-05 14:55:48 -04:00
|
|
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
2023-06-01 00:03:23 -04:00
|
|
|
public Guid Id { get; set; }
|
2025-02-03 20:41:11 -05:00
|
|
|
[DeleteBehavior(DeleteBehavior.Cascade)]
|
2023-06-19 12:56:40 -04:00
|
|
|
public List<Account> Accounts { get; set; }
|
2023-11-30 12:50:51 -05:00
|
|
|
|
2024-07-07 14:22:10 -04:00
|
|
|
//if I ever get lots and lots of tags, or some automatic way to register a feature's arbitrary tags, then I can move this off.
|
2024-07-07 15:27:48 -04:00
|
|
|
//public bool Tag_CanTwitchSummon { get; set; }
|
2024-07-07 14:22:10 -04:00
|
|
|
|
2023-11-30 12:50:51 -05:00
|
|
|
public string DisplayName
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
2025-01-28 17:09:23 -05:00
|
|
|
if (Accounts?.Any() ?? false)
|
|
|
|
{
|
|
|
|
return Accounts.Select(a => a.DisplayName).Distinct()
|
|
|
|
.MaxBy(distinctName =>
|
|
|
|
Accounts.Select(a => a.DisplayName)
|
|
|
|
.Where(selectedName => selectedName == distinctName).Count()
|
|
|
|
);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return $"[accountless {Id}";
|
|
|
|
}
|
2023-11-30 12:50:51 -05:00
|
|
|
}
|
|
|
|
}
|
2023-05-23 19:03:58 -04:00
|
|
|
}
|