Issue changes are recorded per field in the issue_change table, in the same transaction as the issue itself. The new history module exposes: - GET /api/issues/:issueId/history — change timeline grouped by save - GET /api/issues/stats/daily — created, status transitions and status snapshot per day, with time zone support The migration backfills history for existing issues. Setting a field to its current value no longer bumps updatedAt or emits issue.updated.
This commit is contained in:
1 parent
f44590b8ca
commit
cb29c7d2c4
26 files changed
+1026
-16
No files matched your search
@@ -0,0 +1,30 @@
|
||||
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 { ISSUE_HISTORY_REPOSITORY } from './domain/repositories/issue-history.repository.interface.js';
|
||||
import { IssueHistoryPrismaRepository } from './infrastructure/persistence/prisma/repositories/issue-history.prisma-repository.js';
|
||||
import { HistoryController } from './presentation/controllers/history.controller.js';
|
||||
import { GetIssueHistoryUseCase } from './application/use-cases/get-issue-history/get-issue-history.use-case.js';
|
||||
import { GetDailyIssueStatsUseCase } from './application/use-cases/get-daily-issue-stats/get-daily-issue-stats.use-case.js';
|
||||
|
||||
/**
|
||||
* Чтение истории изменений задач и статистика по ней. Пишет историю
|
||||
* issue-модуль (IssuePrismaRepository) — в одной транзакции с задачей;
|
||||
* этот модуль от issue зависит, issue о нём не знает.
|
||||
*/
|
||||
@Module({
|
||||
imports: [PrismaModule, IssueModule, UserModule],
|
||||
controllers: [HistoryController],
|
||||
providers: [
|
||||
GetIssueHistoryUseCase,
|
||||
GetDailyIssueStatsUseCase,
|
||||
{
|
||||
// Domain видит только интерфейс IIssueHistoryRepository,
|
||||
// конкретную реализацию (Prisma) подставляет DI-контейнер здесь
|
||||
provide: ISSUE_HISTORY_REPOSITORY,
|
||||
useClass: IssueHistoryPrismaRepository,
|
||||
},
|
||||
],
|
||||
})
|
||||
export class HistoryModule {}
|
||||
Reference in new issue
Block a user