feat: epics, subtasks and checklists
Tickets can hang from another one of the same project, three levels deep at most (epic → ticket → subtask). The ticket page lists its subtasks with their progress, creates new ones and moves the ticket under an epic; a new Épicas tab shows every epic and how far it has got. Each ticket also gets a checklist for the small steps that don't deserve a ticket. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -140,6 +140,13 @@ export class CreateIssueInput extends IssueFieldsInput {
|
||||
@Field(() => ID, { nullable: true }) @IsOptional() @IsUUID() releaseId?:
|
||||
| string
|
||||
| null;
|
||||
@Field(() => ID, {
|
||||
nullable: true,
|
||||
description: 'Epic or ticket of the same project the new one breaks down',
|
||||
})
|
||||
@IsOptional()
|
||||
@IsUUID()
|
||||
parentId?: string | null;
|
||||
}
|
||||
|
||||
@InputType()
|
||||
@@ -173,6 +180,25 @@ export class ChangeIssueStatusInput {
|
||||
reason?: string | null;
|
||||
}
|
||||
|
||||
@InputType()
|
||||
export class AddChecklistItemInput {
|
||||
@Field(() => ID) @IsUUID() issueId!: string;
|
||||
@Field() @IsString() @MinLength(1) @MaxLength(300) text!: string;
|
||||
}
|
||||
|
||||
@InputType()
|
||||
export class UpdateChecklistItemInput {
|
||||
@Field(() => ID) @IsUUID() issueId!: string;
|
||||
@Field(() => ID) @IsUUID() itemId!: string;
|
||||
@Field({ nullable: true })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MinLength(1)
|
||||
@MaxLength(300)
|
||||
text?: string;
|
||||
@Field({ nullable: true }) @IsOptional() @IsBoolean() done?: boolean;
|
||||
}
|
||||
|
||||
@InputType()
|
||||
export class LinkIssuesInput {
|
||||
@Field(() => ID) @IsUUID() issueId!: string;
|
||||
@@ -216,6 +242,13 @@ export class IssueFilterInput {
|
||||
@IsOptional()
|
||||
@IsString({ each: true })
|
||||
labels?: string[];
|
||||
@Field(() => ID, {
|
||||
nullable: true,
|
||||
description: 'Only the tickets hanging from this one',
|
||||
})
|
||||
@IsOptional()
|
||||
@IsUUID()
|
||||
parentId?: string;
|
||||
@Field({ nullable: true, description: 'Matches key, title or description' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
|
||||
@@ -23,10 +23,12 @@ import {
|
||||
StatusCategory,
|
||||
} from '@task-stream/api/tracker/domain';
|
||||
import {
|
||||
AddChecklistItemInput,
|
||||
ChangeIssueStatusInput,
|
||||
CreateIssueInput,
|
||||
IssueFilterInput,
|
||||
LinkIssuesInput,
|
||||
UpdateChecklistItemInput,
|
||||
UpdateIssueInput,
|
||||
} from './inputs';
|
||||
import { withoutNulls } from '../common/issue-input';
|
||||
@@ -35,6 +37,7 @@ import {
|
||||
ActivityGql,
|
||||
CommandResultGql,
|
||||
CommentPageGql,
|
||||
EpicGql,
|
||||
IssueGql,
|
||||
IssuePageGql,
|
||||
} from './types';
|
||||
@@ -72,6 +75,18 @@ export class IssueResolver {
|
||||
});
|
||||
}
|
||||
|
||||
@OptionalAuth()
|
||||
@Query(() => [EpicGql], {
|
||||
description:
|
||||
"A project's epics: top-level tickets that group others, with the progress of those",
|
||||
})
|
||||
epics(
|
||||
@CurrentUser() me: User | undefined,
|
||||
@Args('projectId', { type: () => ID }) projectId: string,
|
||||
) {
|
||||
return this.issuesService.epics(viewerOf(me), projectId);
|
||||
}
|
||||
|
||||
@Query(() => IssuePageGql, {
|
||||
description:
|
||||
'Tickets across all my projects: assigned to me (default) or any (e.g. categories [QA])',
|
||||
@@ -238,6 +253,56 @@ export class IssueResolver {
|
||||
return this.issuesService.unlink(me.id, input);
|
||||
}
|
||||
|
||||
@Mutation(() => CommandResultGql, {
|
||||
description:
|
||||
'Place a ticket under an epic or another ticket of the same project (null: back to the top). Three levels at most: epic → ticket → subtask.',
|
||||
})
|
||||
setIssueParent(
|
||||
@CurrentUser() me: User,
|
||||
@Args('issueId', { type: () => ID }) issueId: string,
|
||||
@Args('parentId', { type: () => ID, nullable: true })
|
||||
parentId: string | null,
|
||||
) {
|
||||
return this.issuesService.setParent(me.id, issueId, parentId ?? null);
|
||||
}
|
||||
|
||||
@Mutation(() => CommandResultGql, {
|
||||
description: "Add a step to a ticket's checklist",
|
||||
})
|
||||
addChecklistItem(
|
||||
@CurrentUser() me: User,
|
||||
@Args('input') input: AddChecklistItemInput,
|
||||
) {
|
||||
return this.issuesService.addChecklistItem(
|
||||
me.id,
|
||||
input.issueId,
|
||||
input.text,
|
||||
);
|
||||
}
|
||||
|
||||
@Mutation(() => CommandResultGql, {
|
||||
description: 'Reword, tick or untick a checklist step',
|
||||
})
|
||||
updateChecklistItem(
|
||||
@CurrentUser() me: User,
|
||||
@Args('input') input: UpdateChecklistItemInput,
|
||||
) {
|
||||
const { issueId, itemId, text, done } = input;
|
||||
return this.issuesService.updateChecklistItem(me.id, issueId, itemId, {
|
||||
...(text != null && { text }),
|
||||
...(done != null && { done }),
|
||||
});
|
||||
}
|
||||
|
||||
@Mutation(() => CommandResultGql)
|
||||
removeChecklistItem(
|
||||
@CurrentUser() me: User,
|
||||
@Args('issueId', { type: () => ID }) issueId: string,
|
||||
@Args('itemId', { type: () => ID }) itemId: string,
|
||||
) {
|
||||
return this.issuesService.removeChecklistItem(me.id, issueId, itemId);
|
||||
}
|
||||
|
||||
@Mutation(() => CommandResultGql, {
|
||||
description: 'Put a ticket in a release (null removes it)',
|
||||
})
|
||||
|
||||
@@ -116,6 +116,23 @@ export class ReleaseRefGql {
|
||||
@Field() name!: string;
|
||||
}
|
||||
|
||||
@ObjectType('ChecklistItem', {
|
||||
description:
|
||||
'A step inside a ticket that does not deserve a ticket of its own',
|
||||
})
|
||||
export class ChecklistItemGql {
|
||||
@Field(() => ID) id!: string;
|
||||
@Field() text!: string;
|
||||
@Field() done!: boolean;
|
||||
}
|
||||
|
||||
@ObjectType('IssueParent', { description: 'The ticket another one hangs from' })
|
||||
export class IssueParentGql {
|
||||
@Field(() => ID) id!: string;
|
||||
@Field() key!: string;
|
||||
@Field() title!: string;
|
||||
}
|
||||
|
||||
@ObjectType('Issue')
|
||||
export class IssueGql {
|
||||
@Field(() => ID) id!: string;
|
||||
@@ -145,12 +162,37 @@ export class IssueGql {
|
||||
@Field(() => [AttachmentGql]) attachments!: AttachmentGql[];
|
||||
@Field(() => [UserRefGql], { description: 'People following the ticket' })
|
||||
watchers!: UserRefGql[];
|
||||
@Field(() => IssueParentGql, {
|
||||
nullable: true,
|
||||
description: 'The epic or ticket this one breaks down',
|
||||
})
|
||||
parent!: IssueParentGql | null;
|
||||
@Field(() => [ChecklistItemGql]) checklist!: ChecklistItemGql[];
|
||||
@Field(() => Int) commentCount!: number;
|
||||
@Field() createdAt!: string;
|
||||
@Field() updatedAt!: string;
|
||||
@Field(() => Int) version!: number;
|
||||
}
|
||||
|
||||
@ObjectType('ChildProgress', {
|
||||
description: 'How far the tickets hanging from one have got',
|
||||
})
|
||||
export class ChildProgressGql {
|
||||
@Field(() => Int) total!: number;
|
||||
@Field(() => Int, { description: 'Done or cancelled' }) finished!: number;
|
||||
@Field(() => Int) percent!: number;
|
||||
@Field(() => Int) storyPoints!: number;
|
||||
@Field(() => Int) finishedStoryPoints!: number;
|
||||
}
|
||||
|
||||
@ObjectType('Epic', {
|
||||
description: 'A top-level ticket that groups others, with their progress',
|
||||
})
|
||||
export class EpicGql {
|
||||
@Field(() => IssueGql) issue!: IssueGql;
|
||||
@Field(() => ChildProgressGql) progress!: ChildProgressGql;
|
||||
}
|
||||
|
||||
@ObjectType('IssuePage')
|
||||
export class IssuePageGql {
|
||||
@Field(() => [IssueGql]) items!: IssueGql[];
|
||||
|
||||
Reference in New Issue
Block a user