2023-11-20 17:39:37 +00:00
|
|
|
const NotFoundError = require('vn-loopback/util/not-found-error');
|
2020-11-12 22:20:25 +00:00
|
|
|
|
|
|
|
module.exports = Self => {
|
|
|
|
Self.remoteMethod('test', {
|
|
|
|
description: 'Tests connector configuration',
|
|
|
|
http: {
|
|
|
|
path: `/test`,
|
|
|
|
verb: 'GET'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
Self.test = async function() {
|
2023-11-20 17:39:37 +00:00
|
|
|
const connector = await Self.getLinker();
|
|
|
|
if (!connector) throw new NotFoundError('Linker not configured');
|
2020-11-12 22:20:25 +00:00
|
|
|
await connector.test();
|
|
|
|
};
|
|
|
|
};
|