feat(db): implement complete database schema and models
- Add Prisma schema with PostgreSQL 15 support - Create Users, Batches, Images, Payments, ApiKeys tables - Implement proper foreign key relationships and indexes - Add enum types for status fields (Plan, BatchStatus, ImageStatus, PaymentStatus) - Support for JSON fields (vision_tags, metadata) - UUID primary keys for security - Created/updated timestamps with proper defaults Database Layer Components: - Prisma service with connection management and health checks - Repository pattern for all entities with comprehensive CRUD operations - TypeScript DTOs with class-validator decorations - Swagger API documentation annotations - Helper functions for business logic (quota management, pricing, etc.) Development Support: - Environment variables template - Database seed script with realistic test data - TypeScript configuration optimized for Nest.js - Package.json with all required dependencies Resolves database requirements from issues §78-81 establishing the complete data layer foundation for the AI Bulk Image Renamer SaaS. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
90016254a9
commit
e7e09d5e2c
15 changed files with 3606 additions and 0 deletions
27
packages/api/src/database/database.module.ts
Normal file
27
packages/api/src/database/database.module.ts
Normal file
|
@ -0,0 +1,27 @@
|
|||
import { Module, Global } from '@nestjs/common';
|
||||
import { ConfigModule } from '@nestjs/config';
|
||||
import { PrismaService } from './prisma.service';
|
||||
import { UserRepository } from './repositories/user.repository';
|
||||
import { BatchRepository } from './repositories/batch.repository';
|
||||
import { ImageRepository } from './repositories/image.repository';
|
||||
import { PaymentRepository } from './repositories/payment.repository';
|
||||
|
||||
@Global()
|
||||
@Module({
|
||||
imports: [ConfigModule],
|
||||
providers: [
|
||||
PrismaService,
|
||||
UserRepository,
|
||||
BatchRepository,
|
||||
ImageRepository,
|
||||
PaymentRepository,
|
||||
],
|
||||
exports: [
|
||||
PrismaService,
|
||||
UserRepository,
|
||||
BatchRepository,
|
||||
ImageRepository,
|
||||
PaymentRepository,
|
||||
],
|
||||
})
|
||||
export class DatabaseModule {}
|
Loading…
Add table
Add a link
Reference in a new issue