Update project documentation for database integration

- Update README.md with database setup instructions and path alias usage
- Add comprehensive database connection and migration instructions
- Document TypeScript path aliases with clear usage examples
- Update .github/copilot-instructions.md with current project state
- Remove outdated TODOs related to database implementation
- Update Next Steps section to focus on UI implementation tasks
- Add guidelines for handling Prisma Decimal types with proper conversion
- Improve developer onboarding with clearer setup instructions
This commit is contained in:
GitHub Copilot
2025-05-06 12:17:11 +00:00
parent 9a43842513
commit 4eea71ae58
2 changed files with 85 additions and 40 deletions

View File

@@ -1,4 +1,4 @@
# My Bank App - Financial Transaction Manager
# Financial Transaction Manager
A web application for managing financial transactions across multiple bank accounts.
@@ -7,7 +7,7 @@ A web application for managing financial transactions across multiple bank accou
* **Purpose:** Provides a user interface for CRUD operations on financial transactions.
* **Technology:** Built with Astro, TypeScript, and plain CSS, utilizing Astro API routes.
* **Layout:** Features a two-column dashboard design with a sidebar for account selection/actions and a main area for transaction display.
* **Data Management:** Currently uses an in-memory data store (`src/data/store.ts`) accessed via API endpoints (`src/pages/api/`).
* **Data Management:** Uses Prisma ORM for database operations (`src/data/db.service.ts`), accessed via API endpoints (`src/pages/api/`).
* **Key Features (Implemented & Planned):** Account switching, transaction listing, adding, editing, and deleting transactions.
## Logs
@@ -33,6 +33,52 @@ The MCP server will automatically start when you open the project in a devcontai
### Database Setup
The project uses Prisma ORM for database operations. To set up the database:
1. Create a `.env` file in the project root with your database connection string:
```
DATABASE_URL="postgresql://username:password@localhost:5432/finance"
```
2. Run database migrations:
```bash
npx prisma migrate dev
```
3. Seed the database with initial data (optional):
```bash
npx prisma db seed
```
4. To view and manage your data visually:
```bash
npx prisma studio
```
## Path Aliases
This project uses TypeScript path aliases for cleaner imports. Instead of using relative paths like `../../../../data/db.service`, use the following aliases:
- `@/*` - Maps to `src/*`
- `@components/*` - Maps to `src/components/*`
- `@layouts/*` - Maps to `src/layouts/*`
- `@data/*` - Maps to `src/data/*`
- `@pages/*` - Maps to `src/pages/*`
- `@styles/*` - Maps to `src/styles/*`
- `@stores/*` - Maps to `src/stores/*`
- `@utils/*` - Maps to `src/utils.ts`
- `@types` - Maps to `src/types.ts`
Example:
```typescript
// ✅ DO use path aliases like this
import { transactionService } from '@data/db.service';
import type { Transaction } from '@types';
// ❌ DON'T use relative imports like this
import { transactionService } from '../../../../data/db.service';
```
## Development Container Setup
### GitHub Personal Access Token