import { ForbiddenException } from '@nestjs/common'; export function assertOwner( ownerId: string | null | undefined, userId: string, resourceName: string, ): void { if (!ownerId || ownerId !== userId) { throw new ForbiddenException(`${resourceName} does not belong to the current user`); } }