cherry-studio/src/main/data/README.md
fullex 819c209821 docs(data): update README and remove outdated API design guidelines
- Revised the README files for shared data and main data layers to improve clarity and structure.
- Consolidated documentation on shared data types and API types, removing the now-deleted `api-design-guidelines.md`.
- Streamlined directory structure descriptions and updated links to relevant documentation.
- Enhanced quick reference sections for better usability and understanding of the data architecture.
2025-12-29 17:15:06 +08:00

1.6 KiB

Main Data Layer

This directory contains the main process data management implementation.

Documentation

Directory Structure

src/main/data/
├── api/                       # Data API framework
│   ├── core/                  # ApiServer, MiddlewareEngine, adapters
│   └── handlers/              # API endpoint implementations
├── services/                  # Business logic layer
├── repositories/              # Data access layer (selective usage)
├── db/                        # Database layer
│   ├── schemas/               # Drizzle table definitions
│   ├── seeding/               # Database initialization
│   └── DbService.ts           # Database connection management
├── migration/                 # Data migration system
├── CacheService.ts            # Cache management
├── DataApiService.ts          # API coordination
└── PreferenceService.ts       # User preferences

Quick Reference

Adding New API Endpoints

  1. Define schema in @shared/data/api/schemas/
  2. Implement handler in api/handlers/
  3. Create business service in services/
  4. Create repository in repositories/ (if complex domain)

Database Commands

# Generate migrations
yarn db:migrations:generate