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,30 @@
import { CommandHandler, EventPublisher, ICommandHandler } from '@nestjs/cqrs';
import { ProjectFactory } from '@task-stream/api/tracker/domain';
import { ProjectKeysRepository } from '../ports/project-keys.repository';
import { CommandResult, ack } from './command-result';
import { CreateProjectCommand } from './create-project.command';
@CommandHandler(CreateProjectCommand)
export class CreateProjectCommandHandler
implements ICommandHandler<CreateProjectCommand>
{
constructor(
private readonly projectFactory: ProjectFactory,
private readonly projectKeys: ProjectKeysRepository,
private readonly eventPublisher: EventPublisher,
) {}
async execute(command: CreateProjectCommand): Promise<CommandResult> {
const project = this.projectFactory.create({
key: command.key,
name: command.name,
description: command.description,
ownerId: command.actorId,
});
await this.projectKeys.reserve(project.key, project.id);
this.eventPublisher.mergeObjectContext(project);
await project.commitAndWait();
return ack(project);
}
}