Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add topic folders resource #131

Merged
merged 1 commit into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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