tmail-backend
tmail-backend copied to clipboard
Implement Quota for PublicAssets
Why
Control resource when the user uploads PublicAsset Epic: https://github.com/linagora/tmail-backend/issues/1027
How
- Create 2 new Events:
case class TmailPublicAssetAddedEvent(eventId: EventId, username: Username, id: PublicAssetId, size: Size) extends TmailContactUserEvent {}
case class TmailPublicAssetDeletedEvent(eventId: EventId, username: Username, id: PublicAssetId, size: Size) extends TmailContactUserEvent {}
- Dispatch the corresponding event when the user invokes JMAP PublicAsset/set, PublicAsset/destroy successfully
- Create PublicAssetEventListener, try to hang the PublicAsset event, then update the current quota.
class PublicAssetEventListener @Inject()(UserQuotaRootResolver: UserQuotaRootResolver, currentQuotaManager: CurrentQuotaManager) extends ReactiveGroupEventListener
Dod
Write PublicAssetEventListenerIntegrationTest