managarten/services/mana-core-auth/src/feedback/feedback.controller.ts
Wuesteon 9b26caf5a1 🐛 fix(mana-core-auth): remove type-only imports from services and controllers
Fixed remaining NestJS dependency injection issues by converting type-only imports to regular imports for all injectable services used in controllers and service dependencies.

Changes:
- feedback.service.ts: Fixed AiService import (was causing "argument Function at index [1]" error)
- auth.controller.ts: Fixed BetterAuthService import
- feedback.controller.ts: Fixed FeedbackService import
- credits.controller.ts: Fixed CreditsService import
- settings.controller.ts: Fixed SettingsService import

Root cause: Type-only imports (`import { type X }`) are erased at compile time, causing NestJS to fail dependency injection at runtime. All injectable classes must use regular imports.

Verified locally: All modules initialize successfully without DI errors.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 22:58:45 +01:00

59 lines
1.7 KiB
TypeScript

import {
Controller,
Get,
Post,
Delete,
Body,
Param,
Query,
UseGuards,
Headers,
} from '@nestjs/common';
import { FeedbackService } from './feedback.service';
import { JwtAuthGuard } from '../common/guards/jwt-auth.guard';
import { OptionalAuthGuard } from '../common/guards/optional-auth.guard';
import { CurrentUser, type CurrentUserData } from '../common/decorators/current-user.decorator';
import { type CreateFeedbackDto, type FeedbackQueryDto } from './dto';
@Controller('feedback')
export class FeedbackController {
constructor(private readonly feedbackService: FeedbackService) {}
@Post()
@UseGuards(JwtAuthGuard)
async createFeedback(
@CurrentUser() user: CurrentUserData,
@Body() dto: CreateFeedbackDto,
@Headers('x-app-id') appIdHeader?: string
) {
const appId = appIdHeader || 'unknown';
return this.feedbackService.createFeedback(user.userId, appId, dto);
}
@Get('public')
@UseGuards(OptionalAuthGuard)
async getPublicFeedback(
@CurrentUser() user: CurrentUserData | null,
@Query() query: FeedbackQueryDto
) {
return this.feedbackService.getPublicFeedback(user?.userId || null, query);
}
@Get('my')
@UseGuards(JwtAuthGuard)
async getMyFeedback(@CurrentUser() user: CurrentUserData, @Query('appId') appId?: string) {
return this.feedbackService.getMyFeedback(user.userId, appId);
}
@Post(':id/vote')
@UseGuards(JwtAuthGuard)
async vote(@CurrentUser() user: CurrentUserData, @Param('id') feedbackId: string) {
return this.feedbackService.vote(user.userId, feedbackId);
}
@Delete(':id/vote')
@UseGuards(JwtAuthGuard)
async unvote(@CurrentUser() user: CurrentUserData, @Param('id') feedbackId: string) {
return this.feedbackService.unvote(user.userId, feedbackId);
}
}