mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-22 18:46:42 +02:00
feat: improve chat UX and add optional auth for public feedback
- Add debounced search (200ms) in chat sidebar for better performance - Add toast notifications for conversation actions (archive, restore, delete, pin) - Add race condition protection when loading conversations - Add OptionalAuthGuard for public feedback endpoint (unauthenticated access) - Add backHref prop to PageHeader component for back navigation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
0893ed7daa
commit
c85cd4556c
7 changed files with 192 additions and 53 deletions
|
|
@ -11,15 +11,16 @@ import {
|
|||
} 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, CurrentUserData } from '../common/decorators/current-user.decorator';
|
||||
import { CreateFeedbackDto, FeedbackQueryDto } from './dto';
|
||||
|
||||
@Controller('feedback')
|
||||
@UseGuards(JwtAuthGuard)
|
||||
export class FeedbackController {
|
||||
constructor(private readonly feedbackService: FeedbackService) {}
|
||||
|
||||
@Post()
|
||||
@UseGuards(JwtAuthGuard)
|
||||
async createFeedback(
|
||||
@CurrentUser() user: CurrentUserData,
|
||||
@Body() dto: CreateFeedbackDto,
|
||||
|
|
@ -30,11 +31,16 @@ export class FeedbackController {
|
|||
}
|
||||
|
||||
@Get('public')
|
||||
async getPublicFeedback(@CurrentUser() user: CurrentUserData, @Query() query: FeedbackQueryDto) {
|
||||
return this.feedbackService.getPublicFeedback(user.userId, query);
|
||||
@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
|
||||
|
|
@ -43,11 +49,13 @@ export class FeedbackController {
|
|||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue