vassago/Models/User.cs
adam be94366763
All checks were successful
gitea.arg.rip/vassago/pipeline/head This commit looks good
UACs, have a web interface, can be linked
twitch interface needs to collapse users, it's creating redundant copies
UACs need to be un-linkable
no search and no list make homer something something
2025-04-23 11:44:11 -04:00

40 lines
1.1 KiB
C#

namespace vassago.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Reflection;
using Microsoft.EntityFrameworkCore;
public class User
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public Guid Id { get; set; }
[DeleteBehavior(DeleteBehavior.Cascade)]
public List<Account> Accounts { get; set; }
public List<UAC> UACs { get; set; }
//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.
//public bool Tag_CanTwitchSummon { get; set; }
public string DisplayName
{
get
{
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}]";
}
}
}
}