- Wrap SET LOCAL in transactions for proper connection pooling - Make workspaceId optional in query DTOs (derived from guards) - Replace Error throws with UnauthorizedException in activity controller - Update workspace guard to remove RLS context setting - Document that services should use withUserContext/withUserTransaction
54 lines
1.2 KiB
TypeScript
54 lines
1.2 KiB
TypeScript
import { IdeaStatus } from "@prisma/client";
|
|
import {
|
|
IsUUID,
|
|
IsOptional,
|
|
IsEnum,
|
|
IsInt,
|
|
Min,
|
|
Max,
|
|
IsString,
|
|
} from "class-validator";
|
|
import { Type } from "class-transformer";
|
|
|
|
/**
|
|
* DTO for querying ideas with filters and pagination
|
|
*/
|
|
export class QueryIdeasDto {
|
|
@IsOptional()
|
|
@IsUUID("4", { message: "workspaceId must be a valid UUID" })
|
|
workspaceId?: string;
|
|
|
|
@IsOptional()
|
|
@IsEnum(IdeaStatus, { message: "status must be a valid IdeaStatus" })
|
|
status?: IdeaStatus;
|
|
|
|
@IsOptional()
|
|
@IsUUID("4", { message: "domainId must be a valid UUID" })
|
|
domainId?: string;
|
|
|
|
@IsOptional()
|
|
@IsUUID("4", { message: "projectId must be a valid UUID" })
|
|
projectId?: string;
|
|
|
|
@IsOptional()
|
|
@IsString({ message: "category must be a string" })
|
|
category?: string;
|
|
|
|
@IsOptional()
|
|
@IsString({ message: "search must be a string" })
|
|
search?: string;
|
|
|
|
@IsOptional()
|
|
@Type(() => Number)
|
|
@IsInt({ message: "page must be an integer" })
|
|
@Min(1, { message: "page must be at least 1" })
|
|
page?: number;
|
|
|
|
@IsOptional()
|
|
@Type(() => Number)
|
|
@IsInt({ message: "limit must be an integer" })
|
|
@Min(1, { message: "limit must be at least 1" })
|
|
@Max(100, { message: "limit must not exceed 100" })
|
|
limit?: number;
|
|
}
|