mirror of
https://github.com/standardnotes/server
synced 2026-07-14 00:01:54 -04:00
* fix(auth): updating storage quota on shared subscriptions * fix(syncing-server): turn shared vault and key associations into value objects * feat: consider shared vault owner quota when uploading files to shared vault * fix: add passing x-shared-vault-owner-context value * fix: refactor creating cross service token to not throw errors * fix: caching cross service token * fix: missing header in http service proxy
39 lines
1.2 KiB
TypeScript
39 lines
1.2 KiB
TypeScript
import { ControllerContainerInterface } from '@standardnotes/domain-core'
|
|
import { BaseHttpController, results } from 'inversify-express-utils'
|
|
import { Request, Response } from 'express'
|
|
|
|
import { GetSetting } from '../../../Domain/UseCase/GetSetting/GetSetting'
|
|
|
|
export class BaseSubscriptionSettingsController extends BaseHttpController {
|
|
constructor(protected doGetSetting: GetSetting, private controllerContainer?: ControllerContainerInterface) {
|
|
super()
|
|
|
|
if (this.controllerContainer !== undefined) {
|
|
this.controllerContainer.register('auth.users.getSubscriptionSetting', this.getSubscriptionSetting.bind(this))
|
|
}
|
|
}
|
|
|
|
async getSubscriptionSetting(request: Request, response: Response): Promise<results.JsonResult> {
|
|
const resultOrError = await this.doGetSetting.execute({
|
|
userUuid: response.locals.user.uuid,
|
|
settingName: request.params.subscriptionSettingName.toUpperCase(),
|
|
})
|
|
|
|
if (resultOrError.isFailed()) {
|
|
return this.json(
|
|
{
|
|
error: {
|
|
message: resultOrError.getError(),
|
|
},
|
|
},
|
|
400,
|
|
)
|
|
}
|
|
|
|
return this.json({
|
|
success: true,
|
|
...resultOrError.getValue(),
|
|
})
|
|
}
|
|
}
|