first commit

This commit is contained in:
2026-10-03 13:40:26 +02:00
parent 732a5b5a16
commit 566f415fa7
555 changed files with 62704 additions and 0 deletions

View File

@@ -0,0 +1,99 @@
import { Module } from '@nestjs/common';
import { CqrsModule } from '@nestjs/cqrs';
import { MongooseModule } from '@nestjs/mongoose';
import { TypeOrmModule } from '@nestjs/typeorm';
import {
ChangeFeed,
FindActivityRepository,
FindCommentsRepository,
FindIssuesRepository,
FindProjectsRepository,
FindReleasesRepository,
IssueNumbersRepository,
ProjectKeysRepository,
ReleaseIssuesRepository,
ReleaseNamesRepository,
UpsertMaterializedActivityRepository,
UpsertMaterializedCommentRepository,
UpsertMaterializedIssueRepository,
UpsertMaterializedProjectRepository,
UpsertMaterializedReleaseRepository,
UserDirectory,
} from '@task-stream/api/tracker/application';
import { IdentityUserDirectory } from './identity/identity-user-directory';
import {
MongoFindActivityRepository,
MongoFindCommentsRepository,
MongoFindIssuesRepository,
MongoFindProjectsRepository,
MongoFindReleasesRepository,
} from './mongo/find.repositories';
import { READ_MODEL_SCHEMAS } from './mongo/read-model.schemas';
import {
MongoUpsertMaterializedActivityRepository,
MongoUpsertMaterializedCommentRepository,
MongoUpsertMaterializedIssueRepository,
MongoUpsertMaterializedProjectRepository,
MongoUpsertMaterializedReleaseRepository,
} from './mongo/upsert-materialized.repositories';
import { LOOKUP_ENTITIES } from './postgres/lookup.entities';
import {
PostgresIssueNumbersRepository,
PostgresProjectKeysRepository,
PostgresReleaseNamesRepository,
} from './postgres/lookup.repositories';
import { PostgresReleaseIssuesRepository } from './postgres/release-issues.repository';
import { RedisChangeFeed } from './realtime/redis-change-feed';
const PORTS = [
// Write side lookups → PostgreSQL (aggregates themselves live in the event store)
{ provide: ProjectKeysRepository, useClass: PostgresProjectKeysRepository },
{ provide: IssueNumbersRepository, useClass: PostgresIssueNumbersRepository },
{ provide: ReleaseNamesRepository, useClass: PostgresReleaseNamesRepository },
{
provide: ReleaseIssuesRepository,
useClass: PostgresReleaseIssuesRepository,
},
// Read side → MongoDB
{ provide: FindProjectsRepository, useClass: MongoFindProjectsRepository },
{ provide: FindIssuesRepository, useClass: MongoFindIssuesRepository },
{ provide: FindCommentsRepository, useClass: MongoFindCommentsRepository },
{ provide: FindReleasesRepository, useClass: MongoFindReleasesRepository },
{ provide: FindActivityRepository, useClass: MongoFindActivityRepository },
{
provide: UpsertMaterializedProjectRepository,
useClass: MongoUpsertMaterializedProjectRepository,
},
{
provide: UpsertMaterializedIssueRepository,
useClass: MongoUpsertMaterializedIssueRepository,
},
{
provide: UpsertMaterializedCommentRepository,
useClass: MongoUpsertMaterializedCommentRepository,
},
{
provide: UpsertMaterializedReleaseRepository,
useClass: MongoUpsertMaterializedReleaseRepository,
},
{
provide: UpsertMaterializedActivityRepository,
useClass: MongoUpsertMaterializedActivityRepository,
},
// Realtime → Redis pub/sub
{ provide: ChangeFeed, useClass: RedisChangeFeed },
// Identity context (anti-corruption layer)
{ provide: UserDirectory, useClass: IdentityUserDirectory },
];
/** Driven adapters of the tracker context. */
@Module({
imports: [
CqrsModule,
TypeOrmModule.forFeature(LOOKUP_ENTITIES),
MongooseModule.forFeature(READ_MODEL_SCHEMAS),
],
providers: PORTS,
exports: PORTS.map((port) => port.provide),
})
export class TrackerInfrastructureModule {}