Revert "Add content notifications API"

This reverts commit 8202879ba7.
This commit is contained in:
kjac
2023-03-27 07:55:55 +02:00
parent 8202879ba7
commit 313eed96b9
7 changed files with 0 additions and 131 deletions

View File

@@ -1,31 +0,0 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Umbraco.Cms.Api.Management.Factories;
using Umbraco.Cms.Api.Management.ViewModels.Document;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Services;
namespace Umbraco.Cms.Api.Management.Controllers.Document;
public class NotificationsController : DocumentControllerBase
{
private readonly IContentEditingService _contentEditingService;
private readonly IDocumentNotificationPresentationFactory _documentNotificationPresentationFactory;
public NotificationsController(IContentEditingService contentEditingService, IDocumentNotificationPresentationFactory documentNotificationPresentationFactory)
{
_contentEditingService = contentEditingService;
_documentNotificationPresentationFactory = documentNotificationPresentationFactory;
}
[HttpGet("{key:guid}/notifications")]
[ProducesResponseType(typeof(IEnumerable<DocumentNotificationResponseModel>), StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status404NotFound)]
public async Task<IActionResult> Notifications(Guid key)
{
IContent? content = await _contentEditingService.GetAsync(key);
return content != null
? Ok(await _documentNotificationPresentationFactory.CreateNotificationModelsAsync(content))
: DocumentNotFound();
}
}

View File

@@ -1,37 +0,0 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Umbraco.Cms.Api.Management.ViewModels.Document;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Security;
using Umbraco.Cms.Core.Services;
namespace Umbraco.Cms.Api.Management.Controllers.Document;
public class UpdateNotificationsController : DocumentControllerBase
{
private readonly IContentEditingService _contentEditingService;
private readonly INotificationService _notificationService;
private readonly IBackOfficeSecurityAccessor _backOfficeSecurityAccessor;
public UpdateNotificationsController(IContentEditingService contentEditingService, INotificationService notificationService, IBackOfficeSecurityAccessor backOfficeSecurityAccessor)
{
_contentEditingService = contentEditingService;
_notificationService = notificationService;
_backOfficeSecurityAccessor = backOfficeSecurityAccessor;
}
[HttpPut("{key:guid}/notifications")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status404NotFound)]
public async Task<IActionResult> UpdateNotifications(Guid key, UpdateDocumentNotificationsRequestModel updateModel)
{
IContent? content = await _contentEditingService.GetAsync(key);
if (content == null)
{
return DocumentNotFound();
}
_notificationService.SetNotifications(_backOfficeSecurityAccessor.BackOfficeSecurity?.CurrentUser, content, updateModel.SubscribedActionIds);
return await Task.FromResult(Ok());
}
}