mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-05-13 21:20:56 +00:00
* Updated to new nodejs packages, depending heavily on express-openapi-validator. Requires quite a change in code. Updated the business-logic in the controllers/Controller.js file. Logger now records also timestamp of events. Files are uploaded according to definition in config.js file * Removed commented-out code; Changed openApi document extensions to suit new express-openapi-validator definition; multipart and file uploading is supported now; Automatic response returns the values the were sent in the request * fixed README documentation, fixed a mistage in package.json/mustache * added generated files that were created when running the ./bin/test file
54 lines
1.7 KiB
JavaScript
54 lines
1.7 KiB
JavaScript
/**
|
|
* The UserController file is a very simple one, which does not need to be changed manually,
|
|
* unless there's a case where business logic reoutes the request to an entity which is not
|
|
* the service.
|
|
* The heavy lifting of the Controller item is done in Request.js - that is where request
|
|
* parameters are extracted and sent to the service, and where response is handled.
|
|
*/
|
|
|
|
const Controller = require('./Controller');
|
|
const service = require('../services/UserService');
|
|
const createUser = async (request, response) => {
|
|
await Controller.handleRequest(request, response, service.createUser);
|
|
};
|
|
|
|
const createUsersWithArrayInput = async (request, response) => {
|
|
await Controller.handleRequest(request, response, service.createUsersWithArrayInput);
|
|
};
|
|
|
|
const createUsersWithListInput = async (request, response) => {
|
|
await Controller.handleRequest(request, response, service.createUsersWithListInput);
|
|
};
|
|
|
|
const deleteUser = async (request, response) => {
|
|
await Controller.handleRequest(request, response, service.deleteUser);
|
|
};
|
|
|
|
const getUserByName = async (request, response) => {
|
|
await Controller.handleRequest(request, response, service.getUserByName);
|
|
};
|
|
|
|
const loginUser = async (request, response) => {
|
|
await Controller.handleRequest(request, response, service.loginUser);
|
|
};
|
|
|
|
const logoutUser = async (request, response) => {
|
|
await Controller.handleRequest(request, response, service.logoutUser);
|
|
};
|
|
|
|
const updateUser = async (request, response) => {
|
|
await Controller.handleRequest(request, response, service.updateUser);
|
|
};
|
|
|
|
|
|
module.exports = {
|
|
createUser,
|
|
createUsersWithArrayInput,
|
|
createUsersWithListInput,
|
|
deleteUser,
|
|
getUserByName,
|
|
loginUser,
|
|
logoutUser,
|
|
updateUser,
|
|
};
|