pangea-server 1.0.51 → 1.0.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -9,7 +9,7 @@ type IncludeItem = {
|
|
|
9
9
|
active?: boolean;
|
|
10
10
|
include?: IncludeItem[];
|
|
11
11
|
};
|
|
12
|
-
type Filters<BM extends BaseModel> = ModelId | Where<BM
|
|
12
|
+
type Filters<BM extends BaseModel> = ModelId | Where<BM> | undefined;
|
|
13
13
|
type Group = string[];
|
|
14
14
|
type Order = Record<string, 'asc' | 'desc'>;
|
|
15
15
|
type FindOneOptions = {
|
|
@@ -26,7 +26,7 @@ class Db {
|
|
|
26
26
|
}
|
|
27
27
|
return scopedModel.findOne({
|
|
28
28
|
...baseOptions,
|
|
29
|
-
...getIncludeAndWhere(model, include,
|
|
29
|
+
...getIncludeAndWhere(model, include, { withoutAttributes: !!attributes }, filters),
|
|
30
30
|
order: getFinalOrder(order),
|
|
31
31
|
});
|
|
32
32
|
}
|
|
@@ -60,10 +60,7 @@ class Db {
|
|
|
60
60
|
async findManyWithCount(model, options = {}) {
|
|
61
61
|
const { page, pageSize } = options;
|
|
62
62
|
if (page && pageSize) {
|
|
63
|
-
const [instances, totalCount] = await Promise.all([
|
|
64
|
-
this.findMany(model, options),
|
|
65
|
-
this.count(model, options),
|
|
66
|
-
]);
|
|
63
|
+
const [instances, totalCount] = await Promise.all([this.findMany(model, options), this.count(model, options)]);
|
|
67
64
|
return { instances, totalCount };
|
|
68
65
|
}
|
|
69
66
|
const instances = await this.findMany(model, options);
|
|
@@ -247,7 +244,7 @@ function getIncludeAndWhere(model, includeItems, config = {}, where, relDepth =
|
|
|
247
244
|
includeOptions.push({
|
|
248
245
|
model: relModel,
|
|
249
246
|
as: relName,
|
|
250
|
-
attributes: !config.withoutAttributes ? undefined : [],
|
|
247
|
+
// attributes: !config.withoutAttributes ? undefined : [],
|
|
251
248
|
required: rel.required,
|
|
252
249
|
paranoid: rel.paranoid,
|
|
253
250
|
...getIncludeAndWhere(relModel, nestedIncludeItems, config, relWhere, newRelDepth),
|