tmail-backend icon indicating copy to clipboard operation
tmail-backend copied to clipboard

Implement Quota for PublicAssets

Open vttranlina opened this issue 9 months ago • 4 comments

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

vttranlina avatar May 15 '24 08:05 vttranlina