Add router jinja template for code generation (#1031)

This commit is contained in:
Wu Clan
2026-01-23 10:39:47 +08:00
committed by GitHub
parent 0aa63ed6e6
commit f2b246089d
5 changed files with 16 additions and 1 deletions
@@ -0,0 +1,8 @@
from fastapi import APIRouter
from backend.app.{{ app_name }}.api.{{ api_version }}.{{ filename }} import router as {{ table_name }}_router
from backend.core.conf import settings
v1 = APIRouter(prefix=settings.FASTAPI_API_V1_PATH{% if tag %}, tags=['{{ tag }}']{% endif %})
v1.include_router({{ table_name }}_router, prefix='/{{ table_name.replace('_', '-') }}s')