chore: hapus fitur materi (learning materials + RAG chat)

Hapus fitur materi seluruhnya dari GMW monorepo:

Backend:
- Hapus module materi/ (index.ts, materi.repository.ts, materi.schema.ts,
  materi.service.ts, ragClient.ts)
- Hapus materiRouter dari orpc/router.ts (imports, const, appRouter entry)
- Hapus pgMateriDocumentsTable + types dari shared/database/schema.ts

Frontend:
- Hapus route pages app/(dashboard)/materi/ (page, [id], chat, new)
- Hapus lib/api/materi.ts (oRPC client wrappers)
- Hapus lib/types/materi.ts + export dari index.ts
- Hapus nav item "Materi" dari lib/navigation.ts + unused BookOpen import

Scripts:
- Hapus scripts/add-materi-documents.sql
- Tambah scripts/drop-materi-documents.sql (ops DB cleanup)

Verification:
- Backend: npx tsc --noEmit — clean (exit 0)
- Frontend: npx tsc --noEmit — clean (exit 0)
- Grep: zero materi code references remaining (hanya di drop-materi-documents.sql)

RAG dependencies (messages/embed.ts, messages/qdrant.ts) tetap karena juga
dipakai oleh messages.service.ts.
This commit is contained in:
asepharyana
2026-08-20 22:50:11 +07:00
parent f750f39b50
commit eee332412f
17 changed files with 14 additions and 1332 deletions
@@ -596,44 +596,3 @@ export type DbRetentionPolicyInsert =
// Chatbot Messages
export type ChatbotMessage = typeof chatbotMessagesTable.$inferSelect;
export type ChatbotMessageInsert = typeof chatbotMessagesTable.$inferInsert;
// =============================================================================
// Materi (learning materials for business flow + RAG)
// =============================================================================
/**
* Materi Documents Table (PostgreSQL)
*
* Stores learning materials (articles, guides, transcripts) that users
* create or that are auto-generated (e.g. AI conversation summaries).
* Used by the RAG chat agent to ground answers in authoritative content.
*/
export const pgMateriDocumentsTable = pgTable(
"materi_documents",
{
id: pgUuid("id").primaryKey().defaultRandom(),
title: pgText("title").notNull(),
description: pgText("description"),
content: pgText("content").notNull(),
category: pgText("category").notNull().default("general"),
tags: pgJsonb("tags").notNull().default("[]"),
owner_user_id: pgText("owner_user_id").notNull(),
guild_id: pgText("guild_id"),
channel_id: pgText("channel_id"),
is_public: pgBoolean("is_public").notNull().default(true),
view_count: pgInteger("view_count").notNull().default(0),
created_at: pgBigint("created_at", { mode: "number" }).notNull(),
updated_at: pgBigint("updated_at", { mode: "number" }).notNull(),
},
(table) => ({
categoryIdx: pgIndex("idx_materi_category").on(table.category),
ownerIdx: pgIndex("idx_materi_owner").on(table.owner_user_id),
guildIdx: pgIndex("idx_materi_guild").on(table.guild_id),
searchIdx: pgIndex("idx_materi_search").on(table.title, table.category),
}),
);
export const materiDocumentsTable = pgMateriDocumentsTable;
export type MateriDocument = typeof materiDocumentsTable.$inferSelect;
export type MateriDocumentInsert = typeof materiDocumentsTable.$inferInsert;