Refactoring

* Refactor workspace membership system
* Create setup endpoint
* Use Passport.js
* Several updates and fixes
This commit is contained in:
Philipinho
2024-03-16 22:58:12 +00:00
parent b42fe48e9b
commit a821e37028
87 changed files with 2703 additions and 2307 deletions

View File

@ -9,16 +9,15 @@ import {
import { CommentService } from './comment.service';
import { CreateCommentDto } from './dto/create-comment.dto';
import { UpdateCommentDto } from './dto/update-comment.dto';
import { JwtGuard } from '../auth/guards/jwt.guard';
import { CommentsInput, SingleCommentInput } from './dto/comments.input';
import { ResolveCommentDto } from './dto/resolve-comment.dto';
import { WorkspaceService } from '../workspace/services/workspace.service';
import { AuthUser } from '../../decorators/auth-user.decorator';
import { User } from '../user/entities/user.entity';
import { CurrentWorkspace } from '../../decorators/current-workspace.decorator';
import { AuthWorkspace } from '../../decorators/auth-workspace.decorator';
import { Workspace } from '../workspace/entities/workspace.entity';
import { JwtAuthGuard } from '../../guards/jwt-auth.guard';
@UseGuards(JwtGuard)
@UseGuards(JwtAuthGuard)
@Controller('comments')
export class CommentController {
constructor(private readonly commentService: CommentService) {}
@ -28,7 +27,7 @@ export class CommentController {
async create(
@Body() createCommentDto: CreateCommentDto,
@AuthUser() user: User,
@CurrentWorkspace() workspace: Workspace,
@AuthWorkspace() workspace: Workspace,
) {
return this.commentService.create(user.id, workspace.id, createCommentDto);
}
@ -40,7 +39,7 @@ export class CommentController {
}
@HttpCode(HttpStatus.OK)
@Post('view')
@Post('info')
findOne(@Body() input: SingleCommentInput) {
return this.commentService.findWithCreator(input.id);
}

View File

@ -3,12 +3,11 @@ import { CommentService } from './comment.service';
import { CommentController } from './comment.controller';
import { CommentRepository } from './repositories/comment.repository';
import { TypeOrmModule } from '@nestjs/typeorm';
import { AuthModule } from '../auth/auth.module';
import { Comment } from './entities/comment.entity';
import { PageModule } from '../page/page.module';
@Module({
imports: [TypeOrmModule.forFeature([Comment]), AuthModule, PageModule],
imports: [TypeOrmModule.forFeature([Comment]), PageModule],
controllers: [CommentController],
providers: [CommentService, CommentRepository],
exports: [CommentService, CommentRepository],