Skip to content

Commit 40e43f8

Browse files
committed
Move routes to packages
1 parent 3f3b207 commit 40e43f8

11 files changed

Lines changed: 166 additions & 86 deletions

File tree

SESSION.md

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1 @@
11
# Session Restore Point
2-
3-
## Exact Stopping Point
4-
5-
`R4` is complete, `R5` is complete, and the first trends follow-on move is complete: newsletter ownership moved into `newsletters`, pipeline ownership moved into `pipeline`, `TopicCentroidSnapshot` ownership moved into `trends`, the paired state-only migrations are applied, and the focused checks are green.
6-
7-
The current shape intentionally leaves these compatibility seams in place:
8-
9-
- `core.pipeline` still owns the execution logic that creates and updates the moved rows
10-
- `trends.tasks` owns centroid recomputation behavior while `core.tasks` re-exports the moved task symbols for compatibility
11-
- `core.models`, `core.serializers`, and `core.admin` still re-export moved symbols for compatibility
12-
- `core.api` still provides shared project-route helpers that the moved app APIs import
13-
14-
## First Move Tomorrow
15-
16-
If work resumes here, start from the remaining compatibility decision and the broader trends build-out rather than another pipeline move:
17-
18-
- `core/pipeline.py` for the execution path that still mutates the moved pipeline rows
19-
- `trends/tasks.py` and `trends/` for the centroid workflow and the rest of the Phase 3 model set that should land there directly
20-
- any remaining temporary compatibility re-exports in `core.*` that we may want to retire later
21-
22-
If another move happens, keep using `SeparateDatabaseAndState` and keep the existing tables in place. Do not run a normal schema move.

content/api_urls.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
"""API route registration for content resources."""
2+
3+
from rest_framework_nested.routers import NestedSimpleRouter
4+
5+
from content.api import ContentViewSet, UserFeedbackViewSet
6+
7+
8+
def register_project_routes(project_router: NestedSimpleRouter) -> None:
9+
"""Register nested content and feedback endpoints."""
10+
11+
project_router.register(r"contents", ContentViewSet, basename="project-content")
12+
project_router.register(
13+
r"feedback", UserFeedbackViewSet, basename="project-feedback"
14+
)

core/api_urls.py

Lines changed: 29 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,42 @@
1+
"""Aggregate app-owned API route registrations under the public v1 surface."""
2+
13
from rest_framework.routers import DefaultRouter
24
from rest_framework_nested.routers import NestedSimpleRouter
35

4-
from content.api import ContentViewSet, UserFeedbackViewSet
5-
from entities.api import EntityCandidateViewSet, EntityViewSet
6-
from ingestion.api import IngestionRunViewSet
7-
from newsletters.api import IntakeAllowlistViewSet, NewsletterIntakeViewSet
8-
from pipeline.api import ReviewQueueViewSet, SkillResultViewSet
9-
from projects.api import (
10-
BlueskyCredentialsViewSet,
11-
ProjectConfigViewSet,
12-
ProjectInvitationViewSet,
13-
ProjectMembershipViewSet,
14-
ProjectViewSet,
15-
SourceConfigViewSet,
6+
from content.api_urls import register_project_routes as register_content_project_routes
7+
from entities.api_urls import (
8+
register_project_routes as register_entities_project_routes,
9+
)
10+
from ingestion.api_urls import (
11+
register_project_routes as register_ingestion_project_routes,
12+
)
13+
from newsletters.api_urls import (
14+
register_project_routes as register_newsletters_project_routes,
15+
)
16+
from pipeline.api_urls import (
17+
register_project_routes as register_pipeline_project_routes,
18+
)
19+
from projects.api_urls import (
20+
register_project_routes as register_projects_project_routes,
1621
)
17-
from trends.api import TopicCentroidSnapshotViewSet
22+
from projects.api_urls import (
23+
register_root_routes as register_projects_root_routes,
24+
)
25+
from trends.api_urls import register_project_routes as register_trends_project_routes
1826

1927
app_name = "api"
2028

2129
router = DefaultRouter()
22-
router.register("projects", ProjectViewSet, basename="project")
30+
register_projects_root_routes(router)
2331

2432
project_router = NestedSimpleRouter(router, r"projects", lookup="project")
25-
project_router.register(
26-
r"project-configs", ProjectConfigViewSet, basename="project-config"
27-
)
28-
project_router.register(
29-
r"memberships", ProjectMembershipViewSet, basename="project-membership"
30-
)
31-
project_router.register(
32-
r"invitations", ProjectInvitationViewSet, basename="project-invitation"
33-
)
34-
project_router.register(r"entities", EntityViewSet, basename="project-entity")
35-
project_router.register(
36-
r"entity-candidates",
37-
EntityCandidateViewSet,
38-
basename="project-entity-candidate",
39-
)
40-
project_router.register(r"contents", ContentViewSet, basename="project-content")
41-
project_router.register(
42-
r"skill-results", SkillResultViewSet, basename="project-skill-result"
43-
)
44-
project_router.register(r"feedback", UserFeedbackViewSet, basename="project-feedback")
45-
project_router.register(
46-
r"ingestion-runs", IngestionRunViewSet, basename="project-ingestion-run"
47-
)
48-
project_router.register(
49-
r"bluesky-credentials",
50-
BlueskyCredentialsViewSet,
51-
basename="project-bluesky-credentials",
52-
)
53-
project_router.register(
54-
r"intake-allowlist",
55-
IntakeAllowlistViewSet,
56-
basename="project-intake-allowlist",
57-
)
58-
project_router.register(
59-
r"newsletter-intakes",
60-
NewsletterIntakeViewSet,
61-
basename="project-newsletter-intake",
62-
)
63-
project_router.register(
64-
r"source-configs", SourceConfigViewSet, basename="project-source-config"
65-
)
66-
project_router.register(
67-
r"topic-centroid-snapshots",
68-
TopicCentroidSnapshotViewSet,
69-
basename="project-topic-centroid-snapshot",
70-
)
71-
project_router.register(
72-
r"review-queue", ReviewQueueViewSet, basename="project-review-queue"
73-
)
33+
register_projects_project_routes(project_router)
34+
register_entities_project_routes(project_router)
35+
register_content_project_routes(project_router)
36+
register_pipeline_project_routes(project_router)
37+
register_ingestion_project_routes(project_router)
38+
register_newsletters_project_routes(project_router)
39+
register_trends_project_routes(project_router)
7440

7541
urlpatterns = [
7642
*router.urls,

entities/api_urls.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""API route registration for entity resources."""
2+
3+
from rest_framework_nested.routers import NestedSimpleRouter
4+
5+
from entities.api import EntityCandidateViewSet, EntityViewSet
6+
7+
8+
def register_project_routes(project_router: NestedSimpleRouter) -> None:
9+
"""Register nested entity endpoints."""
10+
11+
project_router.register(r"entities", EntityViewSet, basename="project-entity")
12+
project_router.register(
13+
r"entity-candidates",
14+
EntityCandidateViewSet,
15+
basename="project-entity-candidate",
16+
)

frontend/tsconfig.tsbuildinfo

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

ingestion/api_urls.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"""API route registration for ingestion resources."""
2+
3+
from rest_framework_nested.routers import NestedSimpleRouter
4+
5+
from ingestion.api import IngestionRunViewSet
6+
7+
8+
def register_project_routes(project_router: NestedSimpleRouter) -> None:
9+
"""Register nested ingestion-run endpoints."""
10+
11+
project_router.register(
12+
r"ingestion-runs", IngestionRunViewSet, basename="project-ingestion-run"
13+
)

newsletters/api_urls.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
"""API route registration for newsletter intake resources."""
2+
3+
from rest_framework_nested.routers import NestedSimpleRouter
4+
5+
from newsletters.api import IntakeAllowlistViewSet, NewsletterIntakeViewSet
6+
7+
8+
def register_project_routes(project_router: NestedSimpleRouter) -> None:
9+
"""Register nested newsletter intake endpoints."""
10+
11+
project_router.register(
12+
r"intake-allowlist",
13+
IntakeAllowlistViewSet,
14+
basename="project-intake-allowlist",
15+
)
16+
project_router.register(
17+
r"newsletter-intakes",
18+
NewsletterIntakeViewSet,
19+
basename="project-newsletter-intake",
20+
)

pipeline/api_urls.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""API route registration for pipeline resources."""
2+
3+
from rest_framework_nested.routers import NestedSimpleRouter
4+
5+
from pipeline.api import ReviewQueueViewSet, SkillResultViewSet
6+
7+
8+
def register_project_routes(project_router: NestedSimpleRouter) -> None:
9+
"""Register nested skill-result and review endpoints."""
10+
11+
project_router.register(
12+
r"skill-results", SkillResultViewSet, basename="project-skill-result"
13+
)
14+
project_router.register(
15+
r"review-queue", ReviewQueueViewSet, basename="project-review-queue"
16+
)

projects/api_urls.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
"""API route registration for project-owned resources."""
2+
3+
from rest_framework.routers import DefaultRouter
4+
from rest_framework_nested.routers import NestedSimpleRouter
5+
6+
from projects.api import (
7+
BlueskyCredentialsViewSet,
8+
ProjectConfigViewSet,
9+
ProjectInvitationViewSet,
10+
ProjectMembershipViewSet,
11+
ProjectViewSet,
12+
SourceConfigViewSet,
13+
)
14+
15+
16+
def register_root_routes(router: DefaultRouter) -> None:
17+
"""Register top-level project endpoints."""
18+
19+
router.register("projects", ProjectViewSet, basename="project")
20+
21+
22+
def register_project_routes(project_router: NestedSimpleRouter) -> None:
23+
"""Register nested project-management endpoints."""
24+
25+
project_router.register(
26+
r"project-configs", ProjectConfigViewSet, basename="project-config"
27+
)
28+
project_router.register(
29+
r"memberships", ProjectMembershipViewSet, basename="project-membership"
30+
)
31+
project_router.register(
32+
r"invitations", ProjectInvitationViewSet, basename="project-invitation"
33+
)
34+
project_router.register(
35+
r"bluesky-credentials",
36+
BlueskyCredentialsViewSet,
37+
basename="project-bluesky-credentials",
38+
)
39+
project_router.register(
40+
r"source-configs", SourceConfigViewSet, basename="project-source-config"
41+
)

trends/api_urls.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
"""API route registration for trends resources."""
2+
3+
from rest_framework_nested.routers import NestedSimpleRouter
4+
5+
from trends.api import TopicCentroidSnapshotViewSet
6+
7+
8+
def register_project_routes(project_router: NestedSimpleRouter) -> None:
9+
"""Register nested trend observability endpoints."""
10+
11+
project_router.register(
12+
r"topic-centroid-snapshots",
13+
TopicCentroidSnapshotViewSet,
14+
basename="project-topic-centroid-snapshot",
15+
)

0 commit comments

Comments
 (0)