Rename UserGroupPresentationModel to UserGroupResponseModel
This commit is contained in:
@@ -23,9 +23,9 @@ public class ByKeyUserGroupController : UserGroupControllerBase
|
||||
|
||||
[HttpGet("{id:guid}")]
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(UserGroupPresentationModel), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(typeof(UserGroupResponseModel), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
public async Task<ActionResult<UserGroupPresentationModel>> ByKey(Guid id)
|
||||
public async Task<ActionResult<UserGroupResponseModel>> ByKey(Guid id)
|
||||
{
|
||||
IUserGroup? userGroup = await _userGroupService.GetAsync(id);
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@ public class GetAllUserGroupController : UserGroupControllerBase
|
||||
|
||||
[HttpGet]
|
||||
[MapToApiVersion("1.0")]
|
||||
[ProducesResponseType(typeof(PagedViewModel<UserGroupPresentationModel>), StatusCodes.Status200OK)]
|
||||
public async Task<ActionResult<PagedViewModel<UserGroupPresentationModel>>> GetAll(int skip = 0, int take = 100)
|
||||
[ProducesResponseType(typeof(PagedViewModel<UserGroupResponseModel>), StatusCodes.Status200OK)]
|
||||
public async Task<ActionResult<PagedViewModel<UserGroupResponseModel>>> GetAll(int skip = 0, int take = 100)
|
||||
{
|
||||
// FIXME: In the old controller this endpoint had a switch "onlyCurrentUserGroup"
|
||||
// If this was enabled we'd only return the groups the current user was in
|
||||
@@ -35,6 +35,6 @@ public class GetAllUserGroupController : UserGroupControllerBase
|
||||
PagedModel<IUserGroup> userGroups = await _userGroupService.GetAllAsync(skip, take);
|
||||
|
||||
var viewModels = (await _userPresentationFactory.CreateMultipleAsync(userGroups.Items)).ToList();
|
||||
return new PagedViewModel<UserGroupPresentationModel> { Total = userGroups.Total, Items = viewModels };
|
||||
return new PagedViewModel<UserGroupResponseModel> { Total = userGroups.Total, Items = viewModels };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,23 +6,23 @@ using Umbraco.Cms.Core.Services.OperationStatus;
|
||||
namespace Umbraco.Cms.Api.Management.Factories;
|
||||
|
||||
/// <summary>
|
||||
/// A factory for creating <see cref="UserGroupPresentationModel"/>
|
||||
/// A factory for creating <see cref="UserGroupResponseModel"/>
|
||||
/// </summary>
|
||||
public interface IUserGroupPresentationFactory
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a <see cref="UserGroupPresentationModel"/> based on a <see cref="UserGroup"/>
|
||||
/// Creates a <see cref="UserGroupResponseModel"/> based on a <see cref="UserGroup"/>
|
||||
/// </summary>
|
||||
/// <param name="userGroup"></param>
|
||||
/// <returns></returns>
|
||||
Task<UserGroupPresentationModel> CreateAsync(IUserGroup userGroup);
|
||||
Task<UserGroupResponseModel> CreateAsync(IUserGroup userGroup);
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="UserGroupPresentationModel"/> base on multiple <see cref="UserGroup"/>
|
||||
/// Creates multiple <see cref="UserGroupResponseModel"/> base on multiple <see cref="UserGroup"/>
|
||||
/// </summary>
|
||||
/// <param name="userGroups"></param>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<UserGroupPresentationModel>> CreateMultipleAsync(IEnumerable<IUserGroup> userGroups);
|
||||
Task<IEnumerable<UserGroupResponseModel>> CreateMultipleAsync(IEnumerable<IUserGroup> userGroups);
|
||||
|
||||
/// <summary>
|
||||
/// Creates an <see cref="IUserGroup"/> based on a <see cref="SaveUserGroupRequestModel"/>
|
||||
|
||||
@@ -28,7 +28,7 @@ public class UserGroupPresentationFactory : IUserGroupPresentationFactory
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<UserGroupPresentationModel> CreateAsync(IUserGroup userGroup)
|
||||
public async Task<UserGroupResponseModel> CreateAsync(IUserGroup userGroup)
|
||||
{
|
||||
Guid? contentStartNodeKey = GetKeyFromId(userGroup.StartContentId, UmbracoObjectTypes.Document);
|
||||
Guid? mediaStartNodeKey = GetKeyFromId(userGroup.StartMediaId, UmbracoObjectTypes.Media);
|
||||
@@ -40,7 +40,7 @@ public class UserGroupPresentationFactory : IUserGroupPresentationFactory
|
||||
throw new InvalidOperationException($"Unknown language ID in User Group: {userGroup.Name}");
|
||||
}
|
||||
|
||||
return new UserGroupPresentationModel
|
||||
return new UserGroupResponseModel
|
||||
{
|
||||
Name = userGroup.Name ?? string.Empty,
|
||||
Id = userGroup.Key,
|
||||
@@ -55,9 +55,9 @@ public class UserGroupPresentationFactory : IUserGroupPresentationFactory
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<IEnumerable<UserGroupPresentationModel>> CreateMultipleAsync(IEnumerable<IUserGroup> userGroups)
|
||||
public async Task<IEnumerable<UserGroupResponseModel>> CreateMultipleAsync(IEnumerable<IUserGroup> userGroups)
|
||||
{
|
||||
var userGroupViewModels = new List<UserGroupPresentationModel>();
|
||||
var userGroupViewModels = new List<UserGroupResponseModel>();
|
||||
foreach (IUserGroup userGroup in userGroups)
|
||||
{
|
||||
userGroupViewModels.Add(await CreateAsync(userGroup));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace Umbraco.Cms.Api.Management.ViewModels.UserGroup;
|
||||
|
||||
public class UserGroupPresentationModel : UserGroupBase, INamedEntityPresentationModel
|
||||
public class UserGroupResponseModel : UserGroupBase, INamedEntityPresentationModel
|
||||
{
|
||||
/// <summary>
|
||||
/// The key identifier for the user group.
|
||||
Reference in New Issue
Block a user