feat: per-project workflow settings, statistics and "my work" home
Per-project settings (owners/admins, «Configuración» tab):
- Statuses with category (TODO, IN_PROGRESS, QA, DONE, CANCELLED), colour and
"requires reason"; configurable transitions; ticket types (icon, colour) and
areas. Defaults are the previous fixed values; projects created before keep
them without migration.
- Values are archived, never deleted: tickets, history and statistics keep
referring to them. Validated in the domain (ProjectSettingsChangedEvent).
- Releases, board, tracking and "my work" use categories, so custom statuses
keep working. Status changes carry name/category metadata for history.
- GraphQL: status/type/area are strings (breaking for clients sending enum
literals); Project.settings, updateProjectSettings, statusCategory,
myIssues(categories). REST: PUT /projects/{project}/settings, category filters.
- Read model: statusCategory on issues (backfilled at startup).
Statistics («Estadísticas» tab):
- New issue_timeline projection; pure functions compute created vs resolved,
cumulative flow, cycle/lead time (avg + p85), throughput per person, QA
pass/fail and release burnup. GraphQL Project.analytics(days),
Release.burnup; REST /projects/{project}/analytics, /releases/{id}/burnup.
- Web: SVG charts with validated light/dark palette, crosshair tooltip,
keyboard navigation, legend and data table.
Home "Mi trabajo": my open tickets across projects grouped by category (QA
failures first), tickets waiting for QA, upcoming releases and "Ir a…".
Tests: domain/application specs, e2e scenario for settings and analytics,
facade tests. Docs, READMEs, schema.gql/openapi.json and Word/PDF updated.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
import { Field, ID, InputType, Int } from '@nestjs/graphql';
|
||||
import {
|
||||
IssueArea,
|
||||
IssueLinkType,
|
||||
IssuePriority,
|
||||
IssueStatus,
|
||||
IssueType,
|
||||
ProjectRole,
|
||||
StatusCategory,
|
||||
} from '@task-stream/api/tracker/domain';
|
||||
import { Type } from 'class-transformer';
|
||||
import {
|
||||
ArrayMaxSize,
|
||||
IsArray,
|
||||
IsBoolean,
|
||||
IsEnum,
|
||||
IsInt,
|
||||
@@ -22,8 +22,12 @@ import {
|
||||
MaxLength,
|
||||
Min,
|
||||
MinLength,
|
||||
ValidateNested,
|
||||
} from 'class-validator';
|
||||
|
||||
/** Ids of statuses, types and areas (checked against the project's settings). */
|
||||
const SETTING_ID = /^[A-Za-z][A-Za-z0-9_]{0,29}$/;
|
||||
|
||||
@InputType()
|
||||
export class CreateProjectInput {
|
||||
@Field({ description: '2-10 chars, e.g. "TS" → tickets TS-1, TS-2...' })
|
||||
@@ -74,10 +78,10 @@ abstract class IssueFieldsInput {
|
||||
@MaxLength(50000)
|
||||
description?: string | null;
|
||||
|
||||
@Field(() => IssueArea, { nullable: true })
|
||||
@Field(() => String, { nullable: true, description: 'An area id' })
|
||||
@IsOptional()
|
||||
@IsEnum(IssueArea)
|
||||
area?: IssueArea | null;
|
||||
@Matches(SETTING_ID)
|
||||
area?: string | null;
|
||||
|
||||
@Field(() => IssuePriority, { nullable: true })
|
||||
@IsOptional()
|
||||
@@ -114,7 +118,9 @@ abstract class IssueFieldsInput {
|
||||
@InputType()
|
||||
export class CreateIssueInput extends IssueFieldsInput {
|
||||
@Field(() => ID) @IsUUID() projectId!: string;
|
||||
@Field(() => IssueType) @IsEnum(IssueType) type!: IssueType;
|
||||
@Field({ description: 'A ticket type id' })
|
||||
@Matches(SETTING_ID)
|
||||
type!: string;
|
||||
@Field() @IsString() @MinLength(1) @MaxLength(255) title!: string;
|
||||
@Field(() => ID, { nullable: true }) @IsOptional() @IsString() assigneeId?:
|
||||
| string
|
||||
@@ -127,10 +133,10 @@ export class CreateIssueInput extends IssueFieldsInput {
|
||||
@InputType()
|
||||
export class UpdateIssueInput extends IssueFieldsInput {
|
||||
@Field(() => ID) @IsUUID() issueId!: string;
|
||||
@Field(() => IssueType, { nullable: true })
|
||||
@Field({ nullable: true })
|
||||
@IsOptional()
|
||||
@IsEnum(IssueType)
|
||||
type?: IssueType;
|
||||
@Matches(SETTING_ID)
|
||||
type?: string;
|
||||
@Field({ nullable: true })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@@ -142,10 +148,12 @@ export class UpdateIssueInput extends IssueFieldsInput {
|
||||
@InputType()
|
||||
export class ChangeIssueStatusInput {
|
||||
@Field(() => ID) @IsUUID() issueId!: string;
|
||||
@Field(() => IssueStatus) @IsEnum(IssueStatus) status!: IssueStatus;
|
||||
@Field({ description: 'A status id' })
|
||||
@Matches(SETTING_ID)
|
||||
status!: string;
|
||||
@Field(() => String, {
|
||||
nullable: true,
|
||||
description: 'Required for QA_FAILED and CANCELLED',
|
||||
description: 'Required by statuses with requiresReason',
|
||||
})
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@@ -163,18 +171,22 @@ export class LinkIssuesInput {
|
||||
@InputType()
|
||||
export class IssueFilterInput {
|
||||
@Field(() => ID) @IsUUID() projectId!: string;
|
||||
@Field(() => [IssueStatus], { nullable: true })
|
||||
@Field(() => [String], { nullable: true })
|
||||
@IsOptional()
|
||||
@IsEnum(IssueStatus, { each: true })
|
||||
statuses?: IssueStatus[];
|
||||
@Field(() => [IssueType], { nullable: true })
|
||||
@IsString({ each: true })
|
||||
statuses?: string[];
|
||||
@Field(() => [StatusCategory], { nullable: true })
|
||||
@IsOptional()
|
||||
@IsEnum(IssueType, { each: true })
|
||||
types?: IssueType[];
|
||||
@Field(() => [IssueArea], { nullable: true })
|
||||
@IsEnum(StatusCategory, { each: true })
|
||||
categories?: StatusCategory[];
|
||||
@Field(() => [String], { nullable: true })
|
||||
@IsOptional()
|
||||
@IsEnum(IssueArea, { each: true })
|
||||
areas?: IssueArea[];
|
||||
@IsString({ each: true })
|
||||
types?: string[];
|
||||
@Field(() => [String], { nullable: true })
|
||||
@IsOptional()
|
||||
@IsString({ each: true })
|
||||
areas?: string[];
|
||||
@Field(() => [IssuePriority], { nullable: true })
|
||||
@IsOptional()
|
||||
@IsEnum(IssuePriority, { each: true })
|
||||
@@ -237,3 +249,77 @@ export class UpdateReleaseInput {
|
||||
@IsISO8601()
|
||||
targetDate?: string | null;
|
||||
}
|
||||
|
||||
/* Project settings (owners and admins). Values are archived, never deleted. */
|
||||
|
||||
@InputType()
|
||||
export class WorkflowStatusInput {
|
||||
@Field() @Matches(SETTING_ID) id!: string;
|
||||
@Field() @IsString() @MinLength(1) @MaxLength(40) name!: string;
|
||||
@Field(() => StatusCategory)
|
||||
@IsEnum(StatusCategory)
|
||||
category!: StatusCategory;
|
||||
@Field() @IsString() color!: string;
|
||||
@Field({ defaultValue: false }) @IsBoolean() requiresReason!: boolean;
|
||||
@Field({ defaultValue: false }) @IsBoolean() archived!: boolean;
|
||||
}
|
||||
|
||||
@InputType()
|
||||
export class StatusTransitionsInput {
|
||||
@Field() @Matches(SETTING_ID) from!: string;
|
||||
@Field(() => [String])
|
||||
@IsArray()
|
||||
@ArrayMaxSize(50)
|
||||
@Matches(SETTING_ID, { each: true })
|
||||
to!: string[];
|
||||
}
|
||||
|
||||
@InputType()
|
||||
export class IssueTypeOptionInput {
|
||||
@Field() @Matches(SETTING_ID) id!: string;
|
||||
@Field() @IsString() @MinLength(1) @MaxLength(40) name!: string;
|
||||
@Field() @IsString() icon!: string;
|
||||
@Field() @IsString() color!: string;
|
||||
@Field({ defaultValue: false }) @IsBoolean() archived!: boolean;
|
||||
}
|
||||
|
||||
@InputType()
|
||||
export class AreaOptionInput {
|
||||
@Field() @Matches(SETTING_ID) id!: string;
|
||||
@Field() @IsString() @MinLength(1) @MaxLength(40) name!: string;
|
||||
@Field({ defaultValue: false }) @IsBoolean() archived!: boolean;
|
||||
}
|
||||
|
||||
@InputType({
|
||||
description:
|
||||
'The whole configuration (replaces the previous one). Statuses go in board order.',
|
||||
})
|
||||
export class ProjectSettingsInput {
|
||||
@Field(() => [WorkflowStatusInput])
|
||||
@IsArray()
|
||||
@ArrayMaxSize(50)
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => WorkflowStatusInput)
|
||||
statuses!: WorkflowStatusInput[];
|
||||
|
||||
@Field(() => [StatusTransitionsInput])
|
||||
@IsArray()
|
||||
@ArrayMaxSize(50)
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => StatusTransitionsInput)
|
||||
transitions!: StatusTransitionsInput[];
|
||||
|
||||
@Field(() => [IssueTypeOptionInput])
|
||||
@IsArray()
|
||||
@ArrayMaxSize(50)
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => IssueTypeOptionInput)
|
||||
issueTypes!: IssueTypeOptionInput[];
|
||||
|
||||
@Field(() => [AreaOptionInput])
|
||||
@IsArray()
|
||||
@ArrayMaxSize(50)
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => AreaOptionInput)
|
||||
areas!: AreaOptionInput[];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user