2018-04-27 03:50:47 +02:00
|
|
|
const { handleErrorResponse } = require('../utils/errorHandlers.js');
|
2018-04-17 23:54:10 +02:00
|
|
|
const db = require('../../models');
|
2018-03-28 03:25:23 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
route to get a short channel id from long channel Id
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2018-03-29 20:24:52 +02:00
|
|
|
const channelShortIdRoute = ({ ip, originalUrl, params }, res) => {
|
|
|
|
db.Certificate.getShortChannelIdFromLongChannelId(params.longId, params.name)
|
|
|
|
.then(shortId => {
|
|
|
|
res.status(200).json(shortId);
|
|
|
|
})
|
|
|
|
.catch(error => {
|
|
|
|
handleErrorResponse(originalUrl, ip, error, res);
|
|
|
|
});
|
2018-03-28 03:25:23 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = channelShortIdRoute;
|