This commit is contained in:
Bastian Wagner
2026-06-15 10:10:47 +02:00
parent cb938d3dc8
commit c2d2157de8
8 changed files with 100 additions and 14 deletions

View File

@@ -1,3 +1,5 @@
import { FindOperator } from 'typeorm';
type WhereClause<T> = Partial<Record<keyof T, unknown>>;
export class InMemoryRepository<T extends object> {
@@ -83,7 +85,13 @@ export class InMemoryRepository<T extends object> {
}
return Object.entries(where).every(([key, value]) => {
return (record as Record<string, unknown>)[key] === value;
const recordValue = (record as Record<string, unknown>)[key];
if (value instanceof FindOperator && value.type === 'isNull') {
return recordValue === null || recordValue === undefined;
}
return recordValue === value;
});
}