Spaces:
Sleeping
Sleeping
File size: 392 Bytes
7f81110 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | import { SQL, and, eq } from "drizzle-orm";
export abstract class BaseRepository {
constructor() { }
/**
* Enforces tenant scoping on any condition
*/
protected withTenant(tenantId: string, condition?: SQL): SQL {
const tenantFilter = eq((this as any).table.tenantId, tenantId);
return condition ? and(tenantFilter, condition)! : tenantFilter;
}
}
|