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 { 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) } }