Skip to content

Commit db753f1

Browse files
committed
chore: refactor - rename server-handling service
1 parent c2dba47 commit db753f1

File tree

9 files changed

+23
-23
lines changed

9 files changed

+23
-23
lines changed

packages/backend/src/nest/connections-manager/connections-manager.module.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import { SocketModule } from '../socket/socket.module'
55
import { StorageModule } from '../storage/storage.module'
66
import { TorModule } from '../tor/tor.module'
77
import { ConnectionsManagerService } from './connections-manager.service'
8-
import { ServerProxyServiceModule } from '../storageServerProxy/storageServerProxy.module'
8+
import { StorageServiceClientModule } from '../storageServiceClient/storageServiceClient.module'
99

1010
@Module({
11-
imports: [RegistrationModule, StorageModule, TorModule, SocketModule, LocalDbModule, ServerProxyServiceModule],
11+
imports: [RegistrationModule, StorageModule, TorModule, SocketModule, LocalDbModule, StorageServiceClientModule],
1212
providers: [ConnectionsManagerService],
1313
exports: [ConnectionsManagerService],
1414
})

packages/backend/src/nest/connections-manager/connections-manager.service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ import { emitError } from '../socket/socket.errors'
5858
import { SocketService } from '../socket/socket.service'
5959
import { StorageService } from '../storage/storage.service'
6060
import { StorageEvents } from '../storage/storage.types'
61-
import { ServerProxyService } from '../storageServerProxy/storageServerProxy.service'
62-
import { ServerStoredCommunityMetadata } from '../storageServerProxy/storageServerProxy.types'
61+
import { StorageServiceClient } from '../storageServiceClient/storageServiceClient.service'
62+
import { ServerStoredCommunityMetadata } from '../storageServiceClient/storageServiceClient.types'
6363
import { Tor } from '../tor/tor.service'
6464
import { ConfigOptions, GetPorts, ServerIoProviderTypes } from '../types'
6565
import { ServiceState, TorInitState } from './connections-manager.types'
@@ -80,7 +80,7 @@ export class ConnectionsManagerService extends EventEmitter implements OnModuleI
8080
@Inject(SOCKS_PROXY_AGENT) public readonly socksProxyAgent: Agent,
8181
private readonly socketService: SocketService,
8282
private readonly registrationService: RegistrationService,
83-
private readonly storageServerProxyService: ServerProxyService,
83+
private readonly storageServerProxyService: StorageServiceClient,
8484
private readonly localDbService: LocalDbService,
8585
private readonly storageService: StorageService,
8686
private readonly tor: Tor,

packages/backend/src/nest/storageServerProxy/storageServerProxy.module.ts

Lines changed: 0 additions & 8 deletions
This file was deleted.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { Module } from '@nestjs/common'
2+
import { StorageServiceClient } from './storageServiceClient.service'
3+
4+
@Module({
5+
providers: [StorageServiceClient],
6+
exports: [StorageServiceClient],
7+
})
8+
export class StorageServiceClientModule {}

packages/backend/src/nest/storageServerProxy/storageServerProxy.service.spec.ts renamed to packages/backend/src/nest/storageServiceClient/storageServiceClient.service.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Test } from '@nestjs/testing'
2-
import { ServerProxyServiceModule } from './storageServerProxy.module'
3-
import { ServerProxyService } from './storageServerProxy.service'
4-
import { ServerStoredCommunityMetadata } from './storageServerProxy.types'
2+
import { StorageServiceClientModule } from './storageServiceClient.module'
3+
import { StorageServiceClient } from './storageServiceClient.service'
4+
import { ServerStoredCommunityMetadata } from './storageServiceClient.types'
55
import { jest } from '@jest/globals'
66
import { prepareResponse } from './testUtils'
77
import { createLibp2pAddress, getValidInvitationUrlTestData, validInvitationDatav1 } from '@quiet/common'
@@ -18,14 +18,14 @@ const mockFetch = async (responseData: Partial<Response>[]) => {
1818
}
1919

2020
const module = await Test.createTestingModule({
21-
imports: [ServerProxyServiceModule],
21+
imports: [StorageServiceClientModule],
2222
}).compile()
23-
const service = module.get<ServerProxyService>(ServerProxyService)
23+
const service = module.get<StorageServiceClient>(StorageServiceClient)
2424
service.fetch = mockedFetch
2525
return service
2626
}
2727

28-
describe('Server Proxy Service', () => {
28+
describe('Storage Service Client', () => {
2929
let clientMetadata: ServerStoredCommunityMetadata
3030
beforeEach(() => {
3131
const data = getValidInvitationUrlTestData(validInvitationDatav1[0]).data

packages/backend/src/nest/storageServerProxy/storageServerProxy.service.ts renamed to packages/backend/src/nest/storageServiceClient/storageServiceClient.service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Injectable } from '@nestjs/common'
22
import EventEmitter from 'events'
3-
import { ServerStoredCommunityMetadata } from './storageServerProxy.types'
3+
import { ServerStoredCommunityMetadata } from './storageServiceClient.types'
44
import fetchRetry, { RequestInitWithRetry } from 'fetch-retry'
55
import Logger from '../common/logger'
66
import { isServerStoredMetadata } from '../validation/validators'
@@ -15,9 +15,9 @@ class HTTPResponseError extends Error {
1515
}
1616

1717
@Injectable()
18-
export class ServerProxyService extends EventEmitter {
18+
export class StorageServiceClient extends EventEmitter {
1919
DEFAULT_FETCH_RETRIES = 5
20-
private readonly logger = Logger(ServerProxyService.name)
20+
private readonly logger = Logger(StorageServiceClient.name)
2121
_serverAddress: string
2222
fetch: any
2323
fetchConfig: RequestInitWithRetry<typeof fetch>

packages/backend/src/nest/validation/validators.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import _ from 'validator'
22
import joi from 'joi'
33
import { ChannelMessage, PublicChannel } from '@quiet/types'
4-
import { ServerStoredCommunityMetadata } from '../storageServerProxy/storageServerProxy.types'
4+
import { ServerStoredCommunityMetadata } from '../storageServiceClient/storageServiceClient.types'
55
import { isPSKcodeValid } from '@quiet/common'
66

77
const messageMediaSchema = joi.object({

0 commit comments

Comments
 (0)