mirror of
https://github.com/standardnotes/server
synced 2026-07-14 00:01:54 -04:00
chore: remove unused revisions ownership event
This commit is contained in:
@@ -1,7 +0,0 @@
|
||||
import { DomainEventInterface } from './DomainEventInterface'
|
||||
import { RevisionsOwnershipUpdateRequestedEventPayload } from './RevisionsOwnershipUpdateRequestedEventPayload'
|
||||
|
||||
export interface RevisionsOwnershipUpdateRequestedEvent extends DomainEventInterface {
|
||||
type: 'REVISIONS_OWNERSHIP_UPDATE_REQUESTED'
|
||||
payload: RevisionsOwnershipUpdateRequestedEventPayload
|
||||
}
|
||||
-4
@@ -1,4 +0,0 @@
|
||||
export interface RevisionsOwnershipUpdateRequestedEventPayload {
|
||||
itemUuid: string
|
||||
userUuid: string
|
||||
}
|
||||
@@ -54,8 +54,6 @@ export * from './Event/RefundProcessedEvent'
|
||||
export * from './Event/RefundProcessedEventPayload'
|
||||
export * from './Event/RevisionsCopyRequestedEvent'
|
||||
export * from './Event/RevisionsCopyRequestedEventPayload'
|
||||
export * from './Event/RevisionsOwnershipUpdateRequestedEvent'
|
||||
export * from './Event/RevisionsOwnershipUpdateRequestedEventPayload'
|
||||
export * from './Event/SharedSubscriptionInvitationCanceledEvent'
|
||||
export * from './Event/SharedSubscriptionInvitationCanceledEventPayload'
|
||||
export * from './Event/SharedSubscriptionInvitationCreatedEvent'
|
||||
|
||||
@@ -36,7 +36,6 @@ const TYPES = {
|
||||
ItemDumpedEventHandler: Symbol.for('ItemDumpedEventHandler'),
|
||||
AccountDeletionRequestedEventHandler: Symbol.for('AccountDeletionRequestedEventHandler'),
|
||||
RevisionsCopyRequestedEventHandler: Symbol.for('RevisionsCopyRequestedEventHandler'),
|
||||
RevisionsOwnershipUpdateRequestedEventHandler: Symbol.for('RevisionsOwnershipUpdateRequestedEventHandler'),
|
||||
// Services
|
||||
CrossServiceTokenDecoder: Symbol.for('CrossServiceTokenDecoder'),
|
||||
DomainEventSubscriberFactory: Symbol.for('DomainEventSubscriberFactory'),
|
||||
|
||||
@@ -23,7 +23,6 @@ import { FSDumpRepository } from '../Infra/FS/FSDumpRepository'
|
||||
import { AccountDeletionRequestedEventHandler } from '../Domain/Handler/AccountDeletionRequestedEventHandler'
|
||||
import { RevisionsCopyRequestedEventHandler } from '../Domain/Handler/RevisionsCopyRequestedEventHandler'
|
||||
import { CopyRevisions } from '../Domain/UseCase/CopyRevisions/CopyRevisions'
|
||||
import { RevisionsOwnershipUpdateRequestedEventHandler } from '../Domain/Handler/RevisionsOwnershipUpdateRequestedEventHandler'
|
||||
import { CommonContainerConfigLoader } from './CommonContainerConfigLoader'
|
||||
import { Env } from './Env'
|
||||
|
||||
@@ -120,11 +119,6 @@ export class WorkerContainerConfigLoader extends CommonContainerConfigLoader {
|
||||
context.container.get(TYPES.Logger),
|
||||
)
|
||||
})
|
||||
container
|
||||
.bind<RevisionsOwnershipUpdateRequestedEventHandler>(TYPES.RevisionsOwnershipUpdateRequestedEventHandler)
|
||||
.toDynamicValue((context: interfaces.Context) => {
|
||||
return new RevisionsOwnershipUpdateRequestedEventHandler(context.container.get(TYPES.RevisionRepository))
|
||||
})
|
||||
|
||||
container
|
||||
.bind<DomainEventMessageHandlerInterface>(TYPES.DomainEventMessageHandler)
|
||||
@@ -135,10 +129,6 @@ export class WorkerContainerConfigLoader extends CommonContainerConfigLoader {
|
||||
['ITEM_DUMPED', context.container.get(TYPES.ItemDumpedEventHandler)],
|
||||
['ACCOUNT_DELETION_REQUESTED', context.container.get(TYPES.AccountDeletionRequestedEventHandler)],
|
||||
['REVISIONS_COPY_REQUESTED', context.container.get(TYPES.RevisionsCopyRequestedEventHandler)],
|
||||
[
|
||||
'REVISIONS_OWNERSHIP_UPDATE_REQUESTED',
|
||||
context.container.get(TYPES.RevisionsOwnershipUpdateRequestedEventHandler),
|
||||
],
|
||||
])
|
||||
|
||||
const handler =
|
||||
|
||||
-25
@@ -1,25 +0,0 @@
|
||||
/* istanbul ignore file */
|
||||
|
||||
import { Uuid } from '@standardnotes/domain-core'
|
||||
import { DomainEventHandlerInterface, RevisionsOwnershipUpdateRequestedEvent } from '@standardnotes/domain-events'
|
||||
import { RevisionRepositoryInterface } from '../Revision/RevisionRepositoryInterface'
|
||||
|
||||
export class RevisionsOwnershipUpdateRequestedEventHandler implements DomainEventHandlerInterface {
|
||||
constructor(private revisionRepository: RevisionRepositoryInterface) {}
|
||||
|
||||
async handle(event: RevisionsOwnershipUpdateRequestedEvent): Promise<void> {
|
||||
const userUuidOrError = Uuid.create(event.payload.userUuid)
|
||||
if (userUuidOrError.isFailed()) {
|
||||
return
|
||||
}
|
||||
const userUuid = userUuidOrError.getValue()
|
||||
|
||||
const itemUuidOrError = Uuid.create(event.payload.itemUuid)
|
||||
if (itemUuidOrError.isFailed()) {
|
||||
return
|
||||
}
|
||||
const itemUuid = itemUuidOrError.getValue()
|
||||
|
||||
await this.revisionRepository.updateUserUuid(itemUuid, userUuid)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user