fix: controller naming (#678)

* fix: rename home server controllers to base controllers

* fix: rename inversify express controllers to annotated controllers
This commit is contained in:
Karol Sójko 2023-08-01 09:34:52 +02:00 committed by GitHub
parent 75e266cb9e
commit 56f0aef21d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
81 changed files with 248 additions and 252 deletions

View file

@ -12,6 +12,7 @@
},
"scripts": {
"lint": "yarn workspaces foreach -p -j 10 --verbose run lint",
"lint:fix": "yarn workspaces foreach -p -j 10 --verbose run lint:fix",
"clean": "yarn workspaces foreach -p --verbose run clean",
"setup:env": "cp .env.sample .env && yarn workspaces foreach -p --verbose run setup:env",
"release": "lerna version --conventional-graduate --conventional-commits --yes -m \"chore(release): publish new version\"",

View file

@ -1,23 +1,23 @@
import 'reflect-metadata'
import '../src/Infra/InversifyExpressUtils/InversifyExpressAuthController'
import '../src/Infra/InversifyExpressUtils/InversifyExpressAuthenticatorsController'
import '../src/Infra/InversifyExpressUtils/InversifyExpressSessionsController'
import '../src/Infra/InversifyExpressUtils/InversifyExpressSubscriptionInvitesController'
import '../src/Infra/InversifyExpressUtils/InversifyExpressUserRequestsController'
import '../src/Infra/InversifyExpressUtils/InversifyExpressWebSocketsController'
import '../src/Infra/InversifyExpressUtils/InversifyExpressUsersController'
import '../src/Infra/InversifyExpressUtils/InversifyExpressValetTokenController'
import '../src/Infra/InversifyExpressUtils/InversifyExpressAdminController'
import '../src/Infra/InversifyExpressUtils/InversifyExpressSubscriptionTokensController'
import '../src/Infra/InversifyExpressUtils/InversifyExpressSubscriptionSettingsController'
import '../src/Infra/InversifyExpressUtils/InversifyExpressSettingsController'
import '../src/Infra/InversifyExpressUtils/InversifyExpressSessionController'
import '../src/Infra/InversifyExpressUtils/InversifyExpressOfflineController'
import '../src/Infra/InversifyExpressUtils/InversifyExpressListedController'
import '../src/Infra/InversifyExpressUtils/InversifyExpressInternalController'
import '../src/Infra/InversifyExpressUtils/InversifyExpressHealthCheckController'
import '../src/Infra/InversifyExpressUtils/InversifyExpressFeaturesController'
import '../src/Infra/InversifyExpressUtils/AnnotatedAuthController'
import '../src/Infra/InversifyExpressUtils/AnnotatedAuthenticatorsController'
import '../src/Infra/InversifyExpressUtils/AnnotatedSessionsController'
import '../src/Infra/InversifyExpressUtils/AnnotatedSubscriptionInvitesController'
import '../src/Infra/InversifyExpressUtils/AnnotatedUserRequestsController'
import '../src/Infra/InversifyExpressUtils/AnnotatedWebSocketsController'
import '../src/Infra/InversifyExpressUtils/AnnotatedUsersController'
import '../src/Infra/InversifyExpressUtils/AnnotatedValetTokenController'
import '../src/Infra/InversifyExpressUtils/AnnotatedAdminController'
import '../src/Infra/InversifyExpressUtils/AnnotatedSubscriptionTokensController'
import '../src/Infra/InversifyExpressUtils/AnnotatedSubscriptionSettingsController'
import '../src/Infra/InversifyExpressUtils/AnnotatedSettingsController'
import '../src/Infra/InversifyExpressUtils/AnnotatedSessionController'
import '../src/Infra/InversifyExpressUtils/AnnotatedOfflineController'
import '../src/Infra/InversifyExpressUtils/AnnotatedListedController'
import '../src/Infra/InversifyExpressUtils/AnnotatedInternalController'
import '../src/Infra/InversifyExpressUtils/AnnotatedHealthCheckController'
import '../src/Infra/InversifyExpressUtils/AnnotatedFeaturesController'
import * as cors from 'cors'
import { urlencoded, json, Request, Response, NextFunction } from 'express'

View file

@ -234,22 +234,22 @@ import { OfflineUserAuthMiddleware } from '../Infra/InversifyExpressUtils/Middle
import { LockMiddleware } from '../Infra/InversifyExpressUtils/Middleware/LockMiddleware'
import { RequiredCrossServiceTokenMiddleware } from '../Infra/InversifyExpressUtils/Middleware/RequiredCrossServiceTokenMiddleware'
import { OptionalCrossServiceTokenMiddleware } from '../Infra/InversifyExpressUtils/Middleware/OptionalCrossServiceTokenMiddleware'
import { HomeServerSettingsController } from '../Infra/InversifyExpressUtils/HomeServer/HomeServerSettingsController'
import { HomeServerAdminController } from '../Infra/InversifyExpressUtils/HomeServer/HomeServerAdminController'
import { HomeServerAuthController } from '../Infra/InversifyExpressUtils/HomeServer/HomeServerAuthController'
import { HomeServerAuthenticatorsController } from '../Infra/InversifyExpressUtils/HomeServer/HomeServerAuthenticatorsController'
import { HomeServerFeaturesController } from '../Infra/InversifyExpressUtils/HomeServer/HomeServerFeaturesController'
import { HomeServerListedController } from '../Infra/InversifyExpressUtils/HomeServer/HomeServerListedController'
import { HomeServerOfflineController } from '../Infra/InversifyExpressUtils/HomeServer/HomeServerOfflineController'
import { HomeServerSessionController } from '../Infra/InversifyExpressUtils/HomeServer/HomeServerSessionController'
import { HomeServerSubscriptionInvitesController } from '../Infra/InversifyExpressUtils/HomeServer/HomeServerSubscriptionInvitesController'
import { HomeServerSubscriptionSettingsController } from '../Infra/InversifyExpressUtils/HomeServer/HomeServerSubscriptionSettingsController'
import { HomeServerSubscriptionTokensController } from '../Infra/InversifyExpressUtils/HomeServer/HomeServerSubscriptionTokensController'
import { HomeServerUserRequestsController } from '../Infra/InversifyExpressUtils/HomeServer/HomeServerUserRequestsController'
import { HomeServerUsersController } from '../Infra/InversifyExpressUtils/HomeServer/HomeServerUsersController'
import { HomeServerValetTokenController } from '../Infra/InversifyExpressUtils/HomeServer/HomeServerValetTokenController'
import { HomeServerWebSocketsController } from '../Infra/InversifyExpressUtils/HomeServer/HomeServerWebSocketsController'
import { HomeServerSessionsController } from '../Infra/InversifyExpressUtils/HomeServer/HomeServerSessionsController'
import { BaseSettingsController } from '../Infra/InversifyExpressUtils/Base/BaseSettingsController'
import { BaseAdminController } from '../Infra/InversifyExpressUtils/Base/BaseAdminController'
import { BaseAuthController } from '../Infra/InversifyExpressUtils/Base/BaseAuthController'
import { BaseAuthenticatorsController } from '../Infra/InversifyExpressUtils/Base/BaseAuthenticatorsController'
import { BaseFeaturesController } from '../Infra/InversifyExpressUtils/Base/BaseFeaturesController'
import { BaseListedController } from '../Infra/InversifyExpressUtils/Base/BaseListedController'
import { BaseOfflineController } from '../Infra/InversifyExpressUtils/Base/BaseOfflineController'
import { BaseSessionController } from '../Infra/InversifyExpressUtils/Base/BaseSessionController'
import { BaseSubscriptionInvitesController } from '../Infra/InversifyExpressUtils/Base/BaseSubscriptionInvitesController'
import { BaseSubscriptionSettingsController } from '../Infra/InversifyExpressUtils/Base/BaseSubscriptionSettingsController'
import { BaseSubscriptionTokensController } from '../Infra/InversifyExpressUtils/Base/BaseSubscriptionTokensController'
import { BaseUserRequestsController } from '../Infra/InversifyExpressUtils/Base/BaseUserRequestsController'
import { BaseUsersController } from '../Infra/InversifyExpressUtils/Base/BaseUsersController'
import { BaseValetTokenController } from '../Infra/InversifyExpressUtils/Base/BaseValetTokenController'
import { BaseWebSocketsController } from '../Infra/InversifyExpressUtils/Base/BaseWebSocketsController'
import { BaseSessionsController } from '../Infra/InversifyExpressUtils/Base/BaseSessionsController'
import { Transform } from 'stream'
import { ActivatePremiumFeatures } from '../Domain/UseCase/ActivatePremiumFeatures/ActivatePremiumFeatures'
@ -1037,9 +1037,9 @@ export class ContainerConfigLoader {
}
container
.bind<HomeServerAuthController>(TYPES.Auth_HomeServerAuthController)
.bind<BaseAuthController>(TYPES.Auth_BaseAuthController)
.toConstantValue(
new HomeServerAuthController(
new BaseAuthController(
container.get(TYPES.Auth_VerifyMFA),
container.get(TYPES.Auth_SignIn),
container.get(TYPES.Auth_GetUserKeyParams),
@ -1054,42 +1054,42 @@ export class ContainerConfigLoader {
// Inversify Controllers
if (isConfiguredForHomeServer) {
container
.bind<HomeServerAuthenticatorsController>(TYPES.Auth_HomeServerAuthenticatorsController)
.bind<BaseAuthenticatorsController>(TYPES.Auth_BaseAuthenticatorsController)
.toConstantValue(
new HomeServerAuthenticatorsController(
new BaseAuthenticatorsController(
container.get(TYPES.Auth_AuthenticatorsController),
container.get(TYPES.Auth_ControllerContainer),
),
)
container
.bind<HomeServerSubscriptionInvitesController>(TYPES.Auth_HomeServerSubscriptionInvitesController)
.bind<BaseSubscriptionInvitesController>(TYPES.Auth_BaseSubscriptionInvitesController)
.toConstantValue(
new HomeServerSubscriptionInvitesController(
new BaseSubscriptionInvitesController(
container.get(TYPES.Auth_SubscriptionInvitesController),
container.get(TYPES.Auth_ControllerContainer),
),
)
container
.bind<HomeServerUserRequestsController>(TYPES.Auth_HomeServerUserRequestsController)
.bind<BaseUserRequestsController>(TYPES.Auth_BaseUserRequestsController)
.toConstantValue(
new HomeServerUserRequestsController(
new BaseUserRequestsController(
container.get(TYPES.Auth_UserRequestsController),
container.get(TYPES.Auth_ControllerContainer),
),
)
container
.bind<HomeServerWebSocketsController>(TYPES.Auth_HomeServerWebSocketsController)
.bind<BaseWebSocketsController>(TYPES.Auth_BaseWebSocketsController)
.toConstantValue(
new HomeServerWebSocketsController(
new BaseWebSocketsController(
container.get(TYPES.Auth_CreateCrossServiceToken),
container.get(TYPES.Auth_WebSocketConnectionTokenDecoder),
container.get(TYPES.Auth_ControllerContainer),
),
)
container
.bind<HomeServerSessionsController>(TYPES.Auth_HomeServerSessionsController)
.bind<BaseSessionsController>(TYPES.Auth_BaseSessionsController)
.toConstantValue(
new HomeServerSessionsController(
new BaseSessionsController(
container.get(TYPES.Auth_GetActiveSessionsForUser),
container.get(TYPES.Auth_AuthenticateRequest),
container.get(TYPES.Auth_SessionProjector),
@ -1098,17 +1098,17 @@ export class ContainerConfigLoader {
),
)
container
.bind<HomeServerValetTokenController>(TYPES.Auth_HomeServerValetTokenController)
.bind<BaseValetTokenController>(TYPES.Auth_BaseValetTokenController)
.toConstantValue(
new HomeServerValetTokenController(
new BaseValetTokenController(
container.get(TYPES.Auth_CreateValetToken),
container.get(TYPES.Auth_ControllerContainer),
),
)
container
.bind<HomeServerUsersController>(TYPES.Auth_HomeServerUsersController)
.bind<BaseUsersController>(TYPES.Auth_BaseUsersController)
.toConstantValue(
new HomeServerUsersController(
new BaseUsersController(
container.get(TYPES.Auth_UpdateUser),
container.get(TYPES.Auth_GetUserKeyParams),
container.get(TYPES.Auth_DeleteAccount),
@ -1120,9 +1120,9 @@ export class ContainerConfigLoader {
),
)
container
.bind<HomeServerAdminController>(TYPES.Auth_HomeServerAdminController)
.bind<BaseAdminController>(TYPES.Auth_BaseAdminController)
.toConstantValue(
new HomeServerAdminController(
new BaseAdminController(
container.get(TYPES.Auth_DeleteSetting),
container.get(TYPES.Auth_UserRepository),
container.get(TYPES.Auth_CreateSubscriptionToken),
@ -1131,9 +1131,9 @@ export class ContainerConfigLoader {
),
)
container
.bind<HomeServerSubscriptionTokensController>(TYPES.Auth_HomeServerSubscriptionTokensController)
.bind<BaseSubscriptionTokensController>(TYPES.Auth_BaseSubscriptionTokensController)
.toConstantValue(
new HomeServerSubscriptionTokensController(
new BaseSubscriptionTokensController(
container.get(TYPES.Auth_CreateSubscriptionToken),
container.get(TYPES.Auth_AuthenticateSubscriptionToken),
container.get(TYPES.Auth_SettingService),
@ -1145,17 +1145,17 @@ export class ContainerConfigLoader {
),
)
container
.bind<HomeServerSubscriptionSettingsController>(TYPES.Auth_HomeServerSubscriptionSettingsController)
.bind<BaseSubscriptionSettingsController>(TYPES.Auth_BaseSubscriptionSettingsController)
.toConstantValue(
new HomeServerSubscriptionSettingsController(
new BaseSubscriptionSettingsController(
container.get(TYPES.Auth_GetSetting),
container.get(TYPES.Auth_ControllerContainer),
),
)
container
.bind<HomeServerSettingsController>(TYPES.Auth_HomeServerSettingsController)
.bind<BaseSettingsController>(TYPES.Auth_BaseSettingsController)
.toConstantValue(
new HomeServerSettingsController(
new BaseSettingsController(
container.get(TYPES.Auth_GetSettings),
container.get(TYPES.Auth_GetSetting),
container.get(TYPES.Auth_UpdateSetting),
@ -1164,9 +1164,9 @@ export class ContainerConfigLoader {
),
)
container
.bind<HomeServerSessionController>(TYPES.Auth_HomeServerSessionController)
.bind<BaseSessionController>(TYPES.Auth_BaseSessionController)
.toConstantValue(
new HomeServerSessionController(
new BaseSessionController(
container.get(TYPES.Auth_DeleteSessionForUser),
container.get(TYPES.Auth_DeletePreviousSessionsForUser),
container.get(TYPES.Auth_RefreshSessionToken),
@ -1174,9 +1174,9 @@ export class ContainerConfigLoader {
),
)
container
.bind<HomeServerOfflineController>(TYPES.Auth_HomeServerOfflineController)
.bind<BaseOfflineController>(TYPES.Auth_BaseOfflineController)
.toConstantValue(
new HomeServerOfflineController(
new BaseOfflineController(
container.get(TYPES.Auth_GetUserFeatures),
container.get(TYPES.Auth_GetUserOfflineSubscription),
container.get(TYPES.Auth_CreateOfflineSubscriptionToken),
@ -1188,17 +1188,17 @@ export class ContainerConfigLoader {
),
)
container
.bind<HomeServerListedController>(TYPES.Auth_HomeServerListedController)
.bind<BaseListedController>(TYPES.Auth_BaseListedController)
.toConstantValue(
new HomeServerListedController(
new BaseListedController(
container.get(TYPES.Auth_CreateListedAccount),
container.get(TYPES.Auth_ControllerContainer),
),
)
container
.bind<HomeServerFeaturesController>(TYPES.Auth_HomeServerFeaturesController)
.bind<BaseFeaturesController>(TYPES.Auth_BaseFeaturesController)
.toConstantValue(
new HomeServerFeaturesController(
new BaseFeaturesController(
container.get(TYPES.Auth_GetUserFeatures),
container.get(TYPES.Auth_ControllerContainer),
),

View file

@ -217,22 +217,22 @@ const TYPES = {
Auth_ProtocolVersionSelector: Symbol.for('Auth_ProtocolVersionSelector'),
Auth_BooleanSelector: Symbol.for('Auth_BooleanSelector'),
Auth_UserSubscriptionService: Symbol.for('Auth_UserSubscriptionService'),
Auth_HomeServerAuthController: Symbol.for('Auth_HomeServerAuthController'),
Auth_HomeServerAuthenticatorsController: Symbol.for('Auth_HomeServerAuthenticatorsController'),
Auth_HomeServerSubscriptionInvitesController: Symbol.for('Auth_HomeServerSubscriptionInvitesController'),
Auth_HomeServerUserRequestsController: Symbol.for('Auth_HomeServerUserRequestsController'),
Auth_HomeServerWebSocketsController: Symbol.for('Auth_HomeServerWebSocketsController'),
Auth_HomeServerSessionsController: Symbol.for('Auth_HomeServerSessionsController'),
Auth_HomeServerValetTokenController: Symbol.for('Auth_HomeServerValetTokenController'),
Auth_HomeServerUsersController: Symbol.for('Auth_HomeServerUsersController'),
Auth_HomeServerAdminController: Symbol.for('Auth_HomeServerAdminController'),
Auth_HomeServerSubscriptionTokensController: Symbol.for('Auth_HomeServerSubscriptionTokensController'),
Auth_HomeServerSubscriptionSettingsController: Symbol.for('Auth_HomeServerSubscriptionSettingsController'),
Auth_HomeServerSettingsController: Symbol.for('Auth_HomeServerSettingsController'),
Auth_HomeServerSessionController: Symbol.for('Auth_HomeServerSessionController'),
Auth_HomeServerOfflineController: Symbol.for('Auth_HomeServerOfflineController'),
Auth_HomeServerListedController: Symbol.for('Auth_HomeServerListedController'),
Auth_HomeServerFeaturesController: Symbol.for('Auth_HomeServerFeaturesController'),
Auth_BaseAuthController: Symbol.for('Auth_BaseAuthController'),
Auth_BaseAuthenticatorsController: Symbol.for('Auth_BaseAuthenticatorsController'),
Auth_BaseSubscriptionInvitesController: Symbol.for('Auth_BaseSubscriptionInvitesController'),
Auth_BaseUserRequestsController: Symbol.for('Auth_BaseUserRequestsController'),
Auth_BaseWebSocketsController: Symbol.for('Auth_BaseWebSocketsController'),
Auth_BaseSessionsController: Symbol.for('Auth_BaseSessionsController'),
Auth_BaseValetTokenController: Symbol.for('Auth_BaseValetTokenController'),
Auth_BaseUsersController: Symbol.for('Auth_BaseUsersController'),
Auth_BaseAdminController: Symbol.for('Auth_BaseAdminController'),
Auth_BaseSubscriptionTokensController: Symbol.for('Auth_BaseSubscriptionTokensController'),
Auth_BaseSubscriptionSettingsController: Symbol.for('Auth_BaseSubscriptionSettingsController'),
Auth_BaseSettingsController: Symbol.for('Auth_BaseSettingsController'),
Auth_BaseSessionController: Symbol.for('Auth_BaseSessionController'),
Auth_BaseOfflineController: Symbol.for('Auth_BaseOfflineController'),
Auth_BaseListedController: Symbol.for('Auth_BaseListedController'),
Auth_BaseFeaturesController: Symbol.for('Auth_BaseFeaturesController'),
}
export default TYPES

View file

@ -1,6 +1,6 @@
import 'reflect-metadata'
import { InversifyExpressAdminController } from './InversifyExpressAdminController'
import { AnnotatedAdminController } from './AnnotatedAdminController'
import { results } from 'inversify-express-utils'
import { User } from '../../Domain/User/User'
import { UserRepositoryInterface } from '../../Domain/User/UserRepositoryInterface'
@ -9,7 +9,7 @@ import { DeleteSetting } from '../../Domain/UseCase/DeleteSetting/DeleteSetting'
import { CreateSubscriptionToken } from '../../Domain/UseCase/CreateSubscriptionToken/CreateSubscriptionToken'
import { CreateOfflineSubscriptionToken } from '../../Domain/UseCase/CreateOfflineSubscriptionToken/CreateOfflineSubscriptionToken'
describe('InversifyExpressAdminController', () => {
describe('AnnotatedAdminController', () => {
let deleteSetting: DeleteSetting
let userRepository: UserRepositoryInterface
let createSubscriptionToken: CreateSubscriptionToken
@ -18,12 +18,7 @@ describe('InversifyExpressAdminController', () => {
let user: User
const createController = () =>
new InversifyExpressAdminController(
deleteSetting,
userRepository,
createSubscriptionToken,
createOfflineSubscriptionToken,
)
new AnnotatedAdminController(deleteSetting, userRepository, createSubscriptionToken, createOfflineSubscriptionToken)
beforeEach(() => {
user = {} as jest.Mocked<User>

View file

@ -9,14 +9,14 @@ import {
results,
} from 'inversify-express-utils'
import TYPES from '../../Bootstrap/Types'
import { HomeServerAdminController } from './HomeServer/HomeServerAdminController'
import { BaseAdminController } from './Base/BaseAdminController'
import { CreateOfflineSubscriptionToken } from '../../Domain/UseCase/CreateOfflineSubscriptionToken/CreateOfflineSubscriptionToken'
import { CreateSubscriptionToken } from '../../Domain/UseCase/CreateSubscriptionToken/CreateSubscriptionToken'
import { DeleteSetting } from '../../Domain/UseCase/DeleteSetting/DeleteSetting'
import { UserRepositoryInterface } from '../../Domain/User/UserRepositoryInterface'
@controller('/admin')
export class InversifyExpressAdminController extends HomeServerAdminController {
export class AnnotatedAdminController extends BaseAdminController {
constructor(
@inject(TYPES.Auth_DeleteSetting) override doDeleteSetting: DeleteSetting,
@inject(TYPES.Auth_UserRepository) override userRepository: UserRepositoryInterface,

View file

@ -16,10 +16,10 @@ import { Logger } from 'winston'
import { GetUserKeyParams } from '../../Domain/UseCase/GetUserKeyParams/GetUserKeyParams'
import { AuthController } from '../../Controller/AuthController'
import { inject } from 'inversify'
import { HomeServerAuthController } from './HomeServer/HomeServerAuthController'
import { BaseAuthController } from './Base/BaseAuthController'
@controller('/auth')
export class InversifyExpressAuthController extends HomeServerAuthController {
export class AnnotatedAuthController extends BaseAuthController {
constructor(
@inject(TYPES.Auth_VerifyMFA) override verifyMFA: VerifyMFA,
@inject(TYPES.Auth_SignIn) override signInUseCase: SignIn,

View file

@ -10,10 +10,10 @@ import {
import TYPES from '../../Bootstrap/Types'
import { AuthenticatorsController } from '../../Controller/AuthenticatorsController'
import { inject } from 'inversify'
import { HomeServerAuthenticatorsController } from './HomeServer/HomeServerAuthenticatorsController'
import { BaseAuthenticatorsController } from './Base/BaseAuthenticatorsController'
@controller('/authenticators')
export class InversifyExpressAuthenticatorsController extends HomeServerAuthenticatorsController {
export class AnnotatedAuthenticatorsController extends BaseAuthenticatorsController {
constructor(
@inject(TYPES.Auth_AuthenticatorsController) override authenticatorsController: AuthenticatorsController,
) {

View file

@ -2,19 +2,19 @@ import 'reflect-metadata'
import * as express from 'express'
import { InversifyExpressFeaturesController } from './InversifyExpressFeaturesController'
import { AnnotatedFeaturesController } from './AnnotatedFeaturesController'
import { results } from 'inversify-express-utils'
import { User } from '../../Domain/User/User'
import { GetUserFeatures } from '../../Domain/UseCase/GetUserFeatures/GetUserFeatures'
describe('InversifyExpressFeaturesController', () => {
describe('AnnotatedFeaturesController', () => {
let getUserFeatures: GetUserFeatures
let request: express.Request
let response: express.Response
let user: User
const createController = () => new InversifyExpressFeaturesController(getUserFeatures)
const createController = () => new AnnotatedFeaturesController(getUserFeatures)
beforeEach(() => {
user = {} as jest.Mocked<User>

View file

@ -8,10 +8,10 @@ import {
} from 'inversify-express-utils'
import TYPES from '../../Bootstrap/Types'
import { GetUserFeatures } from '../../Domain/UseCase/GetUserFeatures/GetUserFeatures'
import { HomeServerFeaturesController } from './HomeServer/HomeServerFeaturesController'
import { BaseFeaturesController } from './Base/BaseFeaturesController'
@controller('/users/:userUuid/features')
export class InversifyExpressFeaturesController extends HomeServerFeaturesController {
export class AnnotatedFeaturesController extends BaseFeaturesController {
constructor(@inject(TYPES.Auth_GetUserFeatures) override doGetUserFeatures: GetUserFeatures) {
super(doGetUserFeatures)
}

View file

@ -1,7 +1,7 @@
import { controller, httpGet } from 'inversify-express-utils'
@controller('/healthcheck')
export class InversifyExpressHealthCheckController {
export class AnnotatedHealthCheckController {
@httpGet('/')
public async get(): Promise<string> {
return 'OK'

View file

@ -2,13 +2,13 @@ import 'reflect-metadata'
import * as express from 'express'
import { InversifyExpressInternalController } from './InversifyExpressInternalController'
import { AnnotatedInternalController } from './AnnotatedInternalController'
import { results } from 'inversify-express-utils'
import { User } from '../../Domain/User/User'
import { GetUserFeatures } from '../../Domain/UseCase/GetUserFeatures/GetUserFeatures'
import { GetSetting } from '../../Domain/UseCase/GetSetting/GetSetting'
describe('InversifyExpressInternalController', () => {
describe('AnnotatedInternalController', () => {
let getUserFeatures: GetUserFeatures
let getSetting: GetSetting
@ -16,7 +16,7 @@ describe('InversifyExpressInternalController', () => {
let response: express.Response
let user: User
const createController = () => new InversifyExpressInternalController(getUserFeatures, getSetting)
const createController = () => new AnnotatedInternalController(getUserFeatures, getSetting)
beforeEach(() => {
user = {} as jest.Mocked<User>

View file

@ -12,7 +12,7 @@ import { GetSetting } from '../../Domain/UseCase/GetSetting/GetSetting'
import { GetUserFeatures } from '../../Domain/UseCase/GetUserFeatures/GetUserFeatures'
@controller('/internal')
export class InversifyExpressInternalController extends BaseHttpController {
export class AnnotatedInternalController extends BaseHttpController {
constructor(
@inject(TYPES.Auth_GetUserFeatures) private doGetUserFeatures: GetUserFeatures,
@inject(TYPES.Auth_GetSetting) private doGetSetting: GetSetting,

View file

@ -3,18 +3,18 @@ import 'reflect-metadata'
import * as express from 'express'
import { results } from 'inversify-express-utils'
import { InversifyExpressListedController } from './InversifyExpressListedController'
import { AnnotatedListedController } from './AnnotatedListedController'
import { User } from '../../Domain/User/User'
import { CreateListedAccount } from '../../Domain/UseCase/CreateListedAccount/CreateListedAccount'
describe('InversifyExpressListedController', () => {
describe('AnnotatedListedController', () => {
let createListedAccount: CreateListedAccount
let request: express.Request
let response: express.Response
let user: User
const createController = () => new InversifyExpressListedController(createListedAccount)
const createController = () => new AnnotatedListedController(createListedAccount)
beforeEach(() => {
user = {} as jest.Mocked<User>

View file

@ -4,10 +4,10 @@ import { controller, httpPost, results } from 'inversify-express-utils'
import { Request, Response } from 'express'
import TYPES from '../../Bootstrap/Types'
import { CreateListedAccount } from '../../Domain/UseCase/CreateListedAccount/CreateListedAccount'
import { HomeServerListedController } from './HomeServer/HomeServerListedController'
import { BaseListedController } from './Base/BaseListedController'
@controller('/listed')
export class InversifyExpressListedController extends HomeServerListedController {
export class AnnotatedListedController extends BaseListedController {
constructor(@inject(TYPES.Auth_CreateListedAccount) override doCreateListedAccount: CreateListedAccount) {
super(doCreateListedAccount)
}

View file

@ -2,7 +2,7 @@ import 'reflect-metadata'
import * as express from 'express'
import { InversifyExpressOfflineController } from './InversifyExpressOfflineController'
import { AnnotatedOfflineController } from './AnnotatedOfflineController'
import { results } from 'inversify-express-utils'
import { User } from '../../Domain/User/User'
import { GetUserFeatures } from '../../Domain/UseCase/GetUserFeatures/GetUserFeatures'
@ -15,7 +15,7 @@ import { OfflineUserTokenData, TokenEncoderInterface } from '@standardnotes/secu
import { SubscriptionName } from '@standardnotes/common'
import { Logger } from 'winston'
describe('InversifyExpressOfflineController', () => {
describe('AnnotatedOfflineController', () => {
let getUserFeatures: GetUserFeatures
let getUserOfflineSubscription: GetUserOfflineSubscription
let createOfflineSubscriptionToken: CreateOfflineSubscriptionToken
@ -29,7 +29,7 @@ describe('InversifyExpressOfflineController', () => {
let user: User
const createController = () =>
new InversifyExpressOfflineController(
new AnnotatedOfflineController(
getUserFeatures,
getUserOfflineSubscription,
createOfflineSubscriptionToken,

View file

@ -14,10 +14,10 @@ import { AuthenticateOfflineSubscriptionToken } from '../../Domain/UseCase/Authe
import { CreateOfflineSubscriptionToken } from '../../Domain/UseCase/CreateOfflineSubscriptionToken/CreateOfflineSubscriptionToken'
import { GetUserFeatures } from '../../Domain/UseCase/GetUserFeatures/GetUserFeatures'
import { GetUserOfflineSubscription } from '../../Domain/UseCase/GetUserOfflineSubscription/GetUserOfflineSubscription'
import { HomeServerOfflineController } from './HomeServer/HomeServerOfflineController'
import { BaseOfflineController } from './Base/BaseOfflineController'
@controller('/offline')
export class InversifyExpressOfflineController extends HomeServerOfflineController {
export class AnnotatedOfflineController extends BaseOfflineController {
constructor(
@inject(TYPES.Auth_GetUserFeatures) override doGetUserFeatures: GetUserFeatures,
@inject(TYPES.Auth_GetUserOfflineSubscription) override getUserOfflineSubscription: GetUserOfflineSubscription,

View file

@ -2,13 +2,13 @@ import 'reflect-metadata'
import * as express from 'express'
import { InversifyExpressSessionController } from './InversifyExpressSessionController'
import { AnnotatedSessionController } from './AnnotatedSessionController'
import { results } from 'inversify-express-utils'
import { DeletePreviousSessionsForUser } from '../../Domain/UseCase/DeletePreviousSessionsForUser'
import { DeleteSessionForUser } from '../../Domain/UseCase/DeleteSessionForUser'
import { RefreshSessionToken } from '../../Domain/UseCase/RefreshSessionToken'
describe('InversifyExpressSessionController', () => {
describe('AnnotatedSessionController', () => {
let deleteSessionForUser: DeleteSessionForUser
let deletePreviousSessionsForUser: DeletePreviousSessionsForUser
let refreshSessionToken: RefreshSessionToken
@ -16,7 +16,7 @@ describe('InversifyExpressSessionController', () => {
let response: express.Response
const createController = () =>
new InversifyExpressSessionController(deleteSessionForUser, deletePreviousSessionsForUser, refreshSessionToken)
new AnnotatedSessionController(deleteSessionForUser, deletePreviousSessionsForUser, refreshSessionToken)
beforeEach(() => {
deleteSessionForUser = {} as jest.Mocked<DeleteSessionForUser>

View file

@ -11,10 +11,10 @@ import TYPES from '../../Bootstrap/Types'
import { DeletePreviousSessionsForUser } from '../../Domain/UseCase/DeletePreviousSessionsForUser'
import { DeleteSessionForUser } from '../../Domain/UseCase/DeleteSessionForUser'
import { RefreshSessionToken } from '../../Domain/UseCase/RefreshSessionToken'
import { HomeServerSessionController } from './HomeServer/HomeServerSessionController'
import { BaseSessionController } from './Base/BaseSessionController'
@controller('/session')
export class InversifyExpressSessionController extends HomeServerSessionController {
export class AnnotatedSessionController extends BaseSessionController {
constructor(
@inject(TYPES.Auth_DeleteSessionForUser) override deleteSessionForUser: DeleteSessionForUser,
@inject(TYPES.Auth_DeletePreviousSessionsForUser)

View file

@ -2,7 +2,7 @@ import 'reflect-metadata'
import * as express from 'express'
import { InversifyExpressSessionsController } from './InversifyExpressSessionsController'
import { AnnotatedSessionsController } from './AnnotatedSessionsController'
import { results } from 'inversify-express-utils'
import { User } from '@standardnotes/responses'
@ -12,7 +12,7 @@ import { GetActiveSessionsForUser } from '../../Domain/UseCase/GetActiveSessions
import { ProjectorInterface } from '../../Projection/ProjectorInterface'
import { Session } from '../../Domain/Session/Session'
describe('InversifyExpressSessionsController', () => {
describe('AnnotatedSessionsController', () => {
let getActiveSessionsForUser: GetActiveSessionsForUser
let authenticateRequest: AuthenticateRequest
let sessionProjector: ProjectorInterface<Session>
@ -23,7 +23,7 @@ describe('InversifyExpressSessionsController', () => {
let createCrossServiceToken: CreateCrossServiceToken
const createController = () =>
new InversifyExpressSessionsController(
new AnnotatedSessionsController(
getActiveSessionsForUser,
authenticateRequest,
sessionProjector,

View file

@ -14,10 +14,10 @@ import { CreateCrossServiceToken } from '../../Domain/UseCase/CreateCrossService
import { GetActiveSessionsForUser } from '../../Domain/UseCase/GetActiveSessionsForUser'
import { ProjectorInterface } from '../../Projection/ProjectorInterface'
import { Session } from '../../Domain/Session/Session'
import { HomeServerSessionsController } from './HomeServer/HomeServerSessionsController'
import { BaseSessionsController } from './Base/BaseSessionsController'
@controller('/sessions')
export class InversifyExpressSessionsController extends HomeServerSessionsController {
export class AnnotatedSessionsController extends BaseSessionsController {
constructor(
@inject(TYPES.Auth_GetActiveSessionsForUser) override getActiveSessionsForUser: GetActiveSessionsForUser,
@inject(TYPES.Auth_AuthenticateRequest) override authenticateRequest: AuthenticateRequest,

View file

@ -2,7 +2,7 @@ import 'reflect-metadata'
import * as express from 'express'
import { InversifyExpressSettingsController } from './InversifyExpressSettingsController'
import { AnnotatedSettingsController } from './AnnotatedSettingsController'
import { results } from 'inversify-express-utils'
import { EncryptionVersion } from '../../Domain/Encryption/EncryptionVersion'
import { DeleteSetting } from '../../Domain/UseCase/DeleteSetting/DeleteSetting'
@ -11,7 +11,7 @@ import { GetSettings } from '../../Domain/UseCase/GetSettings/GetSettings'
import { UpdateSetting } from '../../Domain/UseCase/UpdateSetting/UpdateSetting'
import { User } from '../../Domain/User/User'
describe('InversifyExpressSettingsController', () => {
describe('AnnotatedSettingsController', () => {
let deleteSetting: DeleteSetting
let getSettings: GetSettings
let getSetting: GetSetting
@ -21,8 +21,7 @@ describe('InversifyExpressSettingsController', () => {
let response: express.Response
let user: User
const createController = () =>
new InversifyExpressSettingsController(getSettings, getSetting, updateSetting, deleteSetting)
const createController = () => new AnnotatedSettingsController(getSettings, getSetting, updateSetting, deleteSetting)
beforeEach(() => {
deleteSetting = {} as jest.Mocked<DeleteSetting>

View file

@ -13,10 +13,10 @@ import { DeleteSetting } from '../../Domain/UseCase/DeleteSetting/DeleteSetting'
import { GetSetting } from '../../Domain/UseCase/GetSetting/GetSetting'
import { GetSettings } from '../../Domain/UseCase/GetSettings/GetSettings'
import { UpdateSetting } from '../../Domain/UseCase/UpdateSetting/UpdateSetting'
import { HomeServerSettingsController } from './HomeServer/HomeServerSettingsController'
import { BaseSettingsController } from './Base/BaseSettingsController'
@controller('/users/:userUuid')
export class InversifyExpressSettingsController extends HomeServerSettingsController {
export class AnnotatedSettingsController extends BaseSettingsController {
constructor(
@inject(TYPES.Auth_GetSettings) override doGetSettings: GetSettings,
@inject(TYPES.Auth_GetSetting) override doGetSetting: GetSetting,

View file

@ -11,10 +11,10 @@ import { inject } from 'inversify'
import TYPES from '../../Bootstrap/Types'
import { SubscriptionInvitesController } from '../../Controller/SubscriptionInvitesController'
import { HomeServerSubscriptionInvitesController } from './HomeServer/HomeServerSubscriptionInvitesController'
import { BaseSubscriptionInvitesController } from './Base/BaseSubscriptionInvitesController'
@controller('/subscription-invites')
export class InversifyExpressSubscriptionInvitesController extends HomeServerSubscriptionInvitesController {
export class AnnotatedSubscriptionInvitesController extends BaseSubscriptionInvitesController {
constructor(
@inject(TYPES.Auth_SubscriptionInvitesController)
override subscriptionInvitesController: SubscriptionInvitesController,

View file

@ -3,18 +3,18 @@ import 'reflect-metadata'
import * as express from 'express'
import { results } from 'inversify-express-utils'
import { InversifyExpressSubscriptionSettingsController } from './InversifyExpressSubscriptionSettingsController'
import { AnnotatedSubscriptionSettingsController } from './AnnotatedSubscriptionSettingsController'
import { User } from '../../Domain/User/User'
import { GetSetting } from '../../Domain/UseCase/GetSetting/GetSetting'
describe('InversifyExpressSubscriptionSettingsController', () => {
describe('AnnotatedSubscriptionSettingsController', () => {
let getSetting: GetSetting
let request: express.Request
let response: express.Response
let user: User
const createController = () => new InversifyExpressSubscriptionSettingsController(getSetting)
const createController = () => new AnnotatedSubscriptionSettingsController(getSetting)
beforeEach(() => {
user = {} as jest.Mocked<User>

View file

@ -8,10 +8,10 @@ import {
} from 'inversify-express-utils'
import TYPES from '../../Bootstrap/Types'
import { GetSetting } from '../../Domain/UseCase/GetSetting/GetSetting'
import { HomeServerSubscriptionSettingsController } from './HomeServer/HomeServerSubscriptionSettingsController'
import { BaseSubscriptionSettingsController } from './Base/BaseSubscriptionSettingsController'
@controller('/users/:userUuid')
export class InversifyExpressSubscriptionSettingsController extends HomeServerSubscriptionSettingsController {
export class AnnotatedSubscriptionSettingsController extends BaseSubscriptionSettingsController {
constructor(@inject(TYPES.Auth_GetSetting) override doGetSetting: GetSetting) {
super(doGetSetting)
}

View file

@ -3,7 +3,7 @@ import 'reflect-metadata'
import * as express from 'express'
import { results } from 'inversify-express-utils'
import { InversifyExpressSubscriptionTokensController } from './InversifyExpressSubscriptionTokensController'
import { AnnotatedSubscriptionTokensController } from './AnnotatedSubscriptionTokensController'
import { CrossServiceTokenData, TokenEncoderInterface } from '@standardnotes/security'
import { Setting } from '../../Domain/Setting/Setting'
@ -15,7 +15,7 @@ import { ProjectorInterface } from '../../Projection/ProjectorInterface'
import { User } from '../../Domain/User/User'
import { Role } from '../../Domain/Role/Role'
describe('InversifyExpressSubscriptionTokensController', () => {
describe('AnnotatedSubscriptionTokensController', () => {
let createSubscriptionToken: CreateSubscriptionToken
let authenticateToken: AuthenticateSubscriptionToken
const jwtTTL = 60
@ -31,7 +31,7 @@ describe('InversifyExpressSubscriptionTokensController', () => {
let role: Role
const createController = () =>
new InversifyExpressSubscriptionTokensController(
new AnnotatedSubscriptionTokensController(
createSubscriptionToken,
authenticateToken,
settingService,

View file

@ -15,10 +15,10 @@ import { AuthenticateSubscriptionToken } from '../../Domain/UseCase/Authenticate
import { CreateSubscriptionToken } from '../../Domain/UseCase/CreateSubscriptionToken/CreateSubscriptionToken'
import { User } from '../../Domain/User/User'
import { ProjectorInterface } from '../../Projection/ProjectorInterface'
import { HomeServerSubscriptionTokensController } from './HomeServer/HomeServerSubscriptionTokensController'
import { BaseSubscriptionTokensController } from './Base/BaseSubscriptionTokensController'
@controller('/subscription-tokens')
export class InversifyExpressSubscriptionTokensController extends HomeServerSubscriptionTokensController {
export class AnnotatedSubscriptionTokensController extends BaseSubscriptionTokensController {
constructor(
@inject(TYPES.Auth_CreateSubscriptionToken) override createSubscriptionToken: CreateSubscriptionToken,
@inject(TYPES.Auth_AuthenticateSubscriptionToken) override authenticateToken: AuthenticateSubscriptionToken,

View file

@ -4,10 +4,10 @@ import { results, httpPost, controller } from 'inversify-express-utils'
import TYPES from '../../Bootstrap/Types'
import { UserRequestsController } from '../../Controller/UserRequestsController'
import { inject } from 'inversify'
import { HomeServerUserRequestsController } from './HomeServer/HomeServerUserRequestsController'
import { BaseUserRequestsController } from './Base/BaseUserRequestsController'
@controller('/users/:userUuid/requests')
export class InversifyExpressUserRequestsController extends HomeServerUserRequestsController {
export class AnnotatedUserRequestsController extends BaseUserRequestsController {
constructor(@inject(TYPES.Auth_UserRequestsController) override userRequestsController: UserRequestsController) {
super(userRequestsController)
}

View file

@ -2,7 +2,7 @@ import 'reflect-metadata'
import * as express from 'express'
import { InversifyExpressUsersController } from './InversifyExpressUsersController'
import { AnnotatedUsersController } from './AnnotatedUsersController'
import { results } from 'inversify-express-utils'
import { Username } from '@standardnotes/domain-core'
import { DeleteAccount } from '../../Domain/UseCase/DeleteAccount/DeleteAccount'
@ -15,7 +15,7 @@ import { InviteToSharedSubscription } from '../../Domain/UseCase/InviteToSharedS
import { UpdateUser } from '../../Domain/UseCase/UpdateUser'
import { User } from '../../Domain/User/User'
describe('InversifyExpressUsersController', () => {
describe('AnnotatedUsersController', () => {
let updateUser: UpdateUser
let deleteAccount: DeleteAccount
let getUserKeyParams: GetUserKeyParams
@ -30,7 +30,7 @@ describe('InversifyExpressUsersController', () => {
let user: User
const createController = () =>
new InversifyExpressUsersController(
new AnnotatedUsersController(
updateUser,
getUserKeyParams,
deleteAccount,

View file

@ -17,10 +17,10 @@ import { GetUserSubscription } from '../../Domain/UseCase/GetUserSubscription/Ge
import { ClearLoginAttempts } from '../../Domain/UseCase/ClearLoginAttempts'
import { IncreaseLoginAttempts } from '../../Domain/UseCase/IncreaseLoginAttempts'
import { ChangeCredentials } from '../../Domain/UseCase/ChangeCredentials/ChangeCredentials'
import { HomeServerUsersController } from './HomeServer/HomeServerUsersController'
import { BaseUsersController } from './Base/BaseUsersController'
@controller('/users')
export class InversifyExpressUsersController extends HomeServerUsersController {
export class AnnotatedUsersController extends BaseUsersController {
constructor(
@inject(TYPES.Auth_UpdateUser) override updateUser: UpdateUser,
@inject(TYPES.Auth_GetUserKeyParams) override getUserKeyParams: GetUserKeyParams,

View file

@ -2,15 +2,15 @@ import 'reflect-metadata'
import { Request, Response } from 'express'
import { results } from 'inversify-express-utils'
import { InversifyExpressValetTokenController } from './InversifyExpressValetTokenController'
import { AnnotatedValetTokenController } from './AnnotatedValetTokenController'
import { CreateValetToken } from '../../Domain/UseCase/CreateValetToken/CreateValetToken'
describe('InversifyExpressValetTokenController', () => {
describe('AnnotatedValetTokenController', () => {
let createValetToken: CreateValetToken
let request: Request
let response: Response
const createController = () => new InversifyExpressValetTokenController(createValetToken)
const createController = () => new AnnotatedValetTokenController(createValetToken)
beforeEach(() => {
createValetToken = {} as jest.Mocked<CreateValetToken>

View file

@ -8,10 +8,10 @@ import {
} from 'inversify-express-utils'
import TYPES from '../../Bootstrap/Types'
import { CreateValetToken } from '../../Domain/UseCase/CreateValetToken/CreateValetToken'
import { HomeServerValetTokenController } from './HomeServer/HomeServerValetTokenController'
import { BaseValetTokenController } from './Base/BaseValetTokenController'
@controller('/valet-tokens', TYPES.Auth_RequiredCrossServiceTokenMiddleware)
export class InversifyExpressValetTokenController extends HomeServerValetTokenController {
export class AnnotatedValetTokenController extends BaseValetTokenController {
constructor(@inject(TYPES.Auth_CreateValetToken) override createValetKey: CreateValetToken) {
super(createValetKey)
}

View file

@ -9,10 +9,10 @@ import {
import { CreateCrossServiceToken } from '../../Domain/UseCase/CreateCrossServiceToken/CreateCrossServiceToken'
import { inject } from 'inversify'
import TYPES from '../../Bootstrap/Types'
import { HomeServerWebSocketsController } from './HomeServer/HomeServerWebSocketsController'
import { BaseWebSocketsController } from './Base/BaseWebSocketsController'
@controller('/sockets')
export class InversifyExpressWebSocketsController extends HomeServerWebSocketsController {
export class AnnotatedWebSocketsController extends BaseWebSocketsController {
constructor(
@inject(TYPES.Auth_CreateCrossServiceToken) override createCrossServiceToken: CreateCrossServiceToken,
@inject(TYPES.Auth_WebSocketConnectionTokenDecoder)

View file

@ -8,7 +8,7 @@ import { CreateSubscriptionToken } from '../../../Domain/UseCase/CreateSubscript
import { DeleteSetting } from '../../../Domain/UseCase/DeleteSetting/DeleteSetting'
import { UserRepositoryInterface } from '../../../Domain/User/UserRepositoryInterface'
export class HomeServerAdminController extends BaseHttpController {
export class BaseAdminController extends BaseHttpController {
constructor(
protected doDeleteSetting: DeleteSetting,
protected userRepository: UserRepositoryInterface,

View file

@ -10,7 +10,7 @@ import { VerifyMFA } from '../../../Domain/UseCase/VerifyMFA'
import { AuthController } from '../../../Controller/AuthController'
import { BaseHttpController, results } from 'inversify-express-utils'
export class HomeServerAuthController extends BaseHttpController {
export class BaseAuthController extends BaseHttpController {
constructor(
protected verifyMFA: VerifyMFA,
protected signInUseCase: SignIn,

View file

@ -4,7 +4,7 @@ import { Request, Response } from 'express'
import { AuthenticatorsController } from '../../../Controller/AuthenticatorsController'
import { BaseHttpController, results } from 'inversify-express-utils'
export class HomeServerAuthenticatorsController extends BaseHttpController {
export class BaseAuthenticatorsController extends BaseHttpController {
constructor(
protected authenticatorsController: AuthenticatorsController,
private controllerContainer?: ControllerContainerInterface,

View file

@ -4,7 +4,7 @@ import { Request, Response } from 'express'
import { GetUserFeatures } from '../../../Domain/UseCase/GetUserFeatures/GetUserFeatures'
import { BaseHttpController, results } from 'inversify-express-utils'
export class HomeServerFeaturesController extends BaseHttpController {
export class BaseFeaturesController extends BaseHttpController {
constructor(
protected doGetUserFeatures: GetUserFeatures,
private controllerContainer?: ControllerContainerInterface,

View file

@ -5,7 +5,7 @@ import { Request, Response } from 'express'
import { CreateListedAccount } from '../../../Domain/UseCase/CreateListedAccount/CreateListedAccount'
import { BaseHttpController, results } from 'inversify-express-utils'
export class HomeServerListedController extends BaseHttpController {
export class BaseListedController extends BaseHttpController {
constructor(
protected doCreateListedAccount: CreateListedAccount,
private controllerContainer?: ControllerContainerInterface,

View file

@ -9,7 +9,7 @@ import { CreateOfflineSubscriptionToken } from '../../../Domain/UseCase/CreateOf
import { GetUserFeatures } from '../../../Domain/UseCase/GetUserFeatures/GetUserFeatures'
import { GetUserOfflineSubscription } from '../../../Domain/UseCase/GetUserOfflineSubscription/GetUserOfflineSubscription'
export class HomeServerOfflineController extends BaseHttpController {
export class BaseOfflineController extends BaseHttpController {
constructor(
protected doGetUserFeatures: GetUserFeatures,
protected getUserOfflineSubscription: GetUserOfflineSubscription,

View file

@ -7,7 +7,7 @@ import { DeletePreviousSessionsForUser } from '../../../Domain/UseCase/DeletePre
import { DeleteSessionForUser } from '../../../Domain/UseCase/DeleteSessionForUser'
import { RefreshSessionToken } from '../../../Domain/UseCase/RefreshSessionToken'
export class HomeServerSessionController extends BaseHttpController {
export class BaseSessionController extends BaseHttpController {
constructor(
protected deleteSessionForUser: DeleteSessionForUser,
protected deletePreviousSessionsForUser: DeletePreviousSessionsForUser,

View file

@ -10,7 +10,7 @@ import { BaseHttpController, results } from 'inversify-express-utils'
import { User } from '../../../Domain/User/User'
import { SessionProjector } from '../../../Projection/SessionProjector'
export class HomeServerSessionsController extends BaseHttpController {
export class BaseSessionsController extends BaseHttpController {
constructor(
protected getActiveSessionsForUser: GetActiveSessionsForUser,
protected authenticateRequest: AuthenticateRequest,

View file

@ -9,7 +9,7 @@ import { UpdateSetting } from '../../../Domain/UseCase/UpdateSetting/UpdateSetti
import { BaseHttpController, results } from 'inversify-express-utils'
import { EncryptionVersion } from '../../../Domain/Encryption/EncryptionVersion'
export class HomeServerSettingsController extends BaseHttpController {
export class BaseSettingsController extends BaseHttpController {
constructor(
protected doGetSettings: GetSettings,
protected doGetSetting: GetSetting,

View file

@ -6,7 +6,7 @@ import { ApiVersion } from '@standardnotes/api'
import { SubscriptionInvitesController } from '../../../Controller/SubscriptionInvitesController'
import { Role } from '../../../Domain/Role/Role'
export class HomeServerSubscriptionInvitesController extends BaseHttpController {
export class BaseSubscriptionInvitesController extends BaseHttpController {
constructor(
protected subscriptionInvitesController: SubscriptionInvitesController,
private controllerContainer?: ControllerContainerInterface,

View file

@ -4,7 +4,7 @@ import { Request, Response } from 'express'
import { GetSetting } from '../../../Domain/UseCase/GetSetting/GetSetting'
export class HomeServerSubscriptionSettingsController extends BaseHttpController {
export class BaseSubscriptionSettingsController extends BaseHttpController {
constructor(protected doGetSetting: GetSetting, private controllerContainer?: ControllerContainerInterface) {
super()

View file

@ -11,7 +11,7 @@ import { ProjectorInterface } from '../../../Projection/ProjectorInterface'
import { SettingName } from '@standardnotes/settings'
import { User } from '../../../Domain/User/User'
export class HomeServerSubscriptionTokensController extends BaseHttpController {
export class BaseSubscriptionTokensController extends BaseHttpController {
constructor(
protected createSubscriptionToken: CreateSubscriptionToken,
protected authenticateToken: AuthenticateSubscriptionToken,

View file

@ -4,7 +4,7 @@ import { Request, Response } from 'express'
import { UserRequestsController } from '../../../Controller/UserRequestsController'
export class HomeServerUserRequestsController extends BaseHttpController {
export class BaseUserRequestsController extends BaseHttpController {
constructor(
protected userRequestsController: UserRequestsController,
private controllerContainer?: ControllerContainerInterface,

View file

@ -11,7 +11,7 @@ import { IncreaseLoginAttempts } from '../../../Domain/UseCase/IncreaseLoginAtte
import { UpdateUser } from '../../../Domain/UseCase/UpdateUser'
import { ErrorTag } from '@standardnotes/responses'
export class HomeServerUsersController extends BaseHttpController {
export class BaseUsersController extends BaseHttpController {
constructor(
protected updateUser: UpdateUser,
protected getUserKeyParams: GetUserKeyParams,

View file

@ -7,7 +7,7 @@ import { ValetTokenOperation } from '@standardnotes/security'
import { CreateValetToken } from '../../../Domain/UseCase/CreateValetToken/CreateValetToken'
import { CreateValetTokenPayload } from '../../../Domain/ValetToken/CreateValetTokenPayload'
export class HomeServerValetTokenController extends BaseHttpController {
export class BaseValetTokenController extends BaseHttpController {
constructor(protected createValetKey: CreateValetToken, private controllerContainer?: ControllerContainerInterface) {
super()

View file

@ -6,7 +6,7 @@ import { BaseHttpController, results } from 'inversify-express-utils'
import { CreateCrossServiceToken } from '../../../Domain/UseCase/CreateCrossServiceToken/CreateCrossServiceToken'
import { ErrorTag } from '@standardnotes/responses'
export class HomeServerWebSocketsController extends BaseHttpController {
export class BaseWebSocketsController extends BaseHttpController {
constructor(
protected createCrossServiceToken: CreateCrossServiceToken,
protected tokenDecoder: TokenDecoderInterface<WebSocketConnectionTokenData>,

View file

@ -2,9 +2,9 @@ import 'reflect-metadata'
import * as busboy from 'connect-busboy'
import '../src/Infra/InversifyExpress/InversifyExpressHealthCheckController'
import '../src/Infra/InversifyExpress/InversifyExpressFilesController'
import '../src/Infra/InversifyExpress/InversifyExpressSharedVaultFilesController'
import '../src/Infra/InversifyExpress/AnnotatedHealthCheckController'
import '../src/Infra/InversifyExpress/AnnotatedFilesController'
import '../src/Infra/InversifyExpress/AnnotatedSharedVaultFilesController'
import helmet from 'helmet'
import * as cors from 'cors'

View file

@ -7,7 +7,7 @@ import { UploadFileChunk } from '../../Domain/UseCase/UploadFileChunk/UploadFile
import { Request, Response } from 'express'
import { Writable, Readable } from 'stream'
import { InversifyExpressFilesController } from './InversifyExpressFilesController'
import { AnnotatedFilesController } from './AnnotatedFilesController'
import { GetFileMetadata } from '../../Domain/UseCase/GetFileMetadata/GetFileMetadata'
import { results } from 'inversify-express-utils'
import { RemoveFile } from '../../Domain/UseCase/RemoveFile/RemoveFile'
@ -15,7 +15,7 @@ import { ValetTokenOperation } from '@standardnotes/security'
import { BadRequestErrorMessageResult } from 'inversify-express-utils/lib/results'
import { Result } from '@standardnotes/domain-core'
describe('InversifyExpressFilesController', () => {
describe('AnnotatedFilesController', () => {
let uploadFileChunk: UploadFileChunk
let createUploadSession: CreateUploadSession
let finishUploadSession: FinishUploadSession
@ -28,7 +28,7 @@ describe('InversifyExpressFilesController', () => {
const maxChunkBytes = 100_000
const createController = () =>
new InversifyExpressFilesController(
new AnnotatedFilesController(
uploadFileChunk,
createUploadSession,
finishUploadSession,

View file

@ -12,7 +12,7 @@ import { RemoveFile } from '../../Domain/UseCase/RemoveFile/RemoveFile'
import { ValetTokenOperation } from '@standardnotes/security'
@controller('/v1/files', TYPES.Files_ValetTokenAuthMiddleware)
export class InversifyExpressFilesController extends BaseHttpController {
export class AnnotatedFilesController extends BaseHttpController {
constructor(
@inject(TYPES.Files_UploadFileChunk) private uploadFileChunk: UploadFileChunk,
@inject(TYPES.Files_CreateUploadSession) private createUploadSession: CreateUploadSession,

View file

@ -0,0 +1,12 @@
import 'reflect-metadata'
import { AnnotatedHealthCheckController } from './AnnotatedHealthCheckController'
describe('AnnotatedHealthCheckController', () => {
const createController = () => new AnnotatedHealthCheckController()
it('should return OK', async () => {
const response = (await createController().get()) as string
expect(response).toEqual('OK')
})
})

View file

@ -1,7 +1,7 @@
import { controller, httpGet } from 'inversify-express-utils'
@controller('/healthcheck')
export class InversifyExpressHealthCheckController {
export class AnnotatedHealthCheckController {
@httpGet('/')
public async get(): Promise<string> {
return 'OK'

View file

@ -14,7 +14,7 @@ import { StreamDownloadFile } from '../../Domain/UseCase/StreamDownloadFile/Stre
import { UploadFileChunk } from '../../Domain/UseCase/UploadFileChunk/UploadFileChunk'
@controller('/v1/shared-vault/files', TYPES.Files_SharedVaultValetTokenAuthMiddleware)
export class InversifyExpressSharedVaultFilesController extends BaseHttpController {
export class AnnotatedSharedVaultFilesController extends BaseHttpController {
constructor(
@inject(TYPES.Files_UploadFileChunk) private uploadFileChunk: UploadFileChunk,
@inject(TYPES.Files_CreateUploadSession) private createUploadSession: CreateUploadSession,

View file

@ -1,12 +0,0 @@
import 'reflect-metadata'
import { InversifyExpressHealthCheckController } from './InversifyExpressHealthCheckController'
describe('InversifyExpressHealthCheckController', () => {
const createController = () => new InversifyExpressHealthCheckController()
it('should return OK', async () => {
const response = (await createController().get()) as string
expect(response).toEqual('OK')
})
})

View file

@ -1 +1,2 @@
export * from './InversifyExpressFilesController'
export * from './AnnotatedFilesController'
export * from './AnnotatedSharedVaultFilesController'

View file

@ -9,8 +9,8 @@ import TYPES from '../src/Bootstrap/Types'
import { Env } from '../src/Bootstrap/Env'
import { ContainerConfigLoader } from '../src/Bootstrap/Container'
import '../src/Infra/InversifyExpress/InversifyExpressRevisionsController'
import '../src/Infra/InversifyExpress/InversifyExpressHealthCheckController'
import '../src/Infra/InversifyExpress/AnnotatedRevisionsController'
import '../src/Infra/InversifyExpress/AnnotatedHealthCheckController'
const container = new ContainerConfigLoader()
void container.load().then((container) => {

View file

@ -45,7 +45,7 @@ import { CopyRevisions } from '../Domain/UseCase/CopyRevisions/CopyRevisions'
import { FSDumpRepository } from '../Infra/FS/FSDumpRepository'
import { S3DumpRepository } from '../Infra/S3/S3ItemDumpRepository'
import { RevisionItemStringMapper } from '../Mapping/RevisionItemStringMapper'
import { HomeServerRevisionsController } from '../Infra/InversifyExpress/HomeServer/HomeServerRevisionsController'
import { BaseRevisionsController } from '../Infra/InversifyExpress/Base/BaseRevisionsController'
import { Transform } from 'stream'
export class ContainerConfigLoader {
@ -343,9 +343,9 @@ export class ContainerConfigLoader {
// Inversify Controllers
if (isConfiguredForHomeServer) {
container
.bind<HomeServerRevisionsController>(TYPES.Revisions_HomeServerRevisionsController)
.bind<BaseRevisionsController>(TYPES.Revisions_BaseRevisionsController)
.toConstantValue(
new HomeServerRevisionsController(
new BaseRevisionsController(
container.get(TYPES.Revisions_RevisionsController),
container.get(TYPES.Revisions_ControllerContainer),
),

View file

@ -43,7 +43,7 @@ const TYPES = {
Revisions_DomainEventMessageHandler: Symbol.for('Revisions_DomainEventMessageHandler'),
Revisions_Timer: Symbol.for('Revisions_Timer'),
// Inversify Express Controllers
Revisions_HomeServerRevisionsController: Symbol.for('Revisions_HomeServerRevisionsController'),
Revisions_BaseRevisionsController: Symbol.for('Revisions_BaseRevisionsController'),
}
export default TYPES

View file

@ -1,7 +1,7 @@
import { BaseHttpController, controller, httpGet } from 'inversify-express-utils'
@controller('/healthcheck')
export class InversifyExpressHealthCheckController extends BaseHttpController {
export class AnnotatedHealthCheckController extends BaseHttpController {
@httpGet('/')
public async get(): Promise<string> {
return 'OK'

View file

@ -4,10 +4,10 @@ import { inject } from 'inversify'
import TYPES from '../../Bootstrap/Types'
import { RevisionsController } from '../../Controller/RevisionsController'
import { HomeServerRevisionsController } from './HomeServer/HomeServerRevisionsController'
import { BaseRevisionsController } from './Base/BaseRevisionsController'
@controller('/items/:itemUuid/revisions', TYPES.Revisions_ApiGatewayAuthMiddleware)
export class InversifyExpressRevisionsController extends HomeServerRevisionsController {
export class AnnotatedRevisionsController extends BaseRevisionsController {
constructor(@inject(TYPES.Revisions_RevisionsController) override revisionsController: RevisionsController) {
super(revisionsController)
}

View file

@ -4,7 +4,7 @@ import { ControllerContainerInterface } from '@standardnotes/domain-core'
import { RevisionsController } from '../../../Controller/RevisionsController'
export class HomeServerRevisionsController extends BaseHttpController {
export class BaseRevisionsController extends BaseHttpController {
constructor(
protected revisionsController: RevisionsController,
private controllerContainer?: ControllerContainerInterface,

View file

@ -1,11 +1,11 @@
import 'reflect-metadata'
import '../src/Infra/InversifyExpressUtils/InversifyExpressHealthCheckController'
import '../src/Infra/InversifyExpressUtils/InversifyExpressItemsController'
import '../src/Infra/InversifyExpressUtils/InversifyExpressMessagesController'
import '../src/Infra/InversifyExpressUtils/InversifyExpressSharedVaultInvitesController'
import '../src/Infra/InversifyExpressUtils/InversifyExpressSharedVaultUsersController'
import '../src/Infra/InversifyExpressUtils/InversifyExpressSharedVaultsController'
import '../src/Infra/InversifyExpressUtils/AnnotatedHealthCheckController'
import '../src/Infra/InversifyExpressUtils/AnnotatedItemsController'
import '../src/Infra/InversifyExpressUtils/AnnotatedMessagesController'
import '../src/Infra/InversifyExpressUtils/AnnotatedSharedVaultInvitesController'
import '../src/Infra/InversifyExpressUtils/AnnotatedSharedVaultUsersController'
import '../src/Infra/InversifyExpressUtils/AnnotatedSharedVaultsController'
import helmet from 'helmet'
import * as cors from 'cors'

View file

@ -59,7 +59,7 @@ import { FSItemBackupService } from '../Infra/FS/FSItemBackupService'
import { AuthHttpService } from '../Infra/HTTP/AuthHttpService'
import { S3ItemBackupService } from '../Infra/S3/S3ItemBackupService'
import { ControllerContainer, ControllerContainerInterface, MapperInterface } from '@standardnotes/domain-core'
import { HomeServerItemsController } from '../Infra/InversifyExpressUtils/HomeServer/HomeServerItemsController'
import { BaseItemsController } from '../Infra/InversifyExpressUtils/Base/BaseItemsController'
import { Transform } from 'stream'
import { TypeORMItem } from '../Infra/TypeORM/TypeORMItem'
import { ItemPersistenceMapper } from '../Mapping/Persistence/ItemPersistenceMapper'
@ -88,7 +88,7 @@ import { TypeORMSharedVaultAssociationRepository } from '../Infra/TypeORM/TypeOR
import { KeySystemAssociation } from '../Domain/KeySystem/KeySystemAssociation'
import { KeySystemAssociationRepositoryInterface } from '../Domain/KeySystem/KeySystemAssociationRepositoryInterface'
import { KeySystemAssociationPersistenceMapper } from '../Mapping/Persistence/KeySystemAssociationPersistenceMapper'
import { HomeServerSharedVaultInvitesController } from '../Infra/InversifyExpressUtils/HomeServer/HomeServerSharedVaultInvitesController'
import { BaseSharedVaultInvitesController } from '../Infra/InversifyExpressUtils/Base/BaseSharedVaultInvitesController'
import { InviteUserToSharedVault } from '../Domain/UseCase/SharedVaults/InviteUserToSharedVault/InviteUserToSharedVault'
import { TypeORMSharedVaultRepository } from '../Infra/TypeORM/TypeORMSharedVaultRepository'
import { TypeORMSharedVault } from '../Infra/TypeORM/TypeORMSharedVault'
@ -113,7 +113,7 @@ import { DeleteSharedVaultInvitesToUser } from '../Domain/UseCase/SharedVaults/D
import { DeleteSharedVaultInvitesSentByUser } from '../Domain/UseCase/SharedVaults/DeleteSharedVaultInvitesSentByUser/DeleteSharedVaultInvitesSentByUser'
import { GetSharedVaultInvitesSentByUser } from '../Domain/UseCase/SharedVaults/GetSharedVaultInvitesSentByUser/GetSharedVaultInvitesSentByUser'
import { GetSharedVaultInvitesSentToUser } from '../Domain/UseCase/SharedVaults/GetSharedVaultInvitesSentToUser/GetSharedVaultInvitesSentToUser'
import { HomeServerSharedVaultUsersController } from '../Infra/InversifyExpressUtils/HomeServer/HomeServerSharedVaultUsersController'
import { BaseSharedVaultUsersController } from '../Infra/InversifyExpressUtils/Base/BaseSharedVaultUsersController'
import { GetSharedVaultUsers } from '../Domain/UseCase/SharedVaults/GetSharedVaultUsers/GetSharedVaultUsers'
import { RemoveUserFromSharedVault } from '../Domain/UseCase/SharedVaults/RemoveUserFromSharedVault/RemoveUserFromSharedVault'
import { AddNotificationForUser } from '../Domain/UseCase/Messaging/AddNotificationForUser/AddNotificationForUser'
@ -124,7 +124,7 @@ import { NotificationPersistenceMapper } from '../Mapping/Persistence/Notificati
import { Notification } from '../Domain/Notifications/Notification'
import { SharedVaultUserHttpRepresentation } from '../Mapping/Http/SharedVaultUserHttpRepresentation'
import { SharedVaultUserHttpMapper } from '../Mapping/Http/SharedVaultUserHttpMapper'
import { HomeServerSharedVaultsController } from '../Infra/InversifyExpressUtils/HomeServer/HomeServerSharedVaultsController'
import { BaseSharedVaultsController } from '../Infra/InversifyExpressUtils/Base/BaseSharedVaultsController'
import { GetSharedVaults } from '../Domain/UseCase/SharedVaults/GetSharedVaults/GetSharedVaults'
import { CreateSharedVault } from '../Domain/UseCase/SharedVaults/CreateSharedVault/CreateSharedVault'
import { DeleteSharedVault } from '../Domain/UseCase/SharedVaults/DeleteSharedVault/DeleteSharedVault'
@ -134,7 +134,7 @@ import { SharedVaultHttpRepresentation } from '../Mapping/Http/SharedVaultHttpRe
import { SharedVaultHttpMapper } from '../Mapping/Http/SharedVaultHttpMapper'
import { SharedVaultInviteHttpRepresentation } from '../Mapping/Http/SharedVaultInviteHttpRepresentation'
import { SharedVaultInviteHttpMapper } from '../Mapping/Http/SharedVaultInviteHttpMapper'
import { HomeServerMessagesController } from '../Infra/InversifyExpressUtils/HomeServer/HomeServerMessagesController'
import { BaseMessagesController } from '../Infra/InversifyExpressUtils/Base/BaseMessagesController'
import { GetMessagesSentToUser } from '../Domain/UseCase/Messaging/GetMessagesSentToUser/GetMessagesSentToUser'
import { TypeORMMessage } from '../Infra/TypeORM/TypeORMMessage'
import { MessageRepositoryInterface } from '../Domain/Message/MessageRepositoryInterface'
@ -925,9 +925,9 @@ export class ContainerConfigLoader {
if (isConfiguredForHomeServer) {
container
.bind<HomeServerItemsController>(TYPES.Sync_HomeServerItemsController)
.bind<BaseItemsController>(TYPES.Sync_BaseItemsController)
.toConstantValue(
new HomeServerItemsController(
new BaseItemsController(
container.get(TYPES.Sync_SyncItems),
container.get(TYPES.Sync_CheckIntegrity),
container.get(TYPES.Sync_GetItem),
@ -937,9 +937,9 @@ export class ContainerConfigLoader {
),
)
container
.bind<HomeServerSharedVaultInvitesController>(TYPES.Sync_HomeServerSharedVaultInvitesController)
.bind<BaseSharedVaultInvitesController>(TYPES.Sync_BaseSharedVaultInvitesController)
.toConstantValue(
new HomeServerSharedVaultInvitesController(
new BaseSharedVaultInvitesController(
container.get(TYPES.Sync_InviteUserToSharedVault),
container.get(TYPES.Sync_UpdateSharedVaultInvite),
container.get(TYPES.Sync_AcceptInviteToSharedVault),
@ -953,9 +953,9 @@ export class ContainerConfigLoader {
),
)
container
.bind<HomeServerSharedVaultUsersController>(TYPES.Sync_HomeServerSharedVaultUsersController)
.bind<BaseSharedVaultUsersController>(TYPES.Sync_BaseSharedVaultUsersController)
.toConstantValue(
new HomeServerSharedVaultUsersController(
new BaseSharedVaultUsersController(
container.get(TYPES.Sync_GetSharedVaultUsers),
container.get(TYPES.Sync_RemoveSharedVaultUser),
container.get(TYPES.Sync_SharedVaultUserHttpMapper),
@ -963,9 +963,9 @@ export class ContainerConfigLoader {
),
)
container
.bind<HomeServerSharedVaultsController>(TYPES.Sync_HomeServerSharedVaultsController)
.bind<BaseSharedVaultsController>(TYPES.Sync_BaseSharedVaultsController)
.toConstantValue(
new HomeServerSharedVaultsController(
new BaseSharedVaultsController(
container.get(TYPES.Sync_GetSharedVaults),
container.get(TYPES.Sync_CreateSharedVault),
container.get(TYPES.Sync_DeleteSharedVault),
@ -976,9 +976,9 @@ export class ContainerConfigLoader {
),
)
container
.bind<HomeServerMessagesController>(TYPES.Sync_HomeServerMessagesController)
.bind<BaseMessagesController>(TYPES.Sync_BaseMessagesController)
.toConstantValue(
new HomeServerMessagesController(
new BaseMessagesController(
container.get(TYPES.Sync_GetMessagesSentToUser),
container.get(TYPES.Sync_GetMessagesSentByUser),
container.get(TYPES.Sync_SendMessageToUser),

View file

@ -107,11 +107,11 @@ const TYPES = {
Sync_ContentFilter: Symbol.for('Sync_ContentFilter'),
Sync_ItemTransferCalculator: Symbol.for('Sync_ItemTransferCalculator'),
Sync_ControllerContainer: Symbol.for('Sync_ControllerContainer'),
Sync_HomeServerItemsController: Symbol.for('Sync_HomeServerItemsController'),
Sync_HomeServerSharedVaultInvitesController: Symbol.for('Sync_HomeServerSharedVaultInvitesController'),
Sync_HomeServerSharedVaultUsersController: Symbol.for('Sync_HomeServerSharedVaultUsersController'),
Sync_HomeServerSharedVaultsController: Symbol.for('Sync_HomeServerSharedVaultsController'),
Sync_HomeServerMessagesController: Symbol.for('Sync_HomeServerMessagesController'),
Sync_BaseItemsController: Symbol.for('Sync_BaseItemsController'),
Sync_BaseSharedVaultInvitesController: Symbol.for('Sync_BaseSharedVaultInvitesController'),
Sync_BaseSharedVaultUsersController: Symbol.for('Sync_BaseSharedVaultUsersController'),
Sync_BaseSharedVaultsController: Symbol.for('Sync_BaseSharedVaultsController'),
Sync_BaseMessagesController: Symbol.for('Sync_BaseMessagesController'),
// Mapping
Sync_SharedVaultHttpMapper: Symbol.for('Sync_SharedVaultHttpMapper'),
Sync_SharedVaultUserHttpMapper: Symbol.for('Sync_SharedVaultUserHttpMapper'),

View file

@ -1,7 +1,7 @@
import { controller, httpGet } from 'inversify-express-utils'
@controller('/healthcheck')
export class InversifyExpressHealthCheckController {
export class AnnotatedHealthCheckController {
@httpGet('/')
public async get(): Promise<string> {
return 'OK'

View file

@ -8,12 +8,12 @@ import { SyncResponseFactoryResolverInterface } from '../../Domain/Item/SyncResp
import { CheckIntegrity } from '../../Domain/UseCase/Syncing/CheckIntegrity/CheckIntegrity'
import { GetItem } from '../../Domain/UseCase/Syncing/GetItem/GetItem'
import { SyncItems } from '../../Domain/UseCase/Syncing/SyncItems/SyncItems'
import { HomeServerItemsController } from './HomeServer/HomeServerItemsController'
import { BaseItemsController } from './Base/BaseItemsController'
import { MapperInterface } from '@standardnotes/domain-core'
import { ItemHttpRepresentation } from '../../Mapping/Http/ItemHttpRepresentation'
@controller('/items', TYPES.Sync_AuthMiddleware)
export class InversifyExpressItemsController extends HomeServerItemsController {
export class AnnotatedItemsController extends BaseItemsController {
constructor(
@inject(TYPES.Sync_SyncItems) override syncItems: SyncItems,
@inject(TYPES.Sync_CheckIntegrity) override checkIntegrity: CheckIntegrity,

View file

@ -4,7 +4,7 @@ import { MapperInterface } from '@standardnotes/domain-core'
import { Request, Response } from 'express'
import TYPES from '../../Bootstrap/Types'
import { HomeServerMessagesController } from './HomeServer/HomeServerMessagesController'
import { BaseMessagesController } from './Base/BaseMessagesController'
import { GetMessagesSentToUser } from '../../Domain/UseCase/Messaging/GetMessagesSentToUser/GetMessagesSentToUser'
import { DeleteAllMessagesSentToUser } from '../../Domain/UseCase/Messaging/DeleteAllMessagesSentToUser/DeleteAllMessagesSentToUser'
import { DeleteMessage } from '../../Domain/UseCase/Messaging/DeleteMessage/DeleteMessage'
@ -14,7 +14,7 @@ import { Message } from '../../Domain/Message/Message'
import { GetMessagesSentByUser } from '../../Domain/UseCase/Messaging/GetMessagesSentByUser/GetMessagesSentByUser'
@controller('/messages', TYPES.Sync_AuthMiddleware)
export class InversifyExpressMessagesController extends HomeServerMessagesController {
export class AnnotatedMessagesController extends BaseMessagesController {
constructor(
@inject(TYPES.Sync_GetMessagesSentToUser) override getMessageSentToUserUseCase: GetMessagesSentToUser,
@inject(TYPES.Sync_GetMessagesSentByUser) override getMessagesSentByUserUseCase: GetMessagesSentByUser,

View file

@ -12,12 +12,12 @@ import { GetSharedVaultInvitesSentByUser } from '../../Domain/UseCase/SharedVaul
import { InviteUserToSharedVault } from '../../Domain/UseCase/SharedVaults/InviteUserToSharedVault/InviteUserToSharedVault'
import { UpdateSharedVaultInvite } from '../../Domain/UseCase/SharedVaults/UpdateSharedVaultInvite/UpdateSharedVaultInvite'
import { SharedVaultInviteHttpRepresentation } from '../../Mapping/Http/SharedVaultInviteHttpRepresentation'
import { HomeServerSharedVaultInvitesController } from './HomeServer/HomeServerSharedVaultInvitesController'
import { BaseSharedVaultInvitesController } from './Base/BaseSharedVaultInvitesController'
import { GetSharedVaultInvitesSentToUser } from '../../Domain/UseCase/SharedVaults/GetSharedVaultInvitesSentToUser/GetSharedVaultInvitesSentToUser'
import { inject } from 'inversify'
@controller('/shared-vaults', TYPES.Sync_AuthMiddleware)
export class InversifyExpressSharedVaultInvitesController extends HomeServerSharedVaultInvitesController {
export class AnnotatedSharedVaultInvitesController extends BaseSharedVaultInvitesController {
constructor(
@inject(TYPES.Sync_InviteUserToSharedVault) override inviteUserToSharedVaultUseCase: InviteUserToSharedVault,
@inject(TYPES.Sync_UpdateSharedVaultInvite) override updateSharedVaultInviteUseCase: UpdateSharedVaultInvite,

View file

@ -3,7 +3,7 @@ import { inject } from 'inversify'
import { MapperInterface } from '@standardnotes/domain-core'
import { Request, Response } from 'express'
import { HomeServerSharedVaultUsersController } from './HomeServer/HomeServerSharedVaultUsersController'
import { BaseSharedVaultUsersController } from './Base/BaseSharedVaultUsersController'
import TYPES from '../../Bootstrap/Types'
import { SharedVaultUser } from '../../Domain/SharedVault/User/SharedVaultUser'
import { SharedVaultUserHttpRepresentation } from '../../Mapping/Http/SharedVaultUserHttpRepresentation'
@ -11,7 +11,7 @@ import { GetSharedVaultUsers } from '../../Domain/UseCase/SharedVaults/GetShared
import { RemoveUserFromSharedVault } from '../../Domain/UseCase/SharedVaults/RemoveUserFromSharedVault/RemoveUserFromSharedVault'
@controller('/shared-vaults/:sharedVaultUuid/users', TYPES.Sync_AuthMiddleware)
export class InversifyExpressSharedVaultUsersController extends HomeServerSharedVaultUsersController {
export class AnnotatedSharedVaultUsersController extends BaseSharedVaultUsersController {
constructor(
@inject(TYPES.Sync_GetSharedVaultUsers) override getSharedVaultUsersUseCase: GetSharedVaultUsers,
@inject(TYPES.Sync_RemoveSharedVaultUser) override removeUserFromSharedVaultUseCase: RemoveUserFromSharedVault,

View file

@ -3,7 +3,7 @@ import { inject } from 'inversify'
import { MapperInterface } from '@standardnotes/domain-core'
import { Request, Response } from 'express'
import { HomeServerSharedVaultsController } from './HomeServer/HomeServerSharedVaultsController'
import { BaseSharedVaultsController } from './Base/BaseSharedVaultsController'
import TYPES from '../../Bootstrap/Types'
import { SharedVault } from '../../Domain/SharedVault/SharedVault'
import { SharedVaultUser } from '../../Domain/SharedVault/User/SharedVaultUser'
@ -15,7 +15,7 @@ import { SharedVaultHttpRepresentation } from '../../Mapping/Http/SharedVaultHtt
import { SharedVaultUserHttpRepresentation } from '../../Mapping/Http/SharedVaultUserHttpRepresentation'
@controller('/shared-vaults', TYPES.Sync_AuthMiddleware)
export class InversifyExpressSharedVaultsController extends HomeServerSharedVaultsController {
export class AnnotatedSharedVaultsController extends BaseSharedVaultsController {
constructor(
@inject(TYPES.Sync_GetSharedVaults) override getSharedVaultsUseCase: GetSharedVaults,
@inject(TYPES.Sync_CreateSharedVault) override createSharedVaultUseCase: CreateSharedVault,

View file

@ -12,7 +12,7 @@ import { HttpStatusCode } from '@standardnotes/responses'
import { ItemHttpRepresentation } from '../../../Mapping/Http/ItemHttpRepresentation'
import { ItemHash } from '../../../Domain/Item/ItemHash'
export class HomeServerItemsController extends BaseHttpController {
export class BaseItemsController extends BaseHttpController {
constructor(
protected syncItems: SyncItems,
protected checkIntegrity: CheckIntegrity,

View file

@ -10,7 +10,7 @@ import { DeleteAllMessagesSentToUser } from '../../../Domain/UseCase/Messaging/D
import { DeleteMessage } from '../../../Domain/UseCase/Messaging/DeleteMessage/DeleteMessage'
import { GetMessagesSentByUser } from '../../../Domain/UseCase/Messaging/GetMessagesSentByUser/GetMessagesSentByUser'
export class HomeServerMessagesController extends BaseHttpController {
export class BaseMessagesController extends BaseHttpController {
constructor(
protected getMessageSentToUserUseCase: GetMessagesSentToUser,
protected getMessagesSentByUserUseCase: GetMessagesSentByUser,

View file

@ -14,7 +14,7 @@ import { GetSharedVaultInvitesSentByUser } from '../../../Domain/UseCase/SharedV
import { DeleteSharedVaultInvitesSentByUser } from '../../../Domain/UseCase/SharedVaults/DeleteSharedVaultInvitesSentByUser/DeleteSharedVaultInvitesSentByUser'
import { GetSharedVaultInvitesSentToUser } from '../../../Domain/UseCase/SharedVaults/GetSharedVaultInvitesSentToUser/GetSharedVaultInvitesSentToUser'
export class HomeServerSharedVaultInvitesController extends BaseHttpController {
export class BaseSharedVaultInvitesController extends BaseHttpController {
constructor(
protected inviteUserToSharedVaultUseCase: InviteUserToSharedVault,
protected updateSharedVaultInviteUseCase: UpdateSharedVaultInvite,

View file

@ -8,7 +8,7 @@ import { SharedVaultUserHttpRepresentation } from '../../../Mapping/Http/SharedV
import { GetSharedVaultUsers } from '../../../Domain/UseCase/SharedVaults/GetSharedVaultUsers/GetSharedVaultUsers'
import { RemoveUserFromSharedVault } from '../../../Domain/UseCase/SharedVaults/RemoveUserFromSharedVault/RemoveUserFromSharedVault'
export class HomeServerSharedVaultUsersController extends BaseHttpController {
export class BaseSharedVaultUsersController extends BaseHttpController {
constructor(
protected getSharedVaultUsersUseCase: GetSharedVaultUsers,
protected removeUserFromSharedVaultUseCase: RemoveUserFromSharedVault,

View file

@ -12,7 +12,7 @@ import { SharedVaultUserHttpRepresentation } from '../../../Mapping/Http/SharedV
import { DeleteSharedVault } from '../../../Domain/UseCase/SharedVaults/DeleteSharedVault/DeleteSharedVault'
import { CreateSharedVaultFileValetToken } from '../../../Domain/UseCase/SharedVaults/CreateSharedVaultFileValetToken/CreateSharedVaultFileValetToken'
export class HomeServerSharedVaultsController extends BaseHttpController {
export class BaseSharedVaultsController extends BaseHttpController {
constructor(
protected getSharedVaultsUseCase: GetSharedVaults,
protected createSharedVaultUseCase: CreateSharedVault,

View file

@ -1,7 +1,7 @@
import 'reflect-metadata'
import '../src/Infra/InversifyExpressUtils/InversifyExpressHealthCheckController'
import '../src/Infra/InversifyExpressUtils/InversifyExpressWebSocketsController'
import '../src/Infra/InversifyExpressUtils/AnnotatedHealthCheckController'
import '../src/Infra/InversifyExpressUtils/AnnotatedWebSocketsController'
import * as cors from 'cors'
import { urlencoded, json, Request, Response, NextFunction } from 'express'

View file

@ -1,7 +1,7 @@
import { controller, httpGet } from 'inversify-express-utils'
@controller('/healthcheck')
export class InversifyExpressHealthCheckController {
export class AnnotatedHealthCheckController {
@httpGet('/')
public async get(): Promise<string> {
return 'OK'

View file

@ -14,7 +14,7 @@ import { AddWebSocketsConnection } from '../../Domain/UseCase/AddWebSocketsConne
import { RemoveWebSocketsConnection } from '../../Domain/UseCase/RemoveWebSocketsConnection/RemoveWebSocketsConnection'
@controller('/sockets')
export class InversifyExpressWebSocketsController extends BaseHttpController {
export class AnnotatedWebSocketsController extends BaseHttpController {
constructor(
@inject(TYPES.AddWebSocketsConnection) private addWebSocketsConnection: AddWebSocketsConnection,
@inject(TYPES.RemoveWebSocketsConnection) private removeWebSocketsConnection: RemoveWebSocketsConnection,