/* tslint:disable */ /* eslint-disable */ // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa import { Controller, ValidationService, FieldErrors, ValidateError, TsoaRoute, HttpStatusCodeLiteral, TsoaResponse, fetchMiddlewares } from '@tsoa/runtime'; // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa import { UserController } from './controllers/user'; import type { RequestHandler } from 'express'; import * as express from 'express'; // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa const models: TsoaRoute.Models = { "CreateUserBody": { "dataType": "refAlias", "type": {"dataType":"nestedObjectLiteral","nestedProperties":{"Email":{"dataType":"string","required":true},"ChildData":{"dataType":"nestedObjectLiteral","nestedProperties":{"age":{"dataType":"double","required":true},"name":{"dataType":"string","required":true}},"required":true},"MarketId":{"dataType":"string","required":true},"Language":{"dataType":"union","subSchemas":[{"dataType":"enum","enums":["Rus"]},{"dataType":"enum","enums":["Eng"]}],"required":true}},"validators":{}}, }, // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa }; const validationService = new ValidationService(models); // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa export function RegisterRoutes(app: express.Router) { // ########################################################################################################### // NOTE: If you do not see routes for all of your controllers in this file, then you might not have informed tsoa of where to look // Please look into the "controllerPathGlobs" config option described in the readme: https://github.com/lukeautry/tsoa // ########################################################################################################### app.post('/user/create', ...(fetchMiddlewares(UserController)), ...(fetchMiddlewares(UserController.prototype.createUser)), function UserController_createUser(request: any, response: any, next: any) { const args = { body: {"in":"body","name":"body","required":true,"ref":"CreateUserBody"}, }; // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa let validatedArgs: any[] = []; try { validatedArgs = getValidatedArgs(args, request, response); const controller = new UserController(); const promise = controller.createUser.apply(controller, validatedArgs as any); promiseHandler(controller, promise, response, undefined, next); } catch (err) { return next(err); } }); // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa app.get('/user/passcode', ...(fetchMiddlewares(UserController)), ...(fetchMiddlewares(UserController.prototype.getPasscode)), function UserController_getPasscode(request: any, response: any, next: any) { const args = { req: {"in":"request","name":"req","required":true,"dataType":"object"}, }; // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa let validatedArgs: any[] = []; try { validatedArgs = getValidatedArgs(args, request, response); const controller = new UserController(); const promise = controller.getPasscode.apply(controller, validatedArgs as any); promiseHandler(controller, promise, response, undefined, next); } catch (err) { return next(err); } }); // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa app.get('/user/:userId', ...(fetchMiddlewares(UserController)), ...(fetchMiddlewares(UserController.prototype.getUserById)), function UserController_getUserById(request: any, response: any, next: any) { const args = { userId: {"in":"path","name":"userId","required":true,"dataType":"double"}, }; // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa let validatedArgs: any[] = []; try { validatedArgs = getValidatedArgs(args, request, response); const controller = new UserController(); const promise = controller.getUserById.apply(controller, validatedArgs as any); promiseHandler(controller, promise, response, undefined, next); } catch (err) { return next(err); } }); // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa function isController(object: any): object is Controller { return 'getHeaders' in object && 'getStatus' in object && 'setStatus' in object; } function promiseHandler(controllerObj: any, promise: any, response: any, successStatus: any, next: any) { return Promise.resolve(promise) .then((data: any) => { let statusCode = successStatus; let headers; if (isController(controllerObj)) { headers = controllerObj.getHeaders(); statusCode = controllerObj.getStatus() || statusCode; } // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa returnHandler(response, statusCode, data, headers) }) .catch((error: any) => next(error)); } // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa function returnHandler(response: any, statusCode?: number, data?: any, headers: any = {}) { if (response.headersSent) { return; } Object.keys(headers).forEach((name: string) => { response.set(name, headers[name]); }); if (data && typeof data.pipe === 'function' && data.readable && typeof data._read === 'function') { data.pipe(response); } else if (data !== null && data !== undefined) { response.status(statusCode || 200).json(data); } else { response.status(statusCode || 204).end(); } } // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa function responder(response: any): TsoaResponse { return function(status, data, headers) { returnHandler(response, status, data, headers); }; }; // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa function getValidatedArgs(args: any, request: any, response: any): any[] { const fieldErrors: FieldErrors = {}; const values = Object.keys(args).map((key) => { const name = args[key].name; switch (args[key].in) { case 'request': return request; case 'query': return validationService.ValidateParam(args[key], request.query[name], name, fieldErrors, undefined, {"noImplicitAdditionalProperties":"throw-on-extras"}); case 'path': return validationService.ValidateParam(args[key], request.params[name], name, fieldErrors, undefined, {"noImplicitAdditionalProperties":"throw-on-extras"}); case 'header': return validationService.ValidateParam(args[key], request.header(name), name, fieldErrors, undefined, {"noImplicitAdditionalProperties":"throw-on-extras"}); case 'body': return validationService.ValidateParam(args[key], request.body, name, fieldErrors, undefined, {"noImplicitAdditionalProperties":"throw-on-extras"}); case 'body-prop': return validationService.ValidateParam(args[key], request.body[name], name, fieldErrors, 'body.', {"noImplicitAdditionalProperties":"throw-on-extras"}); case 'formData': if (args[key].dataType === 'file') { return validationService.ValidateParam(args[key], request.file, name, fieldErrors, undefined, {"noImplicitAdditionalProperties":"throw-on-extras"}); } else if (args[key].dataType === 'array' && args[key].array.dataType === 'file') { return validationService.ValidateParam(args[key], request.files, name, fieldErrors, undefined, {"noImplicitAdditionalProperties":"throw-on-extras"}); } else { return validationService.ValidateParam(args[key], request.body[name], name, fieldErrors, undefined, {"noImplicitAdditionalProperties":"throw-on-extras"}); } case 'res': return responder(response); } }); if (Object.keys(fieldErrors).length > 0) { throw new ValidateError(fieldErrors, ''); } return values; } // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa } // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa