mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
⚡ Add tags retrieval endpoint
This commit is contained in:
parent
cc691c2ab0
commit
a8ce974b2e
|
@ -108,6 +108,7 @@ import * as querystring from 'querystring';
|
|||
import * as Queue from '../src/Queue';
|
||||
import { OptionsWithUrl } from 'request-promise-native';
|
||||
import { Registry } from 'prom-client';
|
||||
import { ITagDb } from './Interfaces';
|
||||
|
||||
class App {
|
||||
|
||||
|
@ -710,6 +711,20 @@ class App {
|
|||
}));
|
||||
|
||||
|
||||
// Retrieves all tags
|
||||
this.app.get(`/${this.restEndpoint}/tags`, ResponseHelper.send(async (req: express.Request, res: express.Response): Promise<ITagDb[]> => {
|
||||
|
||||
const findQuery = {
|
||||
select: ['id', 'name'],
|
||||
} as FindManyOptions;
|
||||
|
||||
if (req.query.filter) {
|
||||
findQuery.where = JSON.parse(req.query.filter as string);
|
||||
}
|
||||
|
||||
return await Db.collections.Tag?.find(findQuery) ?? [];
|
||||
}));
|
||||
|
||||
// Returns parameter values which normally get loaded from an external API or
|
||||
// get generated dynamically
|
||||
this.app.get(`/${this.restEndpoint}/node-parameter-options`, ResponseHelper.send(async (req: express.Request, res: express.Response): Promise<INodePropertyOptions[]> => {
|
||||
|
|
Loading…
Reference in a new issue