Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,16 @@
"lint:fix": "eslint \"src/**/*.ts\" --fix"
},
"dependencies": {
"@elevenlabs/elevenlabs-js": "^2.21.0",
"@nestjs/bullmq": "^10.2.1",
"@nestjs/common": "^10.0.0",
"@nestjs/config": "^4.0.2",
"@nestjs/core": "^10.0.0",
"@nestjs/jwt": "^11.0.1",
"@nestjs/platform-express": "^10.0.0",
"form-data": "^4.0.0",
"@repo/api": "workspace:*",
"@repo/email-templates": "workspace:*",
"@repo/supabase": "workspace:*",
"@repo/train-ai-worker": "workspace:*",
"@repo/validation": "workspace:*",
"@supabase/supabase-js": "^2.53.0",
"@tabler/icons-react": "^3.34.1",
Expand All @@ -53,6 +52,7 @@
"@repo/typescript-config": "workspace:*",
"@types/express": "^4.17.17",
"@types/node": "^20.3.1",
"@types/form-data": "^2.5.0",
"@types/supertest": "^6.0.0",
"jest": "^29.7.0",
"source-map-support": "^0.5.21",
Expand Down
4 changes: 3 additions & 1 deletion apps/api/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { AppController } from './app.controller';
import { TrainAiController } from './train-ai/train-ai.controller';
import { TrainAiModule } from './train-ai/train-ai.module';
import { AuthModule } from './auth/auth.module';
import { DubbingModule } from './dubbing/dubbing.module';

@Module({
imports: [
Expand All @@ -35,7 +36,8 @@ import { AuthModule } from './auth/auth.module';
}),
SupabaseModule,
TrainAiModule,
AuthModule
AuthModule,
DubbingModule
],
controllers: [AppController, TrainAiController],
providers: [AppService],
Expand Down
2 changes: 2 additions & 0 deletions apps/api/src/config/redis.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ export default registerAs('redis', () => ({
host: process.env.REDIS_HOST || 'localhost',
port: parseInt(process.env.REDIS_PORT, 10) || 6379,
password: process.env.REDIS_PASSWORD || undefined,
maxRetriesPerRequest: null, // Prevents BullMQ from crashing on Redis connection issues
enableReadyCheck: false,
}));
48 changes: 48 additions & 0 deletions apps/api/src/dubbing/dubbing.controller.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { Controller, Post, Body, Get, Delete, Param, Query, UseGuards, Req, Sse } from '@nestjs/common';
import { DubbingService } from './dubbing.service';
import { CreateDubInput } from '@repo/validation';
import { SupabaseAuthGuard } from 'src/guards/auth.guard';
import { Observable } from 'rxjs';
import { Request } from 'express';

interface AuthRequest extends Request {
user?: { id: string };
}

@Controller('dubbing')
export class DubbingController {
constructor(private readonly service: DubbingService) { }

@Post()
@UseGuards(SupabaseAuthGuard)
async create(@Req() req: AuthRequest, @Body() dto: CreateDubInput) {
return this.service.createDub(req.user!.id, dto);
}

@Sse('status/:projectId')
status(
@Param('projectId') projectId: string,
@Req() req: Request,
): Observable<MessageEvent> {
return this.service.streamDubbingStatus(projectId, req);
}

@Get()
@UseGuards(SupabaseAuthGuard)
async list(@Req() req: AuthRequest, @Query('page_size') pageSize: number = 100) {
return this.service.listDubs(req.user!.id, pageSize);
}

@Get(':id')
@UseGuards(SupabaseAuthGuard)
async get(@Req() req: AuthRequest, @Param('id') id: string) {
return this.service.getDub(req.user!.id, id);
}

@Delete(':id')
@UseGuards(SupabaseAuthGuard)
async delete(@Req() req: AuthRequest, @Param('id') id: string) {
await this.service.deleteDub(req.user!.id, id);
return { status: 'ok' };
}
}
11 changes: 11 additions & 0 deletions apps/api/src/dubbing/dubbing.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Module } from '@nestjs/common';
import { DubbingService } from './dubbing.service';
import { DubbingController } from './dubbing.controller';
import { SupabaseModule } from 'src/supabase/supabase.module';

@Module({
imports: [SupabaseModule],
providers: [DubbingService],
controllers: [DubbingController],
})
export class DubbingModule { }
Loading
Loading