Files
ulitka/src/modules/comment/comment.module.ts
T
vadimandClaude Opus 5.5 60fb39f98f Add attachments to comments
- CommentAttachment link table (comment <-> file) + migration
- fileIds in create/update comment; update replaces the whole set,
  synced in one transaction with the comment
- CommentDto.attachments; empty for deleted comments
- Soft delete drops attachments so GC can collect the files
- Max 10 files per comment, ordered by upload time (uuid v7)
- Registers comments as a file owner
- Rename CommentAuthorExpanderService -> CommentExpanderService
  (expands authors and files)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 09:18:08 +03:00

41 lines
2.2 KiB
TypeScript

import { Module } from '@nestjs/common';
import { PrismaModule } from '../../common/prisma-adapter/prisma.module.js';
import { IssueModule } from '../issue/issue.module.js';
import { UserModule } from '../user/user.module.js';
import { FileModule } from '../file/file.module.js';
import { COMMENT_REPOSITORY } from './domain/repositories/comment.repository.interface.js';
import { CommentPrismaRepository } from './infrastructure/persistence/prisma/repositories/comment.prisma-repository.js';
import { CommentController } from './presentation/controllers/comment.controller.js';
import { CreateCommentUseCase } from './application/use-cases/create-comment/create-comment.use-case.js';
import { ListCommentsUseCase } from './application/use-cases/list-comments/list-comments.use-case.js';
import { UpdateCommentUseCase } from './application/use-cases/update-comment/update-comment.use-case.js';
import { DeleteCommentUseCase } from './application/use-cases/delete-comment/delete-comment.use-case.js';
import { WatchIssueCommentsUseCase } from './application/use-cases/watch-issue-comments/watch-issue-comments.use-case.js';
import { CommentAccessService } from './application/services/comment-access.service.js';
import { CommentExpanderService } from './application/services/comment-expander.service.js';
import { CommentEventsService } from './application/services/comment-events.service.js';
import { CommentAttachmentFileOwnerService } from './application/services/comment-attachment-file-owner.service.js';
@Module({
imports: [PrismaModule, IssueModule, UserModule, FileModule],
controllers: [CommentController],
providers: [
CreateCommentUseCase,
ListCommentsUseCase,
UpdateCommentUseCase,
DeleteCommentUseCase,
WatchIssueCommentsUseCase,
CommentAccessService,
CommentExpanderService,
CommentEventsService,
CommentAttachmentFileOwnerService,
{
// Domain видит только интерфейс ICommentRepository,
// конкретную реализацию (Prisma) подставляет DI-контейнер здесь
provide: COMMENT_REPOSITORY,
useClass: CommentPrismaRepository,
},
],
})
export class CommentModule {}