list space-model

This commit is contained in:
hannathkadher
2024-12-18 11:40:45 +04:00
parent 70e1fe2ae5
commit 7833151b70
7 changed files with 111 additions and 11 deletions
@@ -31,7 +31,7 @@ interface FindAllQueryWithDefaults extends CustomFindAllQuery {
function getDefaultQueryOptions(
query: Partial<TypeORMCustomModelFindAllQuery>,
): FindManyOptions & FindAllQueryWithDefaults {
const { page, size, includeDisable, modelName, ...rest } = query;
const { page, size, includeDisable, include, modelName, ...rest } = query;
// Set default if undefined or null
const returnPage = page ? Number(page) : 1;
@@ -48,7 +48,9 @@ function getDefaultQueryOptions(
},
page: returnPage,
size: returnSize,
include: include || undefined,
includeDisable: returnIncludeDisable,
modelName: modelName || query.modelName, // Ensure modelName is passed through
};
}
@@ -97,7 +99,6 @@ export function TypeORMCustomModel(repository: Repository<any>) {
// Use the where clause directly, without wrapping it under 'where'
const whereClause = buildTypeORMWhereClause({ where });
console.log('Final where clause:', whereClause);
// Ensure the whereClause is passed directly to findAndCount
const [data, count] = await repository.findAndCount({