mirror of
https://github.com/standardnotes/server
synced 2026-01-16 20:04:32 -05:00
* fix(api-gateway): reduce exports * wip controllers * fix: imports of controllers * fix(api-gateway): rename http service interface to proxy interface * wip: self-registering services and controllers * wip: add registering controller method bindings and services in container * feat: merge two services together * wip: resolving endpoints to direct code calls * wip: bind controller container to a singleton * fix: controller binding to instantiate and self-register on controller container * fix: move signout endpoint to auth controller * wip: define inversify controllers in the controller container * fix(auth): bind inversify controllers to controller container * fix(auth): linter issues * fix(auth): specs * fix(auth): inversify controllers bindings * wip: endpoint resolving * wip: add endpoint for more auth controllers * wip: add sessions controller endpoint resolvings * wip: add subscription invites endpoint resolvings * wip: add subscription tokens endpoint resolvings * wip: add all binding for auth server controllers * wip: fix migrations path * fix: configure default env vars and ci setup
39 lines
1.3 KiB
TypeScript
39 lines
1.3 KiB
TypeScript
import { Request, Response } from 'express'
|
|
import { inject } from 'inversify'
|
|
import {
|
|
BaseHttpController,
|
|
controller,
|
|
httpGet,
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
results,
|
|
} from 'inversify-express-utils'
|
|
import TYPES from '../Bootstrap/Types'
|
|
import { GetSetting } from '../Domain/UseCase/GetSetting/GetSetting'
|
|
import { ControllerContainerInterface } from '@standardnotes/domain-core'
|
|
|
|
@controller('/users/:userUuid')
|
|
export class SubscriptionSettingsController extends BaseHttpController {
|
|
constructor(
|
|
@inject(TYPES.Auth_GetSetting) private doGetSetting: GetSetting,
|
|
@inject(TYPES.Auth_ControllerContainer) private controllerContainer: ControllerContainerInterface,
|
|
) {
|
|
super()
|
|
|
|
this.controllerContainer.register('auth.users.getSubscriptionSetting', this.getSubscriptionSetting.bind(this))
|
|
}
|
|
|
|
@httpGet('/subscription-settings/:subscriptionSettingName', TYPES.Auth_ApiGatewayAuthMiddleware)
|
|
async getSubscriptionSetting(request: Request, response: Response): Promise<results.JsonResult> {
|
|
const result = await this.doGetSetting.execute({
|
|
userUuid: response.locals.user.uuid,
|
|
settingName: request.params.subscriptionSettingName.toUpperCase(),
|
|
})
|
|
|
|
if (result.success) {
|
|
return this.json(result)
|
|
}
|
|
|
|
return this.json(result, 400)
|
|
}
|
|
}
|