- 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
58 lines
1.4 KiB
TypeScript
58 lines
1.4 KiB
TypeScript
import { ActivityAction, EntityType } from "@prisma/client";
|
|
import {
|
|
IsUUID,
|
|
IsEnum,
|
|
IsOptional,
|
|
IsInt,
|
|
Min,
|
|
Max,
|
|
IsDateString,
|
|
} from "class-validator";
|
|
import { Type } from "class-transformer";
|
|
|
|
/**
|
|
* DTO for querying activity logs with filters and pagination
|
|
*/
|
|
export class QueryActivityLogDto {
|
|
@IsOptional()
|
|
@IsUUID("4", { message: "workspaceId must be a valid UUID" })
|
|
workspaceId?: string;
|
|
|
|
@IsOptional()
|
|
@IsUUID("4", { message: "userId must be a valid UUID" })
|
|
userId?: string;
|
|
|
|
@IsOptional()
|
|
@IsEnum(ActivityAction, { message: "action must be a valid ActivityAction" })
|
|
action?: ActivityAction;
|
|
|
|
@IsOptional()
|
|
@IsEnum(EntityType, { message: "entityType must be a valid EntityType" })
|
|
entityType?: EntityType;
|
|
|
|
@IsOptional()
|
|
@IsUUID("4", { message: "entityId must be a valid UUID" })
|
|
entityId?: string;
|
|
|
|
@IsOptional()
|
|
@IsDateString({}, { message: "startDate must be a valid ISO 8601 date string" })
|
|
startDate?: Date;
|
|
|
|
@IsOptional()
|
|
@IsDateString({}, { message: "endDate must be a valid ISO 8601 date string" })
|
|
endDate?: Date;
|
|
|
|
@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;
|
|
}
|