mirror of
https://github.com/standardnotes/server
synced 2026-07-14 00:01:54 -04:00
25 lines
954 B
TypeScript
25 lines
954 B
TypeScript
import { Request, Response } from 'express'
|
|
import { inject } from 'inversify'
|
|
import { controller, BaseHttpController, results, httpPost } from 'inversify-express-utils'
|
|
|
|
import TYPES from '../../Bootstrap/Types'
|
|
import { UserRequestsController } from '../../Controller/UserRequestsController'
|
|
|
|
@controller('/users/:userUuid/requests')
|
|
export class InversifyExpressUserRequestsController extends BaseHttpController {
|
|
constructor(@inject(TYPES.UserRequestsController) private userRequestsController: UserRequestsController) {
|
|
super()
|
|
}
|
|
|
|
@httpPost('/', TYPES.ApiGatewayAuthMiddleware)
|
|
async submitRequest(request: Request, response: Response): Promise<results.JsonResult> {
|
|
const result = await this.userRequestsController.submitUserRequest({
|
|
requestType: request.body.requestType,
|
|
userUuid: response.locals.user.uuid,
|
|
userEmail: response.locals.user.email,
|
|
})
|
|
|
|
return this.json(result.data, result.status)
|
|
}
|
|
}
|