How chito-cbr/database_navicat works
CPF Supply Chain & Inventory System is a role-based B2B inventory and sales application. Buyers browse a catalog and submit orders or bookings; salesmen handle customer relationships and field activity; supervisors oversee teams, visits, stock, and performance; admins manage approvals, master data, and the enterprise sales pipeline. Server actions provide application operations over shared database helpers, with session-based authentication and a separate AI insights capability. Several role subsystems are documented but their implementation was not sampled, so those links reflect README descriptions rather than inspected calls.
Main entry points: auth.ts Auth Actions · db-helpers.ts Database Helpers · page.tsx Buyer Catalog · ai.service.ts AI Insights
Components 24
Identity and Access
- Registration
app/signup/page.tsx - Login
app/login/page.tsx - Auth Actions
app/actions/auth.ts - JWT Session
lib/session.ts
Buyer and Sales
- Buyer Catalog
app/(roles)/buyer/catalog/page.tsx - Buyer Requests
app/actions/buyer-requests.ts - Product Actions
app/actions/products.ts - Sales Operations
app/actions/sales.ts - Salesman Dashboard
app/(roles)/salesman/dashboard/page.tsx
Operations and Oversight
- User Approvals
app/(roles)/admin/approvals/AdminApprovalClient.tsx - Admin Actions
app/actions/admin.ts - Catalog Management
app/actions/catalog.ts - Supervisor Operations
app/actions/supervisor-actions.ts - Dashboard Actions
app/actions/dashboard.ts
Data and Insights
- AI Endpoint
app/api/ai/route.ts - AI Insights
lib/ai/ai.service.ts - Analytics Tools
lib/ai/tools.ts - Database Helpers
lib/db-helpers.ts - TiDB Database
lib/db.ts
Other components
- Buyer
- Salesman
- Supervisor
- Administrator
- Google Gemini
Connections 22
- Buyer → Registration: registers
README.md - Registration → Auth Actions: submits to
app/signup/page.tsx - Login → Auth Actions: submits to
app/login/page.tsx - Auth Actions → JWT Session: creates session
app/actions/auth.ts - Auth Actions → Database Helpers: queries
app/actions/auth.ts - Salesman → Salesman Dashboard: reviews activity
README.md - Buyer → Buyer Catalog: browses
README.md - Buyer Catalog → Product Actions: loads products
app/(roles)/buyer/catalog/page.tsx - Buyer Catalog → Buyer Requests: submits request
app/(roles)/buyer/catalog/page.tsx - Buyer → Buyer Requests: books orders
README.md - Salesman → Sales Operations: handles sales
README.md - Supervisor → Supervisor Operations: oversees team
README.md - Administrator → User Approvals: reviews accounts
README.md - User Approvals → Admin Actions: approves or rejects
app/(roles)/admin/approvals/AdminApprovalClient.tsx - Administrator → Catalog Management: manages catalog
README.md - Administrator → Dashboard Actions: views enterprise metrics
- AI Endpoint → AI Insights: calls
app/api/ai/route.ts - AI Insights → Analytics Tools: queries insights
lib/ai/ai.service.ts - AI Insights → Google Gemini: asks fallback
lib/ai/ai.service.ts - Analytics Tools → Database Helpers: reads data
lib/ai/tools.ts - Auth Actions → Database Helpers: uses queries
app/actions/auth.ts - Database Helpers → TiDB Database: executes SQL
lib/db-helpers.ts