This commit is contained in:
Joe Milazzo 2025-03-02 17:55:23 -06:00 committed by GitHub
parent 78a98d0d18
commit 5af851af08
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 264 additions and 117 deletions

View file

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using API.Entities.Enums;
using API.Entities.Interfaces;
using Microsoft.EntityFrameworkCore;
@ -101,4 +102,24 @@ public class SeriesMetadata : IHasConcurrencyToken
{
RowVersion++;
}
/// <summary>
/// Any People in this Role present
/// </summary>
/// <param name="role"></param>
/// <returns></returns>
public bool AnyOfRole(PersonRole role)
{
return People.Any(p => p.Role == role);
}
/// <summary>
/// Are all instances of the role from Kavita+
/// </summary>
/// <param name="role"></param>
/// <returns></returns>
public bool AllKavitaPlus(PersonRole role)
{
return People.Where(p => p.Role == role).All(p => p.KavitaPlusConnection);
}
}