@solidxai/core 0.1.10-beta.7 → 0.1.10-beta.9
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.
- package/.claude/settings.local.json +15 -0
- package/dist/dtos/update-user.dto.d.ts +1 -0
- package/dist/dtos/update-user.dto.d.ts.map +1 -1
- package/dist/dtos/update-user.dto.js +7 -1
- package/dist/dtos/update-user.dto.js.map +1 -1
- package/dist/entities/user.entity.js +1 -0
- package/dist/entities/user.entity.js.map +1 -1
- package/dist/seeders/seed-data/solid-core-metadata.json +21 -0
- package/package.json +1 -1
- package/src/dtos/update-user.dto.ts +4 -0
- package/src/entities/user.entity.ts +1 -1
- package/src/seeders/seed-data/solid-core-metadata.json +21 -0
- package/src/services/1.js +6 -0
- package/dist-tests/api/authenticate.spec.js +0 -119
- package/dist-tests/api/authenticate.spec.js.map +0 -1
- package/dist-tests/api/crud-service.findOne.cityMaster.spec.js +0 -97
- package/dist-tests/api/crud-service.findOne.cityMaster.spec.js.map +0 -1
- package/dist-tests/api/ping.spec.js +0 -21
- package/dist-tests/api/ping.spec.js.map +0 -1
- package/dist-tests/helpers/auth.js +0 -41
- package/dist-tests/helpers/auth.js.map +0 -1
- package/dist-tests/helpers/env.js +0 -11
- package/dist-tests/helpers/env.js.map +0 -1
- package/docs/grouping-enhancements.md +0 -89
- package/docs/java-spring/README.md +0 -3
- package/docs/java-spring/solid-core-module-deep-dive-report.md +0 -1317
- package/docs/seed-changes.md +0 -65
- package/docs/test-data-workflow.md +0 -200
- package/docs/type-declaration-import-issue.md +0 -24
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
# Grouping & Aggregation Enhancements (Code Review Summary)
|
|
2
|
-
|
|
3
|
-
This document explains the recent changes to grouping/aggregation in the CRUD helper/service, why they were made, and how to use them (with examples on `PincodeMaster`).
|
|
4
|
-
|
|
5
|
-
## What Changed and Why
|
|
6
|
-
- **Dedicated grouping pipeline**: Grouping no longer reuses the record-level query (which had `SELECT entity.*`, pagination, and default order). A separate path builds clean group queries to avoid SQL errors and ensure correct counts.
|
|
7
|
-
- **Multiple group-by fields**: The one-field limit was removed. You can now group on multiple fields (including relations) in the requested order.
|
|
8
|
-
- **Relation-safe grouping**: Group-by fields can traverse many-to-one relations (e.g., `state.name`, `city.name`). The helper reuses existing joins (from filters) or adds the necessary joins and aliases.
|
|
9
|
-
- **Date granularity**: Grouping supports `day`, `week`, `month`, `year` granularities in a DB-aware way (Postgres, MySQL/MariaDB, SQL Server).
|
|
10
|
-
- **Aggregates**: Supports a core, DB-agnostic set: `count`, `count_distinct`, `sum`, `avg`, `min`, `max`. If `aggregates` is omitted, it defaults to `count(*)`.
|
|
11
|
-
- **Group sorting/pagination**: Sorting and pagination are applied to group rows (not entity rows). Record pagination is kept separate for non-grouped queries.
|
|
12
|
-
- **Ordered group names**: Group names follow the order of `groupBy` fields. Relation values and date/grouped values are included in sequence.
|
|
13
|
-
- **Formatted date group labels**: You can add an optional format specifier to a date groupBy field: `field:granularity:format`. Supported formats: `MMM`, `MMMM`, `YYYY`, `YYYY-MM`, `YYYY-MM-DD` (defaults to the raw value if omitted).
|
|
14
|
-
- **Count of groups**: Group counts are computed without pagination interference, so `meta.totalRecords` reflects total groups.
|
|
15
|
-
- **DTO update**: `BasicFilterDto` now includes optional `aggregates?: string[]`.
|
|
16
|
-
|
|
17
|
-
## Caveats
|
|
18
|
-
- `populateGroup` is **not** supported when grouping on relation fields (e.g., `state.name`, `city.name`). Use it for scalar group-by fields only; otherwise fetch group metadata and then retrieve records in a separate call with the group key.
|
|
19
|
-
- Sorting works for group keys without extra colons (e.g., `state.name`) and for aggregate aliases (e.g., `id_max`). For date bucket group keys with granularity/format (`createdAt:month:YYYY`), the sort parser treats the last segment as the order; results may vary by driver and may not sort as expected in all cases.
|
|
20
|
-
|
|
21
|
-
## Usage Examples (PincodeMaster)
|
|
22
|
-
Assume `PincodeMaster` has many-to-one `state` and `city` relations and a `createdAt` timestamp.
|
|
23
|
-
|
|
24
|
-
### 1) Group by State and City
|
|
25
|
-
```
|
|
26
|
-
GET /api/pincode-master?offset=0&limit=200&groupBy[0]=state.name&groupBy[1]=city.name
|
|
27
|
-
```
|
|
28
|
-
Returns groups for every state/city combination with default `count(*)` aggregate.
|
|
29
|
-
|
|
30
|
-
### 2) Group by Relation + Filter on Relation
|
|
31
|
-
```
|
|
32
|
-
GET /api/pincode-master?offset=0&limit=200&groupBy[0]=state.name&filters[state][name][$eq]=Maharashtra
|
|
33
|
-
```
|
|
34
|
-
Groups by state name but only for rows where state is Maharashtra.
|
|
35
|
-
|
|
36
|
-
### 3) Multiple Group Fields (Relation + Scalar)
|
|
37
|
-
```
|
|
38
|
-
GET /api/pincode-master?offset=0&limit=200&groupBy[0]=state.name&groupBy[1]=city.name&groupBy[2]=pincode
|
|
39
|
-
```
|
|
40
|
-
Group names are ordered: state → city → pincode.
|
|
41
|
-
|
|
42
|
-
### 4) Group by Date with Granularity (Month)
|
|
43
|
-
```
|
|
44
|
-
GET /api/pincode-master?offset=0&limit=200&groupBy[0]=createdAt:month
|
|
45
|
-
```
|
|
46
|
-
Groups by month (driver-aware), default group labels are raw date buckets.
|
|
47
|
-
|
|
48
|
-
### 5) Date Granularity with Formatting
|
|
49
|
-
```
|
|
50
|
-
GET /api/pincode-master?offset=0&limit=200&groupBy[0]=createdAt:month:MMM
|
|
51
|
-
```
|
|
52
|
-
Group labels use short month names (Jan, Feb, …). For full names: `createdAt:month:MMMM`. Other formats: `YYYY`, `YYYY-MM`, `YYYY-MM-DD`.
|
|
53
|
-
|
|
54
|
-
### 6) Aggregates (Count Distinct)
|
|
55
|
-
```
|
|
56
|
-
GET /api/pincode-master?offset=0&limit=200&groupBy[0]=state.name&aggregates[0]=pincode:count_distinct
|
|
57
|
-
```
|
|
58
|
-
Shows distinct pincodes per state.
|
|
59
|
-
|
|
60
|
-
### 7) Aggregates (Multiple)
|
|
61
|
-
```
|
|
62
|
-
GET /api/pincode-master?offset=0&limit=200&groupBy[0]=state.name&groupBy[1]=city.name&aggregates[0]=id:count&aggregates[1]=id:count_distinct
|
|
63
|
-
```
|
|
64
|
-
Returns both total rows and distinct IDs per state/city group.
|
|
65
|
-
|
|
66
|
-
### 8) Date Granularity + Relations + Aggregates
|
|
67
|
-
```
|
|
68
|
-
GET /api/pincode-master?offset=0&limit=200&groupBy[0]=createdAt:year&groupBy[1]=state.name&aggregates[0]=pincode:count_distinct
|
|
69
|
-
```
|
|
70
|
-
Distinct pincodes per state, per year.
|
|
71
|
-
|
|
72
|
-
### 9) Filters with Grouping (Many-to-One)
|
|
73
|
-
```
|
|
74
|
-
GET /api/pincode-master?offset=0&limit=200&groupBy[0]=state.name&groupBy[1]=city.name&filters[state][name][$eq]=Nagaland
|
|
75
|
-
```
|
|
76
|
-
Groups only rows where state.name = Nagaland.
|
|
77
|
-
|
|
78
|
-
### 10) Group Sorting and Pagination
|
|
79
|
-
- Sorting applies to the group rows. Example:
|
|
80
|
-
```
|
|
81
|
-
GET /api/pincode-master?offset=0&limit=50&groupBy[0]=state.name&sort[0]=state.name:ASC
|
|
82
|
-
```
|
|
83
|
-
- Pagination (`offset/limit`) limits the number of groups returned; total group count remains in `meta.totalRecords`.
|
|
84
|
-
|
|
85
|
-
## Notes and Behavior
|
|
86
|
-
- If `aggregates` is omitted, `COUNT(*)` is added automatically.
|
|
87
|
-
- Group names reflect `groupBy` order and apply formatting when specified.
|
|
88
|
-
- Group queries reuse joins from filters when possible; otherwise, they create necessary joins for relation paths.
|
|
89
|
-
- Non-grouped find behavior remains unchanged.
|