From f42a18080df02321429e5a8c80e33de5c068e2a8 Mon Sep 17 00:00:00 2001 From: Petr Jasek Date: Tue, 19 Sep 2023 17:59:25 +0200 Subject: [PATCH] add topic folders resource CPCN-349 --- server/cp/mgmt_api/topics.py | 5 ++++- server/features/mgmt_api_topics.feature | 27 +++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/server/cp/mgmt_api/topics.py b/server/cp/mgmt_api/topics.py index 091a4f6..08425ae 100644 --- a/server/cp/mgmt_api/topics.py +++ b/server/cp/mgmt_api/topics.py @@ -1,14 +1,17 @@ +import superdesk + from bson import ObjectId from flask import current_app as app from newsroom.topics.topics import TopicsResource, TopicsService -import superdesk +from newsroom.topics.folders import FoldersResource, FoldersService from superdesk.errors import SuperdeskApiError def init_app(app): TopicsResource.internal_resource = False superdesk.register_resource('topics', GlobalTopicsResource, GlobalTopicsService, _app=app) + superdesk.register_resource('topic_folders', FoldersResource, FoldersService, _app=app) class GlobalTopicsResource(TopicsResource): diff --git a/server/features/mgmt_api_topics.feature b/server/features/mgmt_api_topics.feature index d52f806..2d38597 100644 --- a/server/features/mgmt_api_topics.feature +++ b/server/features/mgmt_api_topics.feature @@ -84,3 +84,30 @@ Feature: Management API - Topics """ {"label": "topic2"} """ + + Scenario: Topic with folder + Given "topic_folders" + """ + [ + { + "name": "test", + "section": "wire" + } + ] + """ + Given "topics" + """ + [ + { + "label": "topic1", + "company": "#companies._id#", + "topic_type": "wire", + "query": "topic1", + "is_global": true, + "user": "#users._id#", + "folder": "#topic_folders._id#" + } + ] + """ + When we get "/topics" + Then we get list with 1 items