feat: migrate clients module to patients + add docs

This commit is contained in:
colinislit
2025-11-23 10:13:00 +01:00
parent 8e3925ea09
commit 6fcb9a0e7b
277 changed files with 9131 additions and 458 deletions

View File

@@ -0,0 +1,31 @@
import { redirect } from 'next/navigation';
import { NextRequest } from 'next/server';
/**
* Catch-all Redirect Route for /epd/clients/
*
* Redirects all /epd/clients/* routes to /epd/patients/* for backward compatibility
* This ensures that old bookmarks and links continue to work after migration.
*
* Preserves query parameters (e.g., ?tab=intake&search=test)
*/
export async function GET(
request: NextRequest,
{ params }: { params: Promise<{ path: string[] }> }
) {
const { path } = await params;
const searchParams = request.nextUrl.searchParams;
// Build new path with query parameters
const newPath = `/epd/patients/${path.join('/')}`;
const newUrl = new URL(newPath, request.url);
// Preserve all query parameters
searchParams.forEach((value, key) => {
newUrl.searchParams.set(key, value);
});
redirect(newUrl.toString());
}