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:
2026-10-08 13:52:43 +02:00
parent 75323115fb
commit d4da33d4e8
84 changed files with 4719 additions and 79 deletions

View File

@@ -4,6 +4,7 @@ import {
Delete,
Get,
Param,
ParseUUIDPipe,
Patch,
Post,
Put,
@@ -35,6 +36,7 @@ import { withoutNulls } from '../common/issue-input';
import {
AssignIssueDto,
ChangeStatusDto,
ChecklistItemBodyDto,
CommentBodyDto,
CreateIssueDto,
IssueSearchQueryDto,
@@ -42,13 +44,16 @@ import {
LinkTypeParamDto,
MyIssuesQueryDto,
PageQueryDto,
SetIssueParentDto,
SetIssueReleaseDto,
UpdateChecklistItemDto,
UpdateIssueDto,
} from './dto/requests.dto';
import {
ActivityDto,
CommandResultDto,
CommentPageDto,
EpicDto,
IssueDto,
IssuePageDto,
} from './dto/responses.dto';
@@ -139,6 +144,9 @@ export class IssuesController {
) {
const page = await this.issues.search(viewerOf(me), {
projectId: await this.refs.projectId(viewerOf(me), project),
parentId: query.parent
? await this.refs.issueId(viewerOf(me), query.parent)
: undefined,
statuses: query.status,
categories: query.category,
types: query.type,
@@ -169,12 +177,40 @@ export class IssuesController {
@Param('project') project: string,
@Body() body: CreateIssueDto,
) {
const { parent, ...fields } = body;
return this.issues.create(me.id, {
...withoutNulls(body),
...withoutNulls(fields),
projectId: await this.refs.projectId(me.id, project),
parentId: parent ? await this.refs.issueId(me.id, parent) : null,
});
}
@Get('projects/:project/epics')
@ApiOptionalPireonAuth()
@PROJECT
@ApiOperation({
summary: 'Epics: top-level tickets that group others',
description:
'With the progress of the tickets hanging from each one (done or cancelled, and story points).',
})
@ApiOkResponse({ type: [EpicDto] })
@ApiReadErrors()
async epics(
@CurrentUser() me: User | undefined,
@Param('project') project: string,
) {
const epics = await this.issues.epics(
viewerOf(me),
await this.refs.projectId(viewerOf(me), project),
);
return Promise.all(
epics.map(async (epic) => ({
...epic,
issue: await this.refs.issueDto(epic.issue),
})),
);
}
@Get('issues/:issue')
@ApiOptionalPireonAuth()
@ISSUE
@@ -266,6 +302,82 @@ export class IssuesController {
);
}
@Put('issues/:issue/parent')
@ISSUE
@ApiOperation({
summary: 'Place the ticket under an epic or another ticket',
description:
'Same project, three levels at most (epic → ticket → subtask), no loops. null takes it back to the top.',
})
@ApiOkResponse({ type: CommandResultDto })
@ApiCommandErrors()
async setParent(
@CurrentUser() me: User,
@Param('issue') issue: string,
@Body() body: SetIssueParentDto,
) {
return this.issues.setParent(
me.id,
await this.refs.issueId(me.id, issue),
body.parent ? await this.refs.issueId(me.id, body.parent) : null,
);
}
@Post('issues/:issue/checklist')
@ISSUE
@ApiOperation({ summary: "Add a step to the ticket's checklist" })
@ApiCreatedResponse({ type: CommandResultDto })
@ApiCommandErrors()
async addChecklistItem(
@CurrentUser() me: User,
@Param('issue') issue: string,
@Body() body: ChecklistItemBodyDto,
) {
return this.issues.addChecklistItem(
me.id,
await this.refs.issueId(me.id, issue),
body.text,
);
}
@Patch('issues/:issue/checklist/:item')
@ISSUE
@ApiParam({ name: 'item', format: 'uuid' })
@ApiOperation({ summary: 'Reword, tick or untick a checklist step' })
@ApiOkResponse({ type: CommandResultDto })
@ApiCommandErrors()
async updateChecklistItem(
@CurrentUser() me: User,
@Param('issue') issue: string,
@Param('item', ParseUUIDPipe) item: string,
@Body() body: UpdateChecklistItemDto,
) {
return this.issues.updateChecklistItem(
me.id,
await this.refs.issueId(me.id, issue),
item,
body,
);
}
@Delete('issues/:issue/checklist/:item')
@ISSUE
@ApiParam({ name: 'item', format: 'uuid' })
@ApiOperation({ summary: 'Remove a checklist step' })
@ApiOkResponse({ type: CommandResultDto })
@ApiCommandErrors()
async removeChecklistItem(
@CurrentUser() me: User,
@Param('issue') issue: string,
@Param('item', ParseUUIDPipe) item: string,
) {
return this.issues.removeChecklistItem(
me.id,
await this.refs.issueId(me.id, issue),
item,
);
}
@Post('issues/:issue/links')
@ISSUE
@ApiOperation({