mirror of
https://github.com/standardnotes/server
synced 2026-07-14 00:01:54 -04:00
27 lines
1.0 KiB
TypeScript
27 lines
1.0 KiB
TypeScript
import { inject, injectable } from 'inversify'
|
|
import { Logger } from 'winston'
|
|
import TYPES from '../../../Bootstrap/Types'
|
|
import { WebSocketsConnectionRepositoryInterface } from '../../WebSockets/WebSocketsConnectionRepositoryInterface'
|
|
import { UseCaseInterface } from '../UseCaseInterface'
|
|
import { AddWebSocketsConnectionDTO } from './AddWebSocketsConnectionDTO'
|
|
import { AddWebSocketsConnectionResponse } from './AddWebSocketsConnectionResponse'
|
|
|
|
@injectable()
|
|
export class AddWebSocketsConnection implements UseCaseInterface {
|
|
constructor(
|
|
@inject(TYPES.WebSocketsConnectionRepository)
|
|
private webSocketsConnectionRepository: WebSocketsConnectionRepositoryInterface,
|
|
@inject(TYPES.Logger) private logger: Logger,
|
|
) {}
|
|
|
|
async execute(dto: AddWebSocketsConnectionDTO): Promise<AddWebSocketsConnectionResponse> {
|
|
this.logger.debug(`Persisting connection ${dto.connectionId} for user ${dto.userUuid}`)
|
|
|
|
await this.webSocketsConnectionRepository.saveConnection(dto.userUuid, dto.connectionId)
|
|
|
|
return {
|
|
success: true,
|
|
}
|
|
}
|
|
}
|