diff --git a/back/services/subscription.ts b/back/services/subscription.ts index 264eaf95..fa36a3bd 100644 --- a/back/services/subscription.ts +++ b/back/services/subscription.ts @@ -42,47 +42,22 @@ export default class SubscriptionService { public async list(searchText?: string): Promise { let query = {}; if (searchText) { - const textArray = searchText.split(':'); - switch (textArray[0]) { - case 'name': - case 'command': - case 'schedule': - case 'label': - const column = textArray[0] === 'label' ? 'labels' : textArray[0]; - query = { - [column]: { - [Op.or]: [ - { [Op.like]: `%${textArray[1]}%` }, - { [Op.like]: `%${encodeURIComponent(textArray[1])}%` }, - ], - }, - }; - break; - default: - const reg = { - [Op.or]: [ - { [Op.like]: `%${searchText}%` }, - { [Op.like]: `%${encodeURIComponent(searchText)}%` }, - ], - }; - query = { - [Op.or]: [ - { - name: reg, - }, - { - command: reg, - }, - { - schedule: reg, - }, - { - labels: reg, - }, - ], - }; - break; - } + const reg = { + [Op.or]: [ + { [Op.like]: `%${searchText}%` }, + { [Op.like]: `%${encodeURIComponent(searchText)}%` }, + ], + }; + query = { + [Op.or]: [ + { + name: reg, + }, + { + url: reg, + }, + ], + }; } try { const result = await SubscriptionModel.findAll({