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:
@@ -408,6 +408,14 @@ export class IssueSearchQueryDto extends PageQueryDto {
|
||||
@IsString({ each: true })
|
||||
label?: string[];
|
||||
|
||||
@ApiPropertyOptional({
|
||||
description: 'Only the tickets hanging from this one (id or key)',
|
||||
example: 'WEB-3',
|
||||
})
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
parent?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: 'Matches key, title or description' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@@ -501,6 +509,17 @@ export class CreateIssueDto extends IssueFieldsDto {
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
releaseId?: string | null;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
type: String,
|
||||
nullable: true,
|
||||
example: 'WEB-3',
|
||||
description:
|
||||
'Epic or ticket of the same project the new one breaks down (id or key)',
|
||||
})
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
parent?: string | null;
|
||||
}
|
||||
|
||||
export class UpdateIssueDto extends IssueFieldsDto {
|
||||
@@ -560,6 +579,41 @@ export class SetIssueReleaseDto {
|
||||
releaseId!: string | null;
|
||||
}
|
||||
|
||||
export class SetIssueParentDto {
|
||||
@ApiProperty({
|
||||
type: String,
|
||||
nullable: true,
|
||||
example: 'WEB-3',
|
||||
description:
|
||||
'Epic or ticket of the same project (id or key), or null to take it back to the top',
|
||||
})
|
||||
@ValidateIf((dto: SetIssueParentDto) => dto.parent !== null)
|
||||
@IsString()
|
||||
parent!: string | null;
|
||||
}
|
||||
|
||||
export class ChecklistItemBodyDto {
|
||||
@ApiProperty({ example: 'Actualizar el changelog', maxLength: 300 })
|
||||
@IsString()
|
||||
@MinLength(1)
|
||||
@MaxLength(300)
|
||||
text!: string;
|
||||
}
|
||||
|
||||
export class UpdateChecklistItemDto {
|
||||
@ApiPropertyOptional({ maxLength: 300 })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MinLength(1)
|
||||
@MaxLength(300)
|
||||
text?: string;
|
||||
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
done?: boolean;
|
||||
}
|
||||
|
||||
export class LinkIssueDto {
|
||||
@ApiProperty({ enum: IssueLinkType, enumName: 'IssueLinkType' })
|
||||
@IsEnum(IssueLinkType)
|
||||
|
||||
@@ -123,6 +123,18 @@ export class AttachmentDto {
|
||||
commentId!: string | null;
|
||||
}
|
||||
|
||||
export class ChecklistItemDto {
|
||||
@ApiProperty({ format: 'uuid' }) id!: string;
|
||||
@ApiProperty({ example: 'Actualizar el changelog' }) text!: string;
|
||||
@ApiProperty() done!: boolean;
|
||||
}
|
||||
|
||||
export class IssueParentDto {
|
||||
@ApiProperty({ format: 'uuid' }) id!: string;
|
||||
@ApiProperty({ example: 'WEB-3' }) key!: string;
|
||||
@ApiProperty({ example: 'Pago con tarjeta' }) title!: string;
|
||||
}
|
||||
|
||||
export class IssueDto {
|
||||
@ApiProperty({ format: 'uuid' }) id!: string;
|
||||
@ApiProperty({ format: 'uuid' }) projectId!: string;
|
||||
@@ -161,6 +173,13 @@ export class IssueDto {
|
||||
@ApiProperty({ type: [AttachmentDto] }) attachments!: AttachmentDto[];
|
||||
@ApiProperty({ type: [UserRefDto], description: 'People following it' })
|
||||
watchers!: UserRefDto[];
|
||||
@ApiProperty({
|
||||
type: IssueParentDto,
|
||||
nullable: true,
|
||||
description: 'The epic or ticket this one breaks down',
|
||||
})
|
||||
parent!: IssueParentDto | null;
|
||||
@ApiProperty({ type: [ChecklistItemDto] }) checklist!: ChecklistItemDto[];
|
||||
@ApiProperty() commentCount!: number;
|
||||
@ApiProperty({ format: 'date-time' }) createdAt!: string;
|
||||
@ApiProperty({ format: 'date-time' }) updatedAt!: string;
|
||||
@@ -233,6 +252,19 @@ export class CountByAssigneeDto {
|
||||
@ApiProperty() count!: number;
|
||||
}
|
||||
|
||||
export class ChildProgressDto {
|
||||
@ApiProperty() total!: number;
|
||||
@ApiProperty({ description: 'Done or cancelled' }) finished!: number;
|
||||
@ApiProperty({ minimum: 0, maximum: 100 }) percent!: number;
|
||||
@ApiProperty() storyPoints!: number;
|
||||
@ApiProperty() finishedStoryPoints!: number;
|
||||
}
|
||||
|
||||
export class EpicDto {
|
||||
@ApiProperty({ type: IssueDto }) issue!: IssueDto;
|
||||
@ApiProperty({ type: ChildProgressDto }) progress!: ChildProgressDto;
|
||||
}
|
||||
|
||||
export class ReleaseProgressDto {
|
||||
@ApiProperty() total!: number;
|
||||
@ApiProperty() finished!: number;
|
||||
|
||||
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user