mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-08 03:18:53 +00:00
94 lines
2.6 KiB
JavaScript
94 lines
2.6 KiB
JavaScript
'use strict';
|
|
|
|
var utils = require('../utils/writer.js');
|
|
var User = require('../service/UserService');
|
|
|
|
module.exports.createUser = function createUser (req, res, next) {
|
|
var body = req.swagger.params['body'].value;
|
|
User.createUser(body)
|
|
.then(function (response) {
|
|
utils.writeJson(res, response);
|
|
})
|
|
.catch(function (response) {
|
|
utils.writeJson(res, response);
|
|
});
|
|
};
|
|
|
|
module.exports.createUsersWithArrayInput = function createUsersWithArrayInput (req, res, next) {
|
|
var body = req.swagger.params['body'].value;
|
|
User.createUsersWithArrayInput(body)
|
|
.then(function (response) {
|
|
utils.writeJson(res, response);
|
|
})
|
|
.catch(function (response) {
|
|
utils.writeJson(res, response);
|
|
});
|
|
};
|
|
|
|
module.exports.createUsersWithListInput = function createUsersWithListInput (req, res, next) {
|
|
var body = req.swagger.params['body'].value;
|
|
User.createUsersWithListInput(body)
|
|
.then(function (response) {
|
|
utils.writeJson(res, response);
|
|
})
|
|
.catch(function (response) {
|
|
utils.writeJson(res, response);
|
|
});
|
|
};
|
|
|
|
module.exports.deleteUser = function deleteUser (req, res, next) {
|
|
var username = req.swagger.params['username'].value;
|
|
User.deleteUser(username)
|
|
.then(function (response) {
|
|
utils.writeJson(res, response);
|
|
})
|
|
.catch(function (response) {
|
|
utils.writeJson(res, response);
|
|
});
|
|
};
|
|
|
|
module.exports.getUserByName = function getUserByName (req, res, next) {
|
|
var username = req.swagger.params['username'].value;
|
|
User.getUserByName(username)
|
|
.then(function (response) {
|
|
utils.writeJson(res, response);
|
|
})
|
|
.catch(function (response) {
|
|
utils.writeJson(res, response);
|
|
});
|
|
};
|
|
|
|
module.exports.loginUser = function loginUser (req, res, next) {
|
|
var username = req.swagger.params['username'].value;
|
|
var password = req.swagger.params['password'].value;
|
|
User.loginUser(username,password)
|
|
.then(function (response) {
|
|
utils.writeJson(res, response);
|
|
})
|
|
.catch(function (response) {
|
|
utils.writeJson(res, response);
|
|
});
|
|
};
|
|
|
|
module.exports.logoutUser = function logoutUser (req, res, next) {
|
|
User.logoutUser()
|
|
.then(function (response) {
|
|
utils.writeJson(res, response);
|
|
})
|
|
.catch(function (response) {
|
|
utils.writeJson(res, response);
|
|
});
|
|
};
|
|
|
|
module.exports.updateUser = function updateUser (req, res, next) {
|
|
var username = req.swagger.params['username'].value;
|
|
var body = req.swagger.params['body'].value;
|
|
User.updateUser(username,body)
|
|
.then(function (response) {
|
|
utils.writeJson(res, response);
|
|
})
|
|
.catch(function (response) {
|
|
utils.writeJson(res, response);
|
|
});
|
|
};
|