refactor: large codebase cleanup - consolidate schemas, migrate to Drizzle ORM, extract frontend components, modernize Docker builds
Build & Deploy / build-and-push (discord-gateway) (push) Failing after 2m22s
Build & Deploy / build-and-push (backend) (push) Failing after 3m22s
Build & Deploy / build-and-push (proxy) (push) Successful in 1m36s
Build & Deploy / deploy (push) Skipped

- Consolidate all DB schema definitions into packages/shared as single source of truth
- Migrate backend from raw SQL to Drizzle ORM across all modules
- Extract frontend inline UI into separate component files
- Refactor discord-gateway circuitBreaker into conversationState + moderationState
- Convert messageStore to Proxy singleton pattern
- Add validateBody/validateQuery middleware + Zod schemas for API endpoints
- Modernize Docker builds with multi-stage + pnpm deploy
- Migrate CI/CD from deployment to image-based pipeline
- Remove 60+ unused/dead files (~15K lines)
- Update color scheme from sky-blue to teal-cyan
- Move DB connection management to @bete/shared/database

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Developer
2026-07-27 21:54:31 +07:00
co-authored by Claude Opus 4.8
parent 63f21513bd
commit 5802d02e29
223 changed files with 11499 additions and 13350 deletions
+1
View File
@@ -2,6 +2,7 @@ export { chatbotApi } from "./chatbot";
export { ApiError, api, apiRequest } from "./client";
export { configApi } from "./config";
export { dashboardApi } from "./dashboard";
export { mediaApi } from "./media";
export { messagesApi } from "./messages";
export { recordingsApi } from "./recordings";
export { uiStateApi } from "./ui-state";
+12
View File
@@ -0,0 +1,12 @@
import type { MediaState } from "@/lib/types";
import { api } from "./client";
export const mediaApi = {
getStatus: () => api.get<MediaState>("/api/media/status"),
queue: (source: string, mode: string) =>
api.post<MediaState>("/api/media/queue", { source, mode }),
skip: () => api.post<MediaState>("/api/media/skip", {}),
stop: () => api.post<MediaState>("/api/media/stop", {}),
volume: (volume: number) =>
api.post<MediaState>("/api/media/volume", { volume }),
};
+1 -10
View File
@@ -1,4 +1,4 @@
import type { Channel, Guild, MediaState, VoiceStatus } from "@/lib/types";
import type { Channel, Guild, VoiceStatus } from "@/lib/types";
import { api } from "./client";
export const voiceApi = {
@@ -18,13 +18,4 @@ export const voiceApi = {
api.post<{ success: boolean; command: string }>("/api/voice/command", {
command,
}),
// Media
getMediaStatus: () => api.get<MediaState>("/api/media/status"),
mediaQueue: (source: string, mode: string) =>
api.post<MediaState>("/api/media/queue", { source, mode }),
mediaSkip: () => api.post<MediaState>("/api/media/skip", {}),
mediaStop: () => api.post<MediaState>("/api/media/stop", {}),
mediaVolume: (volume: number) =>
api.post<MediaState>("/api/media/volume", { volume }),
};
+7 -2
View File
@@ -1,5 +1,4 @@
import {
BarChart3,
Headphones,
LayoutDashboard,
type LucideIcon,
@@ -7,6 +6,7 @@ import {
Mic,
Music,
Search,
Settings,
} from "lucide-react";
export interface NavItem {
@@ -60,7 +60,7 @@ export const navItems: NavItem[] = [
{
href: "/settings",
label: "Settings",
icon: BarChart3,
icon: Settings,
matchPrefix: "/settings",
},
];
@@ -73,3 +73,8 @@ export const mobileNavItems: NavItem[] = navItems.filter((item) =>
);
export type NavItemId = (typeof navItems)[number]["href"];
export function isActivePath(pathname: string, matchPrefix: string): boolean {
if (matchPrefix === "/dashboard") return pathname === "/dashboard";
return pathname.startsWith(matchPrefix);
}
+8
View File
@@ -0,0 +1,8 @@
import type { WsEventType } from "./ws/types";
export type WsHook = {
on: <E extends WsEventType>(
eventType: E,
handler: (data: unknown) => void,
) => () => void;
};