feat: comments marked as decisions, on top of the ticket and searchable
Whoever can change the ticket flags a comment as a decision (new event
CommentDecisionMarkedEvent on the comment). The ticket page lists its
decisions above the description, with a link to the comment in the
conversation (`?comment=<id>` scrolls to it and points at it), and the
search palette finds them by their text across my projects.
API: markDecision / PUT-DELETE /api/comments/{id}/decision; Issue.decisions
and GET /api/issues/{issue}/decisions; decisions(projectId?, search) and
GET /api/projects/{project}/decisions, GET /api/me/decisions. MCP:
mark_decision, search_decisions, and get_issue includes them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,14 +1,22 @@
|
||||
import { CommandRunner } from '@task-stream/api/shared/application';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { QueryBus } from '@nestjs/cqrs';
|
||||
import { CommentReadModel } from '@task-stream/api/tracker/domain';
|
||||
import {
|
||||
CommentReadModel,
|
||||
DecisionReadModel,
|
||||
} from '@task-stream/api/tracker/domain';
|
||||
import { AddCommentCommand } from './commands/add-comment.command';
|
||||
import { CommandResult } from './commands/command-result';
|
||||
import { DeleteCommentCommand } from './commands/delete-comment.command';
|
||||
import { EditCommentCommand } from './commands/edit-comment.command';
|
||||
import { ReactToCommentCommand } from './commands/react-to-comment.command';
|
||||
import { MarkDecisionCommand } from './commands/mark-decision.command';
|
||||
import { Page } from './ports/find-issues.repository';
|
||||
import { GetCommentsQuery } from './queries/get-comments.query';
|
||||
import {
|
||||
GetIssueDecisionsQuery,
|
||||
SearchDecisionsQuery,
|
||||
} from './queries/decisions.query';
|
||||
|
||||
@Injectable()
|
||||
export class CommentsService {
|
||||
@@ -50,6 +58,35 @@ export class CommentsService {
|
||||
);
|
||||
}
|
||||
|
||||
/** Marks it as a decision of its ticket (`on`) or unmarks it: the team does. */
|
||||
markDecision(
|
||||
actorId: string,
|
||||
commentId: string,
|
||||
on: boolean,
|
||||
): Promise<CommandResult> {
|
||||
return this.commands.execute(
|
||||
new MarkDecisionCommand(actorId, commentId, on),
|
||||
);
|
||||
}
|
||||
|
||||
/** A ticket's decisions, oldest first. */
|
||||
decisions(
|
||||
viewerId: string | null,
|
||||
issueId: string,
|
||||
): Promise<CommentReadModel[]> {
|
||||
return this.queryBus.execute(new GetIssueDecisionsQuery(viewerId, issueId));
|
||||
}
|
||||
|
||||
/** Decisions by their text: of a project, or of all mine without one. */
|
||||
searchDecisions(
|
||||
viewerId: string | null,
|
||||
filter: { projectId?: string; search?: string; limit?: number },
|
||||
): Promise<DecisionReadModel[]> {
|
||||
return this.queryBus.execute(
|
||||
new SearchDecisionsQuery(viewerId, { limit: 20, ...filter }),
|
||||
);
|
||||
}
|
||||
|
||||
delete(actorId: string, commentId: string): Promise<CommandResult> {
|
||||
return this.commands.execute(new DeleteCommentCommand(actorId, commentId));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user