mirror of
https://github.com/Xevion/xevion.dev.git
synced 2026-02-01 06:26:38 -06:00
refactor: reorganize Rust codebase into modular handlers and database layers
- Split monolithic src/db.rs (1122 lines) into domain modules: projects, tags, settings - Extract API handlers from main.rs into separate handler modules by domain - Add proxy module for ISR/SSR coordination with Bun process - Introduce AppState for shared application context - Add utility functions for asset serving and request classification - Remove obsolete middleware/auth.rs in favor of session checks in handlers
This commit is contained in:
+5
-7
@@ -16,10 +16,7 @@ import type {
|
||||
// ============================================================================
|
||||
|
||||
// Client-side fetch wrapper for browser requests
|
||||
async function clientApiFetch<T>(
|
||||
path: string,
|
||||
init?: RequestInit,
|
||||
): Promise<T> {
|
||||
async function clientApiFetch<T>(path: string, init?: RequestInit): Promise<T> {
|
||||
const response = await fetch(path, {
|
||||
...init,
|
||||
credentials: "same-origin", // Include cookies for auth
|
||||
@@ -83,9 +80,10 @@ export async function deleteAdminProject(id: string): Promise<AdminProject> {
|
||||
|
||||
// Admin Tags API
|
||||
export async function getAdminTags(): Promise<AdminTagWithCount[]> {
|
||||
const tags = await clientApiFetch<
|
||||
Array<AdminTag & { project_count: number }>
|
||||
>("/api/tags");
|
||||
const tags =
|
||||
await clientApiFetch<Array<AdminTag & { project_count: number }>>(
|
||||
"/api/tags",
|
||||
);
|
||||
|
||||
// Transform snake_case to camelCase
|
||||
return tags.map((item) => ({
|
||||
|
||||
Reference in New Issue
Block a user