feat: an ordered backlog
A Backlog tab lists the tickets still to start in the order the team will take them; drag them, or use the arrows, to reorder. Moving a ticket only rewrites that ticket's rank, read from the event store, and board columns follow the same order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -33,6 +33,7 @@ import {
|
||||
import { TrackerStreamsRepository } from '../ports/tracker-streams.repository';
|
||||
import { IssueTree } from './issue-tree';
|
||||
import { SetIssueParentCommand } from './set-issue-parent.command';
|
||||
import { RankIssueCommand } from './rank-issue.command';
|
||||
import {
|
||||
AddChecklistItemCommand,
|
||||
UpdateChecklistItemCommand,
|
||||
@@ -372,6 +373,38 @@ describe('tracker commands (event sourced)', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('orders the backlog from the ranks in the event store', async () => {
|
||||
const { run, rehydrator } = await setup();
|
||||
const projectId = await projectWithTeam(run);
|
||||
const ids = [];
|
||||
for (const title of ['A', 'B', 'C'])
|
||||
ids.push(
|
||||
(
|
||||
await run(
|
||||
new CreateIssueCommand('dev', projectId, IssueType.TASK, title, {}),
|
||||
)
|
||||
).id,
|
||||
);
|
||||
const [a, b, c] = ids;
|
||||
|
||||
// C to the top, then B between C and A: C, B, A.
|
||||
await run(new RankIssueCommand('dev', c, null, a));
|
||||
await run(new RankIssueCommand('dev', b, c, a));
|
||||
const ranks = await Promise.all(
|
||||
[c, b, a].map(
|
||||
async (id) => (await rehydrator.rehydrate(id, Issue)).backlogRank,
|
||||
),
|
||||
);
|
||||
expect([...ranks].sort()).toEqual(ranks);
|
||||
// Neighbours given the wrong way round: the order changed meanwhile.
|
||||
await expect(run(new RankIssueCommand('dev', a, b, c))).rejects.toThrow(
|
||||
BusinessRuleError,
|
||||
);
|
||||
await expect(run(new RankIssueCommand('pm', a, null, c))).rejects.toThrow(
|
||||
ForbiddenError,
|
||||
);
|
||||
});
|
||||
|
||||
it('does not let viewers modify tickets', async () => {
|
||||
const { run } = await setup();
|
||||
const projectId = await projectWithTeam(run);
|
||||
|
||||
Reference in New Issue
Block a user