Skip to content

Commit

Permalink
add topic folders resource
Browse files Browse the repository at this point in the history
CPCN-349
  • Loading branch information
petrjasek committed Sep 19, 2023
1 parent 48a4e30 commit f42a180
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
5 changes: 4 additions & 1 deletion server/cp/mgmt_api/topics.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
27 changes: 27 additions & 0 deletions server/features/mgmt_api_topics.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit f42a180

Please sign in to comment.