1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-30 15:42:48 -05:00

[PM-11123] Service layer for Notification Center (#4741)

* PM-11123: Service layer

* PM-11123: Service layer for Notification Center

* PM-11123: Throw error on unsupported requirement

* PM-11123: Missing await

* PM-11123: Cleanup

* PM-11123: Unit Test coverage

* PM-11123: Flipping the authorization logic to be exact match of fail, formatting

* PM-11123: Async warning

* PM-11123: Using AuthorizeOrThrowAsync, removal of redundant set new id

* PM-11123: UT typo

* PM-11123: UT fix
This commit is contained in:
Maciej Zieniuk
2024-10-02 19:23:19 +02:00
committed by GitHub
parent 9cb99298fc
commit f3f81deb98
29 changed files with 1918 additions and 0 deletions

View File

@ -0,0 +1,31 @@
using AutoFixture;
using Bit.Core.NotificationCenter.Entities;
using Bit.Test.Common.AutoFixture.Attributes;
namespace Bit.Core.Test.NotificationCenter.AutoFixture;
public class NotificationCustomization(bool global) : ICustomization
{
public void Customize(IFixture fixture)
{
fixture.Customize<Notification>(composer =>
{
var postprocessComposer = composer.With(n => n.Id, Guid.NewGuid())
.With(n => n.Global, global);
postprocessComposer = global
? postprocessComposer.Without(n => n.UserId)
: postprocessComposer.With(n => n.UserId, Guid.NewGuid());
return global
? postprocessComposer.Without(n => n.OrganizationId)
: postprocessComposer.With(n => n.OrganizationId, Guid.NewGuid());
});
}
}
public class NotificationCustomizeAttribute(bool global = true)
: BitCustomizeAttribute
{
public override ICustomization GetCustomization() => new NotificationCustomization(global);
}