consolidate Service interface and implementation classes

This commit is contained in:
sbwalker
2025-08-11 16:53:32 -04:00
parent b3f6194fda
commit 64b8b5d3c8
70 changed files with 1763 additions and 1996 deletions

View File

@ -8,6 +8,57 @@ using Oqtane.Shared;
namespace Oqtane.Services
{
/// <summary>
/// Service to manage <see cref="Role"/>s on a <see cref="Site"/>
/// </summary>
public interface IRoleService
{
/// <summary>
/// Get all <see cref="Role"/>s of this <see cref="Site"/>.
///
/// Will exclude global roles which are for all sites. To get those as well, use the overload <see cref="GetRolesAsync(int, bool)"/>
/// </summary>
/// <param name="siteId">ID-reference of a <see cref="Site"/></param>
/// <returns></returns>
Task<List<Role>> GetRolesAsync(int siteId);
/// <summary>
/// Get roles of the <see cref="Site"/> and optionally include global Roles.
/// </summary>
/// <param name="siteId">ID-reference to a <see cref="Site"/></param>
/// <param name="includeGlobalRoles">True if it should also include global roles. False will return the same data as just calling <see cref="GetRolesAsync(int)"/></param>
/// <returns></returns>
Task<List<Role>> GetRolesAsync(int siteId, bool includeGlobalRoles);
/// <summary>
/// Get one specific <see cref="Role"/>
/// </summary>
/// <param name="roleId">ID-reference of a <see cref="Role"/></param>
/// <returns></returns>
Task<Role> GetRoleAsync(int roleId);
/// <summary>
/// Add / save a new <see cref="Role"/> to the database.
/// </summary>
/// <param name="role"></param>
/// <returns></returns>
Task<Role> AddRoleAsync(Role role);
/// <summary>
/// Update a <see cref="Role"/> in the database.
/// </summary>
/// <param name="role"></param>
/// <returns></returns>
Task<Role> UpdateRoleAsync(Role role);
/// <summary>
/// Delete / mark-as-deleted a <see cref="Role"/> in the database.
/// </summary>
/// <param name="roleId">ID-reference of a <see cref="Role"/></param>
/// <returns></returns>
Task DeleteRoleAsync(int roleId);
}
[PrivateApi("Don't show in the documentation, as everything should use the Interface")]
public class RoleService : ServiceBase, IRoleService
{