mirror of
https://github.com/standardnotes/server
synced 2026-07-14 00:01:54 -04:00
28 lines
1.0 KiB
TypeScript
28 lines
1.0 KiB
TypeScript
import { Request, Response } from 'express'
|
|
import { inject } from 'inversify'
|
|
import { BaseHttpController, controller, httpPost } from 'inversify-express-utils'
|
|
|
|
import { TYPES } from '../../Bootstrap/Types'
|
|
import { ServiceProxyInterface } from '../../Service/Http/ServiceProxyInterface'
|
|
import { EndpointResolverInterface } from '../../Service/Resolver/EndpointResolverInterface'
|
|
|
|
@controller('/v1/files')
|
|
export class FilesController extends BaseHttpController {
|
|
constructor(
|
|
@inject(TYPES.ApiGateway_ServiceProxy) private httpService: ServiceProxyInterface,
|
|
@inject(TYPES.ApiGateway_EndpointResolver) private endpointResolver: EndpointResolverInterface,
|
|
) {
|
|
super()
|
|
}
|
|
|
|
@httpPost('/valet-tokens', TYPES.ApiGateway_RequiredCrossServiceTokenMiddleware)
|
|
async createToken(request: Request, response: Response): Promise<void> {
|
|
await this.httpService.callAuthServer(
|
|
request,
|
|
response,
|
|
this.endpointResolver.resolveEndpointOrMethodIdentifier('POST', 'valet-tokens'),
|
|
request.body,
|
|
)
|
|
}
|
|
}
|