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

[Content Types] Create and use async resource and service #2845

Open
wants to merge 2 commits into
base: async
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions apps/content_types/content_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@


class ContentTypesResource(superdesk.Resource):
internal_resource = True
schema = {
"_id": {
"type": "string",
Expand Down
7 changes: 7 additions & 0 deletions superdesk/content_types_async/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from superdesk.core.module import Module
from .service import ContentTypesService
from .module import content_types_resource_config

__all__ = ["ContentTypesService"]

module = Module(name="superdesk.content_types_async", resources=[content_types_resource_config])
23 changes: 23 additions & 0 deletions superdesk/content_types_async/module.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# This file is part of Superdesk.
#
# Copyright 2013, 2025 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license

from superdesk.core.resources import ResourceConfig, MongoResourceConfig, MongoIndexOptions
from superdesk.types.content_types import ContentTypes
from .service import ContentTypesService


content_types_resource_config = ResourceConfig(
name="content_types",
data_class=ContentTypes,
service=ContentTypesService,
mongo=MongoResourceConfig(
indexes=[
MongoIndexOptions(name="label_1", keys=[("label", 1)], unique=True),
],
),
)
Loading
Loading