feat: saved views of my work, across my projects
A person saves named views of «my work»: projects, assigned to me, that I follow, status categories, priorities, bugs only, overdue and text. They are private (Mongo my_views, no history), listed and deleted by their owner (GraphQL myViews / saveMyView / deleteMyView, REST /api/me/views), and run as the cross-project search, which gains project, priority, bugsOnly and overdue filters (also in MCP my_issues). The home page shows them as a bar above «my work», with a drawer to save a new one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -500,6 +500,38 @@ export class MyIssuesQueryDto extends PageQueryDto {
|
||||
@IsString()
|
||||
@MaxLength(200)
|
||||
search?: string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
type: [String],
|
||||
description:
|
||||
'Only these of my projects (ids). Repeat or separate with commas',
|
||||
})
|
||||
@IsOptional()
|
||||
@Transform(toList)
|
||||
@IsUUID('all', { each: true })
|
||||
project?: string[];
|
||||
|
||||
@ApiPropertyOptional({
|
||||
enum: IssuePriority,
|
||||
enumName: 'IssuePriority',
|
||||
isArray: true,
|
||||
})
|
||||
@IsOptional()
|
||||
@Transform(toList)
|
||||
@IsEnum(IssuePriority, { each: true })
|
||||
priority?: IssuePriority[];
|
||||
|
||||
@ApiPropertyOptional({ description: 'Only types with the bug icon' })
|
||||
@IsOptional()
|
||||
@Transform(toBoolean)
|
||||
@IsBoolean()
|
||||
bugsOnly?: boolean;
|
||||
|
||||
@ApiPropertyOptional({ description: 'Only open tickets past their due date' })
|
||||
@IsOptional()
|
||||
@Transform(toBoolean)
|
||||
@IsBoolean()
|
||||
overdue?: boolean;
|
||||
}
|
||||
|
||||
export class UpcomingReleasesQueryDto {
|
||||
@@ -898,6 +930,69 @@ export class SavedFilterCriteriaDto {
|
||||
search?: string | null;
|
||||
}
|
||||
|
||||
export class MyViewCriteriaDto {
|
||||
@ApiPropertyOptional({
|
||||
type: [String],
|
||||
format: 'uuid',
|
||||
description: 'Only these of my projects (empty: all)',
|
||||
})
|
||||
@IsOptional()
|
||||
@IsArray()
|
||||
@ArrayMaxSize(50)
|
||||
@IsUUID('all', { each: true })
|
||||
projectIds?: string[];
|
||||
@ApiPropertyOptional() @IsOptional() @IsBoolean() assignedToMe?: boolean;
|
||||
@ApiPropertyOptional({ description: 'Only the tickets I follow' })
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
watching?: boolean;
|
||||
@ApiPropertyOptional({
|
||||
enum: StatusCategory,
|
||||
enumName: 'StatusCategory',
|
||||
isArray: true,
|
||||
})
|
||||
@IsOptional()
|
||||
@IsEnum(StatusCategory, { each: true })
|
||||
categories?: StatusCategory[];
|
||||
@ApiPropertyOptional({
|
||||
enum: IssuePriority,
|
||||
enumName: 'IssuePriority',
|
||||
isArray: true,
|
||||
})
|
||||
@IsOptional()
|
||||
@IsEnum(IssuePriority, { each: true })
|
||||
priorities?: IssuePriority[];
|
||||
@ApiPropertyOptional({ description: 'Only types with the bug icon' })
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
bugsOnly?: boolean;
|
||||
@ApiPropertyOptional({ description: 'Only open tickets past due' })
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
overdue?: boolean;
|
||||
@ApiPropertyOptional({ maxLength: 200 })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MaxLength(200)
|
||||
search?: string;
|
||||
}
|
||||
|
||||
export class SaveMyViewDto {
|
||||
@ApiProperty({
|
||||
example: 'Bugs críticos de todos mis proyectos',
|
||||
maxLength: 60,
|
||||
})
|
||||
@IsString()
|
||||
@MinLength(1)
|
||||
@MaxLength(60)
|
||||
name!: string;
|
||||
|
||||
@ApiProperty({ type: MyViewCriteriaDto })
|
||||
@ValidateNested()
|
||||
@Type(() => MyViewCriteriaDto)
|
||||
criteria!: MyViewCriteriaDto;
|
||||
}
|
||||
|
||||
export class SaveFilterDto {
|
||||
@ApiProperty({ example: 'Bugs críticos de frontend', maxLength: 60 })
|
||||
@IsString()
|
||||
|
||||
@@ -526,6 +526,37 @@ export class SavedFilterDto {
|
||||
@ApiProperty({ format: 'date-time' }) createdAt!: string;
|
||||
}
|
||||
|
||||
export class MyViewCriteriaResponseDto {
|
||||
@ApiPropertyOptional({ type: [String], format: 'uuid' })
|
||||
projectIds?: string[];
|
||||
@ApiPropertyOptional() assignedToMe?: boolean;
|
||||
@ApiPropertyOptional() watching?: boolean;
|
||||
@ApiPropertyOptional({
|
||||
enum: StatusCategory,
|
||||
enumName: 'StatusCategory',
|
||||
isArray: true,
|
||||
})
|
||||
categories?: StatusCategory[];
|
||||
@ApiPropertyOptional({
|
||||
enum: IssuePriority,
|
||||
enumName: 'IssuePriority',
|
||||
isArray: true,
|
||||
})
|
||||
priorities?: IssuePriority[];
|
||||
@ApiPropertyOptional() bugsOnly?: boolean;
|
||||
@ApiPropertyOptional() overdue?: boolean;
|
||||
@ApiPropertyOptional() search?: string;
|
||||
}
|
||||
|
||||
export class MyViewDto {
|
||||
@ApiProperty({ format: 'uuid' }) id!: string;
|
||||
@ApiProperty({ example: 'Bugs críticos de todos mis proyectos' })
|
||||
name!: string;
|
||||
@ApiProperty({ type: MyViewCriteriaResponseDto })
|
||||
criteria!: MyViewCriteriaResponseDto;
|
||||
@ApiProperty({ format: 'date-time' }) createdAt!: string;
|
||||
}
|
||||
|
||||
export class SavedFilterIdDto {
|
||||
@ApiProperty({ format: 'uuid' }) id!: string;
|
||||
}
|
||||
|
||||
@@ -132,6 +132,10 @@ export class IssuesController {
|
||||
statuses: query.status,
|
||||
categories: query.category,
|
||||
search: query.search,
|
||||
projectIds: query.project,
|
||||
priorities: query.priority,
|
||||
bugsOnly: query.bugsOnly,
|
||||
overdue: query.overdue,
|
||||
limit: query.limit,
|
||||
offset: query.offset,
|
||||
});
|
||||
|
||||
@@ -26,8 +26,12 @@ import {
|
||||
ApiReadErrors,
|
||||
} from '@task-stream/api/shared/presenters';
|
||||
import { SavedFiltersService } from '@task-stream/api/tracker/application';
|
||||
import { SaveFilterDto } from './dto/requests.dto';
|
||||
import { SavedFilterDto, SavedFilterIdDto } from './dto/responses.dto';
|
||||
import { SaveFilterDto, SaveMyViewDto } from './dto/requests.dto';
|
||||
import {
|
||||
MyViewDto,
|
||||
SavedFilterDto,
|
||||
SavedFilterIdDto,
|
||||
} from './dto/responses.dto';
|
||||
import { Refs } from './refs';
|
||||
|
||||
/** Saved views of a project's board: mine, and the ones shared with it. */
|
||||
@@ -93,4 +97,39 @@ export class SavedFiltersController {
|
||||
) {
|
||||
await this.filters.delete(me.id, id);
|
||||
}
|
||||
|
||||
@Get('me/views')
|
||||
@ApiOperation({
|
||||
summary: 'My saved views of my work, across my projects (by name)',
|
||||
})
|
||||
@ApiOkResponse({ type: [MyViewDto] })
|
||||
@ApiReadErrors()
|
||||
myViews(@CurrentUser() me: User) {
|
||||
return this.filters.myViews(me.id);
|
||||
}
|
||||
|
||||
@Post('me/views')
|
||||
@ApiOperation({
|
||||
summary: 'Save a view of my work under a name',
|
||||
description:
|
||||
'Run it with GET /api/me/issues and the same criteria (project, priority, bugsOnly, overdue…).',
|
||||
})
|
||||
@ApiCreatedResponse({ type: SavedFilterIdDto })
|
||||
@ApiCommandErrors()
|
||||
saveMyView(@CurrentUser() me: User, @Body() body: SaveMyViewDto) {
|
||||
return this.filters.saveMyView(me.id, body);
|
||||
}
|
||||
|
||||
@Delete('me/views/:id')
|
||||
@HttpCode(204)
|
||||
@ApiParam({ name: 'id', format: 'uuid' })
|
||||
@ApiOperation({ summary: 'Delete one of my views' })
|
||||
@ApiNoContentResponse()
|
||||
@ApiCommandErrors()
|
||||
async deleteMyView(
|
||||
@CurrentUser() me: User,
|
||||
@Param('id', ParseUUIDPipe) id: string,
|
||||
) {
|
||||
await this.filters.deleteMyView(me.id, id);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user