From e7a779071d63c32707162a98f1bc0323fb02fb6b Mon Sep 17 00:00:00 2001 From: fbraem Date: Thu, 21 Sep 2023 15:10:02 +0200 Subject: [PATCH] refactor: move modules news and pages into the portal module --- backend/src/kwai/api/v1/portal/endpoints/news.py | 4 ++-- backend/src/kwai/api/v1/portal/schemas/story.py | 2 +- backend/src/kwai/modules/news/__init__.py | 1 - backend/src/kwai/modules/page/__init__.py | 1 - backend/src/kwai/modules/{page => portal}/get_page.py | 4 ++-- backend/src/kwai/modules/{page => portal}/get_pages.py | 2 +- .../src/kwai/modules/{news => portal}/get_stories.py | 2 +- .../kwai/modules/{page => portal}/pages/__init__.py | 0 .../src/kwai/modules/{page => portal}/pages/page.py | 0 .../modules/{page => portal}/pages/page_db_query.py | 6 +++--- .../{page => portal}/pages/page_db_repository.py | 10 +++++----- .../kwai/modules/{page => portal}/pages/page_query.py | 2 +- .../modules/{page => portal}/pages/page_repository.py | 4 ++-- .../kwai/modules/{page => portal}/pages/page_tables.py | 2 +- .../kwai/modules/{news => portal}/stories/__init__.py | 0 .../src/kwai/modules/{news => portal}/stories/story.py | 0 .../modules/{news => portal}/stories/story_db_query.py | 6 +++--- .../{news => portal}/stories/story_db_repository.py | 10 +++++----- .../modules/{news => portal}/stories/story_query.py | 2 +- .../{news => portal}/stories/story_repository.py | 4 ++-- .../modules/{news => portal}/stories/story_tables.py | 2 +- backend/src/tests/modules/news/__init__.py | 1 - backend/src/tests/modules/page/__init__.py | 1 - backend/src/tests/modules/{page => portal}/conftest.py | 6 +++--- .../tests/modules/{page => portal}/pages/__init__.py | 0 .../{page => portal}/pages/test_page_db_query.py | 4 ++-- .../{page => portal}/pages/test_page_db_repository.py | 4 ++-- .../tests/modules/{news => portal}/stories/__init__.py | 0 .../tests/modules/{news => portal}/stories/conftest.py | 2 +- .../{news => portal}/stories/test_stories_db_query.py | 2 +- .../stories/test_stories_db_repository.py | 6 +++--- .../tests/modules/{page => portal}/test_get_page.py | 6 +++--- .../tests/modules/{page => portal}/test_get_pages.py | 6 +++--- .../tests/modules/{news => portal}/test_get_stories.py | 6 +++--- frontend/packages/kwai-date/src/index.ts | 5 +++-- 35 files changed, 55 insertions(+), 58 deletions(-) delete mode 100644 backend/src/kwai/modules/news/__init__.py delete mode 100644 backend/src/kwai/modules/page/__init__.py rename backend/src/kwai/modules/{page => portal}/get_page.py (81%) rename backend/src/kwai/modules/{page => portal}/get_pages.py (93%) rename backend/src/kwai/modules/{news => portal}/get_stories.py (96%) rename backend/src/kwai/modules/{page => portal}/pages/__init__.py (100%) rename backend/src/kwai/modules/{page => portal}/pages/page.py (100%) rename backend/src/kwai/modules/{page => portal}/pages/page_db_query.py (95%) rename backend/src/kwai/modules/{page => portal}/pages/page_db_repository.py (92%) rename backend/src/kwai/modules/{page => portal}/pages/page_query.py (95%) rename backend/src/kwai/modules/{page => portal}/pages/page_repository.py (93%) rename backend/src/kwai/modules/{page => portal}/pages/page_tables.py (97%) rename backend/src/kwai/modules/{news => portal}/stories/__init__.py (100%) rename backend/src/kwai/modules/{news => portal}/stories/story.py (100%) rename backend/src/kwai/modules/{news => portal}/stories/story_db_query.py (96%) rename backend/src/kwai/modules/{news => portal}/stories/story_db_repository.py (92%) rename backend/src/kwai/modules/{news => portal}/stories/story_query.py (97%) rename backend/src/kwai/modules/{news => portal}/stories/story_repository.py (93%) rename backend/src/kwai/modules/{news => portal}/stories/story_tables.py (98%) delete mode 100644 backend/src/tests/modules/news/__init__.py delete mode 100644 backend/src/tests/modules/page/__init__.py rename backend/src/tests/modules/{page => portal}/conftest.py (89%) rename backend/src/tests/modules/{page => portal}/pages/__init__.py (100%) rename backend/src/tests/modules/{page => portal}/pages/test_page_db_query.py (87%) rename backend/src/tests/modules/{page => portal}/pages/test_page_db_repository.py (90%) rename backend/src/tests/modules/{news => portal}/stories/__init__.py (100%) rename backend/src/tests/modules/{news => portal}/stories/conftest.py (93%) rename backend/src/tests/modules/{news => portal}/stories/test_stories_db_query.py (95%) rename backend/src/tests/modules/{news => portal}/stories/test_stories_db_repository.py (91%) rename backend/src/tests/modules/{page => portal}/test_get_page.py (67%) rename backend/src/tests/modules/{page => portal}/test_get_pages.py (70%) rename backend/src/tests/modules/{news => portal}/test_get_stories.py (78%) diff --git a/backend/src/kwai/api/v1/portal/endpoints/news.py b/backend/src/kwai/api/v1/portal/endpoints/news.py index 4e2275294..ce0a0325d 100644 --- a/backend/src/kwai/api/v1/portal/endpoints/news.py +++ b/backend/src/kwai/api/v1/portal/endpoints/news.py @@ -6,8 +6,8 @@ from kwai.api.v1.portal.schemas.story import PortalStoryResource from kwai.core.db.database import Database from kwai.core.json_api import Meta, PaginationModel -from kwai.modules.news.get_stories import GetStories, GetStoriesCommand -from kwai.modules.news.stories.story_db_repository import StoryDbRepository +from kwai.modules.portal.get_stories import GetStories, GetStoriesCommand +from kwai.modules.portal.stories.story_db_repository import StoryDbRepository router = APIRouter() diff --git a/backend/src/kwai/api/v1/portal/schemas/story.py b/backend/src/kwai/api/v1/portal/schemas/story.py index f4d6056f2..d03b01ed7 100644 --- a/backend/src/kwai/api/v1/portal/schemas/story.py +++ b/backend/src/kwai/api/v1/portal/schemas/story.py @@ -3,7 +3,7 @@ from kwai.api.converter import MarkdownConverter from kwai.core import json_api -from kwai.modules.news.stories.story import Application, StoryEntity +from kwai.modules.portal.stories.story import Application, StoryEntity @json_api.resource(type_="applications") diff --git a/backend/src/kwai/modules/news/__init__.py b/backend/src/kwai/modules/news/__init__.py deleted file mode 100644 index d34b23c50..000000000 --- a/backend/src/kwai/modules/news/__init__.py +++ /dev/null @@ -1 +0,0 @@ -"""The news module is responsible for everything that relates to news.""" diff --git a/backend/src/kwai/modules/page/__init__.py b/backend/src/kwai/modules/page/__init__.py deleted file mode 100644 index 8ccbbd818..000000000 --- a/backend/src/kwai/modules/page/__init__.py +++ /dev/null @@ -1 +0,0 @@ -"""Package for the page module.""" diff --git a/backend/src/kwai/modules/page/get_page.py b/backend/src/kwai/modules/portal/get_page.py similarity index 81% rename from backend/src/kwai/modules/page/get_page.py rename to backend/src/kwai/modules/portal/get_page.py index 8257d8735..480ccb7bf 100644 --- a/backend/src/kwai/modules/page/get_page.py +++ b/backend/src/kwai/modules/portal/get_page.py @@ -1,8 +1,8 @@ """Module for the use case "Get Page".""" from dataclasses import dataclass -from kwai.modules.page.pages.page import PageEntity, PageIdentifier -from kwai.modules.page.pages.page_repository import PageRepository +from kwai.modules.portal.pages.page import PageEntity, PageIdentifier +from kwai.modules.portal.pages.page_repository import PageRepository @dataclass(kw_only=True, frozen=True, slots=True) diff --git a/backend/src/kwai/modules/page/get_pages.py b/backend/src/kwai/modules/portal/get_pages.py similarity index 93% rename from backend/src/kwai/modules/page/get_pages.py rename to backend/src/kwai/modules/portal/get_pages.py index 209acf11c..fa608a9c3 100644 --- a/backend/src/kwai/modules/page/get_pages.py +++ b/backend/src/kwai/modules/portal/get_pages.py @@ -2,7 +2,7 @@ from dataclasses import dataclass from kwai.core.domain.use_case import UseCaseBrowseResult -from kwai.modules.page.pages.page_repository import PageRepository +from kwai.modules.portal.pages.page_repository import PageRepository @dataclass(kw_only=True, frozen=True, slots=True) diff --git a/backend/src/kwai/modules/news/get_stories.py b/backend/src/kwai/modules/portal/get_stories.py similarity index 96% rename from backend/src/kwai/modules/news/get_stories.py rename to backend/src/kwai/modules/portal/get_stories.py index 87100e96a..b13454b0a 100644 --- a/backend/src/kwai/modules/news/get_stories.py +++ b/backend/src/kwai/modules/portal/get_stories.py @@ -3,7 +3,7 @@ from kwai.core.domain.use_case import UseCaseBrowseResult from kwai.core.domain.value_objects.unique_id import UniqueId -from kwai.modules.news.stories.story_repository import StoryRepository +from kwai.modules.portal.stories.story_repository import StoryRepository @dataclass(kw_only=True, frozen=True, slots=True) diff --git a/backend/src/kwai/modules/page/pages/__init__.py b/backend/src/kwai/modules/portal/pages/__init__.py similarity index 100% rename from backend/src/kwai/modules/page/pages/__init__.py rename to backend/src/kwai/modules/portal/pages/__init__.py diff --git a/backend/src/kwai/modules/page/pages/page.py b/backend/src/kwai/modules/portal/pages/page.py similarity index 100% rename from backend/src/kwai/modules/page/pages/page.py rename to backend/src/kwai/modules/portal/pages/page.py diff --git a/backend/src/kwai/modules/page/pages/page_db_query.py b/backend/src/kwai/modules/portal/pages/page_db_query.py similarity index 95% rename from backend/src/kwai/modules/page/pages/page_db_query.py rename to backend/src/kwai/modules/portal/pages/page_db_query.py index 7bfdc5b3b..2f3ab7f17 100644 --- a/backend/src/kwai/modules/page/pages/page_db_query.py +++ b/backend/src/kwai/modules/portal/pages/page_db_query.py @@ -7,9 +7,9 @@ from kwai.core.db.database_query import DatabaseQuery from kwai.core.db.rows import OwnersTable from kwai.core.domain.value_objects.unique_id import UniqueId -from kwai.modules.page.pages.page import PageIdentifier -from kwai.modules.page.pages.page_query import PageQuery -from kwai.modules.page.pages.page_tables import ( +from kwai.modules.portal.pages.page import PageIdentifier +from kwai.modules.portal.pages.page_query import PageQuery +from kwai.modules.portal.pages.page_tables import ( ApplicationsTable, PageContentsTable, PagesTable, diff --git a/backend/src/kwai/modules/page/pages/page_db_repository.py b/backend/src/kwai/modules/portal/pages/page_db_repository.py similarity index 92% rename from backend/src/kwai/modules/page/pages/page_db_repository.py rename to backend/src/kwai/modules/portal/pages/page_db_repository.py index 337309780..dfac51ffe 100644 --- a/backend/src/kwai/modules/page/pages/page_db_repository.py +++ b/backend/src/kwai/modules/portal/pages/page_db_repository.py @@ -7,14 +7,14 @@ from kwai.core.db.rows import OwnersTable from kwai.core.domain.entity import Entity from kwai.core.functions import async_groupby -from kwai.modules.page.pages.page import PageEntity, PageIdentifier -from kwai.modules.page.pages.page_db_query import PageDbQuery -from kwai.modules.page.pages.page_query import PageQuery -from kwai.modules.page.pages.page_repository import ( +from kwai.modules.portal.pages.page import PageEntity, PageIdentifier +from kwai.modules.portal.pages.page_db_query import PageDbQuery +from kwai.modules.portal.pages.page_query import PageQuery +from kwai.modules.portal.pages.page_repository import ( PageNotFoundException, PageRepository, ) -from kwai.modules.page.pages.page_tables import ( +from kwai.modules.portal.pages.page_tables import ( ApplicationsTable, PageContentRow, PageContentsTable, diff --git a/backend/src/kwai/modules/page/pages/page_query.py b/backend/src/kwai/modules/portal/pages/page_query.py similarity index 95% rename from backend/src/kwai/modules/page/pages/page_query.py rename to backend/src/kwai/modules/portal/pages/page_query.py index 40c63304f..941bde14c 100644 --- a/backend/src/kwai/modules/page/pages/page_query.py +++ b/backend/src/kwai/modules/portal/pages/page_query.py @@ -3,7 +3,7 @@ from kwai.core.domain.repository.query import Query from kwai.core.domain.value_objects.unique_id import UniqueId -from kwai.modules.page.pages.page import PageIdentifier +from kwai.modules.portal.pages.page import PageIdentifier class PageQuery(Query): diff --git a/backend/src/kwai/modules/page/pages/page_repository.py b/backend/src/kwai/modules/portal/pages/page_repository.py similarity index 93% rename from backend/src/kwai/modules/page/pages/page_repository.py rename to backend/src/kwai/modules/portal/pages/page_repository.py index 89e895ee0..94e54ef45 100644 --- a/backend/src/kwai/modules/page/pages/page_repository.py +++ b/backend/src/kwai/modules/portal/pages/page_repository.py @@ -2,8 +2,8 @@ from abc import ABC, abstractmethod from typing import AsyncIterator -from kwai.modules.page.pages.page import PageEntity, PageIdentifier -from kwai.modules.page.pages.page_query import PageQuery +from kwai.modules.portal.pages.page import PageEntity, PageIdentifier +from kwai.modules.portal.pages.page_query import PageQuery class PageNotFoundException(Exception): diff --git a/backend/src/kwai/modules/page/pages/page_tables.py b/backend/src/kwai/modules/portal/pages/page_tables.py similarity index 97% rename from backend/src/kwai/modules/page/pages/page_tables.py rename to backend/src/kwai/modules/portal/pages/page_tables.py index d6323dba8..0214236d1 100644 --- a/backend/src/kwai/modules/page/pages/page_tables.py +++ b/backend/src/kwai/modules/portal/pages/page_tables.py @@ -8,7 +8,7 @@ from kwai.core.domain.value_objects.local_timestamp import LocalTimestamp from kwai.core.domain.value_objects.text import LocaleText from kwai.core.domain.value_objects.traceable_time import TraceableTime -from kwai.modules.page.pages.page import Application, PageEntity, PageIdentifier +from kwai.modules.portal.pages.page import Application, PageEntity, PageIdentifier @dataclass(kw_only=True, frozen=True, slots=True) diff --git a/backend/src/kwai/modules/news/stories/__init__.py b/backend/src/kwai/modules/portal/stories/__init__.py similarity index 100% rename from backend/src/kwai/modules/news/stories/__init__.py rename to backend/src/kwai/modules/portal/stories/__init__.py diff --git a/backend/src/kwai/modules/news/stories/story.py b/backend/src/kwai/modules/portal/stories/story.py similarity index 100% rename from backend/src/kwai/modules/news/stories/story.py rename to backend/src/kwai/modules/portal/stories/story.py diff --git a/backend/src/kwai/modules/news/stories/story_db_query.py b/backend/src/kwai/modules/portal/stories/story_db_query.py similarity index 96% rename from backend/src/kwai/modules/news/stories/story_db_query.py rename to backend/src/kwai/modules/portal/stories/story_db_query.py index cbdbd890a..e79d80c2f 100644 --- a/backend/src/kwai/modules/news/stories/story_db_query.py +++ b/backend/src/kwai/modules/portal/stories/story_db_query.py @@ -8,9 +8,9 @@ from kwai.core.db.database_query import DatabaseQuery from kwai.core.db.rows import OwnersTable from kwai.core.domain.value_objects.unique_id import UniqueId -from kwai.modules.news.stories.story import StoryIdentifier -from kwai.modules.news.stories.story_query import StoryQuery -from kwai.modules.news.stories.story_tables import ( +from kwai.modules.portal.stories.story import StoryIdentifier +from kwai.modules.portal.stories.story_query import StoryQuery +from kwai.modules.portal.stories.story_tables import ( ApplicationsTable, StoriesTable, StoryContentsTable, diff --git a/backend/src/kwai/modules/news/stories/story_db_repository.py b/backend/src/kwai/modules/portal/stories/story_db_repository.py similarity index 92% rename from backend/src/kwai/modules/news/stories/story_db_repository.py rename to backend/src/kwai/modules/portal/stories/story_db_repository.py index aa712d55b..1080fbece 100644 --- a/backend/src/kwai/modules/news/stories/story_db_repository.py +++ b/backend/src/kwai/modules/portal/stories/story_db_repository.py @@ -6,14 +6,14 @@ from kwai.core.db.database import Database from kwai.core.db.rows import OwnersTable from kwai.core.domain.entity import Entity -from kwai.modules.news.stories.story import StoryEntity, StoryIdentifier -from kwai.modules.news.stories.story_db_query import StoryDbQuery -from kwai.modules.news.stories.story_query import StoryQuery -from kwai.modules.news.stories.story_repository import ( +from kwai.modules.portal.stories.story import StoryEntity, StoryIdentifier +from kwai.modules.portal.stories.story_db_query import StoryDbQuery +from kwai.modules.portal.stories.story_query import StoryQuery +from kwai.modules.portal.stories.story_repository import ( StoryNotFoundException, StoryRepository, ) -from kwai.modules.news.stories.story_tables import ( +from kwai.modules.portal.stories.story_tables import ( ApplicationsTable, StoriesTable, StoryContentRow, diff --git a/backend/src/kwai/modules/news/stories/story_query.py b/backend/src/kwai/modules/portal/stories/story_query.py similarity index 97% rename from backend/src/kwai/modules/news/stories/story_query.py rename to backend/src/kwai/modules/portal/stories/story_query.py index 761edc2c7..a82d0d467 100644 --- a/backend/src/kwai/modules/news/stories/story_query.py +++ b/backend/src/kwai/modules/portal/stories/story_query.py @@ -3,7 +3,7 @@ from kwai.core.domain.repository.query import Query from kwai.core.domain.value_objects.unique_id import UniqueId -from kwai.modules.news.stories.story import StoryIdentifier +from kwai.modules.portal.stories.story import StoryIdentifier class StoryQuery(Query): diff --git a/backend/src/kwai/modules/news/stories/story_repository.py b/backend/src/kwai/modules/portal/stories/story_repository.py similarity index 93% rename from backend/src/kwai/modules/news/stories/story_repository.py rename to backend/src/kwai/modules/portal/stories/story_repository.py index 9ca7efda7..b90503b26 100644 --- a/backend/src/kwai/modules/news/stories/story_repository.py +++ b/backend/src/kwai/modules/portal/stories/story_repository.py @@ -2,8 +2,8 @@ from abc import ABC, abstractmethod from typing import AsyncIterator -from kwai.modules.news.stories.story import StoryEntity, StoryIdentifier -from kwai.modules.news.stories.story_query import StoryQuery +from kwai.modules.portal.stories.story import StoryEntity, StoryIdentifier +from kwai.modules.portal.stories.story_query import StoryQuery class StoryNotFoundException(Exception): diff --git a/backend/src/kwai/modules/news/stories/story_tables.py b/backend/src/kwai/modules/portal/stories/story_tables.py similarity index 98% rename from backend/src/kwai/modules/news/stories/story_tables.py rename to backend/src/kwai/modules/portal/stories/story_tables.py index f5a4b5369..407352cab 100644 --- a/backend/src/kwai/modules/news/stories/story_tables.py +++ b/backend/src/kwai/modules/portal/stories/story_tables.py @@ -9,7 +9,7 @@ from kwai.core.domain.value_objects.period import Period from kwai.core.domain.value_objects.text import LocaleText from kwai.core.domain.value_objects.traceable_time import TraceableTime -from kwai.modules.news.stories.story import ( +from kwai.modules.portal.stories.story import ( Application, Promotion, StoryEntity, diff --git a/backend/src/tests/modules/news/__init__.py b/backend/src/tests/modules/news/__init__.py deleted file mode 100644 index 0c32f2dba..000000000 --- a/backend/src/tests/modules/news/__init__.py +++ /dev/null @@ -1 +0,0 @@ -"""Package for tests of the news module.""" diff --git a/backend/src/tests/modules/page/__init__.py b/backend/src/tests/modules/page/__init__.py deleted file mode 100644 index 3e2c67da4..000000000 --- a/backend/src/tests/modules/page/__init__.py +++ /dev/null @@ -1 +0,0 @@ -"""Package for testing the page module.""" diff --git a/backend/src/tests/modules/page/conftest.py b/backend/src/tests/modules/portal/conftest.py similarity index 89% rename from backend/src/tests/modules/page/conftest.py rename to backend/src/tests/modules/portal/conftest.py index e79a721dc..b3148f298 100644 --- a/backend/src/tests/modules/page/conftest.py +++ b/backend/src/tests/modules/portal/conftest.py @@ -4,13 +4,13 @@ from kwai.core.db.database import Database from kwai.core.domain.value_objects.owner import Owner from kwai.core.domain.value_objects.text import DocumentFormat, Locale, LocaleText -from kwai.modules.page.pages.page import Application, PageEntity -from kwai.modules.page.pages.page_db_repository import PageDbRepository -from kwai.modules.page.pages.page_repository import PageRepository from kwai.modules.portal.applications.application import ApplicationEntity from kwai.modules.portal.applications.application_db_repository import ( ApplicationDbRepository, ) +from kwai.modules.portal.pages.page import Application, PageEntity +from kwai.modules.portal.pages.page_db_repository import PageDbRepository +from kwai.modules.portal.pages.page_repository import PageRepository @pytest.fixture(scope="module") diff --git a/backend/src/tests/modules/page/pages/__init__.py b/backend/src/tests/modules/portal/pages/__init__.py similarity index 100% rename from backend/src/tests/modules/page/pages/__init__.py rename to backend/src/tests/modules/portal/pages/__init__.py diff --git a/backend/src/tests/modules/page/pages/test_page_db_query.py b/backend/src/tests/modules/portal/pages/test_page_db_query.py similarity index 87% rename from backend/src/tests/modules/page/pages/test_page_db_query.py rename to backend/src/tests/modules/portal/pages/test_page_db_query.py index b3783a88d..95e69384c 100644 --- a/backend/src/tests/modules/page/pages/test_page_db_query.py +++ b/backend/src/tests/modules/portal/pages/test_page_db_query.py @@ -3,8 +3,8 @@ import pytest from kwai.core.db.database import Database -from kwai.modules.page.pages.page_db_query import PageDbQuery -from kwai.modules.page.pages.page_query import PageQuery +from kwai.modules.portal.pages.page_db_query import PageDbQuery +from kwai.modules.portal.pages.page_query import PageQuery @pytest.fixture diff --git a/backend/src/tests/modules/page/pages/test_page_db_repository.py b/backend/src/tests/modules/portal/pages/test_page_db_repository.py similarity index 90% rename from backend/src/tests/modules/page/pages/test_page_db_repository.py rename to backend/src/tests/modules/portal/pages/test_page_db_repository.py index 949c7dcb2..e59cdce4c 100644 --- a/backend/src/tests/modules/page/pages/test_page_db_repository.py +++ b/backend/src/tests/modules/portal/pages/test_page_db_repository.py @@ -1,8 +1,8 @@ """Module for testing the page database repository.""" from kwai.core.domain.entity import Entity -from kwai.modules.page.pages.page import PageEntity -from kwai.modules.page.pages.page_repository import PageRepository +from kwai.modules.portal.pages.page import PageEntity +from kwai.modules.portal.pages.page_repository import PageRepository async def test_create(repo: PageRepository, saved_page: PageEntity): diff --git a/backend/src/tests/modules/news/stories/__init__.py b/backend/src/tests/modules/portal/stories/__init__.py similarity index 100% rename from backend/src/tests/modules/news/stories/__init__.py rename to backend/src/tests/modules/portal/stories/__init__.py diff --git a/backend/src/tests/modules/news/stories/conftest.py b/backend/src/tests/modules/portal/stories/conftest.py similarity index 93% rename from backend/src/tests/modules/news/stories/conftest.py rename to backend/src/tests/modules/portal/stories/conftest.py index 7dc7ba2b8..2b2c1269a 100644 --- a/backend/src/tests/modules/news/stories/conftest.py +++ b/backend/src/tests/modules/portal/stories/conftest.py @@ -2,11 +2,11 @@ import pytest from kwai.core.db.database import Database -from kwai.modules.news.stories.story import Application from kwai.modules.portal.applications.application import ApplicationEntity from kwai.modules.portal.applications.application_db_repository import ( ApplicationDbRepository, ) +from kwai.modules.portal.stories.story import Application @pytest.fixture(scope="module") diff --git a/backend/src/tests/modules/news/stories/test_stories_db_query.py b/backend/src/tests/modules/portal/stories/test_stories_db_query.py similarity index 95% rename from backend/src/tests/modules/news/stories/test_stories_db_query.py rename to backend/src/tests/modules/portal/stories/test_stories_db_query.py index 65625a637..9af3bce9f 100644 --- a/backend/src/tests/modules/news/stories/test_stories_db_query.py +++ b/backend/src/tests/modules/portal/stories/test_stories_db_query.py @@ -2,7 +2,7 @@ import pytest from kwai.core.db.database import Database -from kwai.modules.news.stories.story_db_query import StoryDbQuery +from kwai.modules.portal.stories.story_db_query import StoryDbQuery pytestmark = pytest.mark.db diff --git a/backend/src/tests/modules/news/stories/test_stories_db_repository.py b/backend/src/tests/modules/portal/stories/test_stories_db_repository.py similarity index 91% rename from backend/src/tests/modules/news/stories/test_stories_db_repository.py rename to backend/src/tests/modules/portal/stories/test_stories_db_repository.py index 4862f2b91..08f630082 100644 --- a/backend/src/tests/modules/news/stories/test_stories_db_repository.py +++ b/backend/src/tests/modules/portal/stories/test_stories_db_repository.py @@ -5,12 +5,12 @@ from kwai.core.db.database import Database from kwai.core.domain.value_objects.owner import Owner from kwai.core.domain.value_objects.text import DocumentFormat, Locale, LocaleText -from kwai.modules.news.stories.story import ( +from kwai.modules.portal.stories.story import ( Application, StoryEntity, ) -from kwai.modules.news.stories.story_db_repository import StoryDbRepository -from kwai.modules.news.stories.story_repository import ( +from kwai.modules.portal.stories.story_db_repository import StoryDbRepository +from kwai.modules.portal.stories.story_repository import ( StoryNotFoundException, StoryRepository, ) diff --git a/backend/src/tests/modules/page/test_get_page.py b/backend/src/tests/modules/portal/test_get_page.py similarity index 67% rename from backend/src/tests/modules/page/test_get_page.py rename to backend/src/tests/modules/portal/test_get_page.py index c5a119068..7e0bd5c64 100644 --- a/backend/src/tests/modules/page/test_get_page.py +++ b/backend/src/tests/modules/portal/test_get_page.py @@ -1,7 +1,7 @@ """Module for testing the use case "Get Page".""" -from kwai.modules.page.get_page import GetPage, GetPageCommand -from kwai.modules.page.pages.page import PageEntity -from kwai.modules.page.pages.page_repository import PageRepository +from kwai.modules.portal.get_page import GetPage, GetPageCommand +from kwai.modules.portal.pages.page import PageEntity +from kwai.modules.portal.pages.page_repository import PageRepository async def test_get_page(repo: PageRepository, saved_page: PageEntity): diff --git a/backend/src/tests/modules/page/test_get_pages.py b/backend/src/tests/modules/portal/test_get_pages.py similarity index 70% rename from backend/src/tests/modules/page/test_get_pages.py rename to backend/src/tests/modules/portal/test_get_pages.py index fb36def01..3f7afae90 100644 --- a/backend/src/tests/modules/page/test_get_pages.py +++ b/backend/src/tests/modules/portal/test_get_pages.py @@ -1,8 +1,8 @@ """Module for testing the use case "Get Pages".""" -from kwai.modules.page.get_pages import GetPages, GetPagesCommand -from kwai.modules.page.pages.page import PageEntity -from kwai.modules.page.pages.page_repository import PageRepository +from kwai.modules.portal.get_pages import GetPages, GetPagesCommand +from kwai.modules.portal.pages.page import PageEntity +from kwai.modules.portal.pages.page_repository import PageRepository async def test_get_pages(repo: PageRepository, saved_page: PageEntity): diff --git a/backend/src/tests/modules/news/test_get_stories.py b/backend/src/tests/modules/portal/test_get_stories.py similarity index 78% rename from backend/src/tests/modules/news/test_get_stories.py rename to backend/src/tests/modules/portal/test_get_stories.py index 16aa22ec7..dec185806 100644 --- a/backend/src/tests/modules/news/test_get_stories.py +++ b/backend/src/tests/modules/portal/test_get_stories.py @@ -4,9 +4,9 @@ import pytest from kwai.core.db.database import Database -from kwai.modules.news.get_stories import GetStories, GetStoriesCommand -from kwai.modules.news.stories.story_db_repository import StoryDbRepository -from kwai.modules.news.stories.story_repository import StoryRepository +from kwai.modules.portal.get_stories import GetStories, GetStoriesCommand +from kwai.modules.portal.stories.story_db_repository import StoryDbRepository +from kwai.modules.portal.stories.story_repository import StoryRepository pytestmark = pytest.mark.db diff --git a/frontend/packages/kwai-date/src/index.ts b/frontend/packages/kwai-date/src/index.ts index 8fc13e2aa..8b612a02a 100644 --- a/frontend/packages/kwai-date/src/index.ts +++ b/frontend/packages/kwai-date/src/index.ts @@ -11,6 +11,7 @@ import customParseFormat from 'dayjs/plugin/customParseFormat.js'; // Set the locale import 'dayjs/locale/en.js'; import 'dayjs/locale/nl.js'; + dayjs.extend(utc); dayjs.extend(timezone); dayjs.extend(localizedFormat); @@ -66,8 +67,8 @@ export function createDatetime(value?: string, fmt: string = 'YYYY-MM-DD HH:mm:s return createDate(value, fmt); } -export function createDateTimeFromUTC(value: string, timezone: string, fmt: string = 'YYYY-MM-DD HH:mm:ss'): Readonly { - return wrapDayjs(dayjs.utc(value, fmt).tz(timezone)); +export function createDateTimeFromUTC(value: string, fmt: string = 'YYYY-MM-DD HH:mm:ss'): Readonly { + return wrapDayjs(dayjs.utc(value, fmt).tz()); } export function now(): Readonly {