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,82 @@
import { Injectable } from '@nestjs/common';
import { CommandBus, QueryBus } from '@nestjs/cqrs';
import {
ReleaseProgressReadModel,
ReleaseReadModel,
} from '@task-stream/api/tracker/domain';
import { ArchiveReleaseCommand } from './commands/archive-release.command';
import { CommandResult } from './commands/command-result';
import { CreateReleaseCommand } from './commands/create-release.command';
import { PublishReleaseCommand } from './commands/publish-release.command';
import { UpdateReleaseCommand } from './commands/update-release.command';
import { GetReleaseProgressQuery } from './queries/get-release-progress.query';
import { GetReleaseQuery } from './queries/get-release.query';
interface ReleaseDetails {
name?: string;
description?: string | null;
targetDate?: string | null;
}
@Injectable()
export class ReleasesService {
constructor(
private readonly commandBus: CommandBus,
private readonly queryBus: QueryBus,
) {}
create(
actorId: string,
input: ReleaseDetails & { projectId: string; name: string },
): Promise<CommandResult> {
return this.commandBus.execute(
new CreateReleaseCommand(
actorId,
input.projectId,
input.name,
input.description,
input.targetDate,
),
);
}
update(
actorId: string,
releaseId: string,
changes: ReleaseDetails,
): Promise<CommandResult> {
return this.commandBus.execute(
new UpdateReleaseCommand(actorId, releaseId, changes),
);
}
/** Ships the release; fails with unfinished tickets unless `force`. */
publish(
actorId: string,
releaseId: string,
force = false,
): Promise<CommandResult> {
return this.commandBus.execute(
new PublishReleaseCommand(actorId, releaseId, force),
);
}
archive(actorId: string, releaseId: string): Promise<CommandResult> {
return this.commandBus.execute(
new ArchiveReleaseCommand(actorId, releaseId),
);
}
findOne(viewerId: string, releaseId: string): Promise<ReleaseReadModel> {
return this.queryBus.execute(new GetReleaseQuery(viewerId, releaseId));
}
progress(
viewerId: string,
releaseId: string,
): Promise<ReleaseProgressReadModel> {
return this.queryBus.execute(
new GetReleaseProgressQuery(viewerId, releaseId),
);
}
}