2023-10-15 09:08:33 +00:00
|
|
|
module.exports = Self => {
|
2023-10-19 06:37:28 +00:00
|
|
|
Self.remoteMethod('getUrl', {
|
2023-10-15 09:08:33 +00:00
|
|
|
description: 'Returns the colling app name',
|
2023-10-19 06:37:28 +00:00
|
|
|
accessType: 'READ',
|
2023-10-15 09:08:33 +00:00
|
|
|
accepts: [
|
|
|
|
{
|
2023-10-19 06:37:28 +00:00
|
|
|
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-11-25 13:20:15 +00:00
|
|
|
environment: process.env.NODE_ENV || 'development'
|
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
|
|
|
};
|
|
|
|
};
|