salix/back/methods/url/getUrl.js

31 lines
730 B
JavaScript
Raw Permalink Normal View History

2023-10-15 09:08:33 +00:00
module.exports = Self => {
Self.remoteMethod('getUrl', {
2023-10-15 09:08:33 +00:00
description: 'Returns the colling app name',
accessType: 'READ',
2023-10-15 09:08:33 +00:00
accepts: [
{
arg: 'app',
2023-10-15 09:08:33 +00:00
type: 'string',
required: false
}
],
returns: {
type: 'object',
root: true
},
http: {
path: `/getUrl`,
verb: 'get'
}
});
Self.getUrl = async(appName = 'salix') => {
2024-04-08 12:46:35 +00:00
const url = await Self.app.models.Url.findOne({
2023-10-15 09:08:33 +00:00
where: {
appName,
2024-03-21 16:28:08 +00:00
environment: process.env.NODE_ENV || 'dev'
2023-10-15 09:08:33 +00:00
}
});
2024-04-08 12:46:35 +00:00
return url?.url;
2023-10-15 09:08:33 +00:00
};
};