Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
412 commits
Select commit Hold shift + click to select a range
f061baa
fix: fix pg jsonb function
nichenqin Aug 23, 2025
4fa84c5
fix: make link api work
nichenqin Aug 23, 2025
802ef71
fix: handle lookup rollup with error
nichenqin Aug 23, 2025
ada2445
refactor: move files and change api
nichenqin Aug 23, 2025
1416690
fix: jsonb issue
nichenqin Aug 23, 2025
408b0a4
fix: do not remove dependent formulas in table
nichenqin Aug 23, 2025
2d2f1e5
fix: fix rollup ordering
nichenqin Aug 24, 2025
8831f6e
refactor: move sql conversion to nestjs backend
nichenqin Aug 24, 2025
18de7cc
fix: fix formula reference auto number
nichenqin Aug 24, 2025
08c5930
chore: use record query builder manager
nichenqin Aug 24, 2025
4bd9b72
fix: fix lookup -> formula -> lookup
nichenqin Aug 25, 2025
84f8f4d
fix: fix ts issue
nichenqin Aug 25, 2025
1b4b109
fix: fix sort
nichenqin Aug 25, 2025
1a13234
fix: fix search
nichenqin Aug 25, 2025
0964207
fix: fix lookup flatten
nichenqin Aug 25, 2025
477ebc3
fix: fix filter issue
nichenqin Aug 25, 2025
b309f9b
test: fix test
nichenqin Aug 25, 2025
2d25359
fix: fix null cast in lookup multiple value
nichenqin Aug 26, 2025
66533a9
fix: fix filter lookup -> checkbox
nichenqin Aug 26, 2025
5911552
fix: fix date formatting
nichenqin Aug 26, 2025
04e56e7
fix: fix record filter e2e test
nichenqin Aug 26, 2025
e3ba5fe
fix: fix sort column
nichenqin Aug 26, 2025
d9eeb37
fix: fix lookup filter
nichenqin Aug 27, 2025
1575b56
fix: fix link rollup filter
nichenqin Aug 27, 2025
35205a6
fix: fix self lookup
nichenqin Aug 27, 2025
84455fe
fix: fix record filter
nichenqin Aug 27, 2025
5459812
fix: fix aggregate
nichenqin Aug 27, 2025
b250e79
fix: fix aggregation issue
nichenqin Aug 27, 2025
1cc012b
fix: handle aggregate with selection
nichenqin Aug 28, 2025
7d48912
fix: fix aggregate with group
nichenqin Aug 28, 2025
f1a286e
fix: fix aggregate calendar daily collection
nichenqin Aug 28, 2025
cbb6723
fix: fix group column alias
nichenqin Aug 28, 2025
a3391a2
fix: fix aggregate with group
nichenqin Aug 28, 2025
e166a0d
fix: fix lin api test
nichenqin Aug 28, 2025
e0ea113
feat: create view for table
nichenqin Aug 29, 2025
9e01fa6
feat: add table db view name field
nichenqin Aug 29, 2025
1dd8b43
feat: read data from material view
nichenqin Aug 29, 2025
f9cb693
feat: refresh postgres database view
nichenqin Aug 29, 2025
1d5bc13
fix: fix rollup selection
nichenqin Aug 29, 2025
52315e9
fix: fix drop column cascade
nichenqin Aug 30, 2025
f59b4e4
chore: add query builder fallback
nichenqin Aug 30, 2025
1c30943
fix: fix get field undefined
nichenqin Aug 30, 2025
3c2806f
fix: fix formula -> lookup -> foreign link formatting
nichenqin Aug 30, 2025
dd5dc45
fix: fix query database view cache
nichenqin Aug 30, 2025
7a2ed25
fix: don't export database view service
nichenqin Aug 30, 2025
65e47ac
fix: fix link order
nichenqin Aug 30, 2025
377f89e
fix: fix link lookup order
nichenqin Aug 30, 2025
06df5ec
fix: fix formula has error selection
nichenqin Aug 30, 2025
e9700e4
chore: add use view cache flag
nichenqin Sep 1, 2025
a7e495c
fix: fix rollup filter
nichenqin Sep 1, 2025
c184ee7
fix: fix convert field test
nichenqin Sep 1, 2025
8ca9f51
test: fix integrity test
nichenqin Sep 1, 2025
e984dbd
test: fix field test
nichenqin Sep 1, 2025
79d198e
test: test link
nichenqin Sep 1, 2025
7144bd1
fix: fix duplicate field
nichenqin Sep 1, 2025
992f2ac
fix: try to fix duplicate table
nichenqin Sep 1, 2025
8f27ec3
test: fix table duplicate issue
nichenqin Sep 1, 2025
364894b
fix: fix table test issue
nichenqin Sep 1, 2025
af7be11
fix: fix user test
nichenqin Sep 1, 2025
19f8cfc
fix: fix duplicate field count
nichenqin Sep 1, 2025
7a7c741
test: fix formula test
nichenqin Sep 1, 2025
a5a4723
fix: fix formula undo redo
nichenqin Sep 1, 2025
9bf9dad
fix: fix aggregate test
nichenqin Sep 1, 2025
8dc597c
fix: fix base query
nichenqin Sep 1, 2025
5857e0b
fix: fix basic link test
nichenqin Sep 1, 2025
a6fac10
feat: add query builder selection
nichenqin Sep 1, 2025
6d003f8
fix: fix aggregation test
nichenqin Sep 1, 2025
28c2be0
fix: fix logging
nichenqin Sep 1, 2025
018ae32
fix: fix record search query builder
nichenqin Sep 2, 2025
4a0223e
fix: fix base query
nichenqin Sep 2, 2025
58bd3fb
fix: fix undo with meta change
nichenqin Sep 2, 2025
e8778e6
fix: fix undo redo with link
nichenqin Sep 2, 2025
7df4624
fix: fix convert field return meta
nichenqin Sep 2, 2025
0b3233b
fix: fix undo redo lookup expect
nichenqin Sep 2, 2025
804a9bc
fix: fix basic link issue
nichenqin Sep 2, 2025
3ac7dee
fix: fix undo redo with formula
nichenqin Sep 2, 2025
895e5ea
fix: fix base query
nichenqin Sep 2, 2025
6a8ebb9
fix: fix lookup fallback
nichenqin Sep 2, 2025
80a1e07
fix: fix unit test
nichenqin Sep 2, 2025
5c79421
fix: fix lint issue
nichenqin Sep 3, 2025
5c59d19
feat: add realtime op listener
nichenqin Sep 3, 2025
53cb96f
feat: update field op
nichenqin Sep 3, 2025
5180530
feat: realtime delete field op
nichenqin Sep 3, 2025
f949ced
fix: fix delete field and all dependent fields should be marked as error
nichenqin Sep 3, 2025
2f0cd2f
feat: add formula field core hasUnresolvedReferences
nichenqin Sep 3, 2025
1aefdd2
feat: create record modify module
nichenqin Sep 3, 2025
4761dc4
feat: modify module add delete record
nichenqin Sep 3, 2025
98065f3
fix: fix delete record issue
nichenqin Sep 4, 2025
93b6eb8
fix: fix update record
nichenqin Sep 4, 2025
5feb40d
chore: removed record calculation service
nichenqin Sep 4, 2025
b472d59
test: add create duplicate record test
nichenqin Sep 4, 2025
4a98e5f
fix: fix field test
nichenqin Sep 4, 2025
f01afb6
chore: fix duplicate field
nichenqin Sep 4, 2025
136cc37
refactor: modify service
nichenqin Sep 4, 2025
8b40e51
fix: fix lint issue
nichenqin Sep 4, 2025
d884606
fix: missing sqlite prisma generate
nichenqin Sep 4, 2025
d8a05f1
chore: generate db view name migrate for sqlite
nichenqin Sep 4, 2025
6e5e56c
fix: postgres prisma schema
nichenqin Sep 4, 2025
2bebed2
refactor: remove calculation code
nichenqin Sep 4, 2025
ba05d86
chore: sqlite bugs
nichenqin Sep 5, 2025
471aff7
feat: implement PostgreSQL and SQLite record query dialects
nichenqin Sep 5, 2025
fe53ff8
feat: record query builder respect projection
nichenqin Sep 5, 2025
0ccbf62
feat: createRecordAggregateBuilder support projection
nichenqin Sep 5, 2025
d3ddefb
fix: fix sqlite junction table issue
nichenqin Sep 5, 2025
c5a1282
feat: add computed service to calc ops
nichenqin Sep 6, 2025
1db817e
fix: fix nested lookup for formula
nichenqin Sep 6, 2025
8058655
fix: fix impact collector
nichenqin Sep 6, 2025
78ccdee
chore: disable sqlite test
nichenqin Sep 6, 2025
98f14d3
test: add computed orchestractor test
nichenqin Sep 6, 2025
412e53b
feat: update computed fields after update records
nichenqin Sep 8, 2025
2079587
test: add table life cycle test
nichenqin Sep 9, 2025
0f309f8
fix: fix lint issue
nichenqin Sep 9, 2025
224897d
fix: do not create link field database field when converting
nichenqin Sep 9, 2025
a26016b
feat: use query model in record query builder service
nichenqin Sep 9, 2025
f2f1cb5
fix: fix bugs
nichenqin Sep 9, 2025
b61d9a4
chore: remove realtime op service
nichenqin Sep 9, 2025
dfc8519
feat: update computed values
nichenqin Sep 9, 2025
9f6e791
feat: link change ops
nichenqin Sep 10, 2025
8734dc6
test: add computed e2e test suits
nichenqin Sep 10, 2025
e1dccc9
refactor: rename record computed orchestrator
nichenqin Sep 10, 2025
58e7330
feat: create field with ops
nichenqin Sep 10, 2025
98a78d3
feat: computed field convert ops
nichenqin Sep 10, 2025
adc3706
test: add create field ops
nichenqin Sep 10, 2025
d73fc2e
fix: fix create date field issue
nichenqin Sep 10, 2025
bfadca3
feat: delete field record ops
nichenqin Sep 10, 2025
f300314
fix: fix update link physical column data
nichenqin Sep 10, 2025
8292949
fix: fix create underlying link field column
nichenqin Sep 10, 2025
f53dc27
fix: fix convert link field error
nichenqin Sep 11, 2025
83cec30
fix: fix rollup issue
nichenqin Sep 11, 2025
b81e0d6
fix: fix delete field issue
nichenqin Sep 11, 2025
ec5e37a
fix: fix computed record issue
nichenqin Sep 11, 2025
cbf15f7
fix: fix duplicate field
nichenqin Sep 11, 2025
1270b3c
fix: fix record query builder issue
nichenqin Sep 11, 2025
2f8697d
fix: fix formula type
nichenqin Sep 11, 2025
4d92344
fix: fix formula lookup returning
nichenqin Sep 11, 2025
dfff1fc
fix: fix drop index timeout
nichenqin Sep 11, 2025
4e583dc
fix: fix undo redo
nichenqin Sep 12, 2025
78b195c
test: add computed test
nichenqin Sep 12, 2025
b8705e7
fix: fix duplicate field data
nichenqin Sep 12, 2025
857887a
feat: use query model
nichenqin Sep 12, 2025
3a1d239
fix: fix computed record issue
nichenqin Sep 12, 2025
6004dd3
chore: disable record query builder use query model
nichenqin Sep 14, 2025
2b997c2
fix: add typed nul for
nichenqin Sep 14, 2025
d67e09b
fix: fix convert link field
nichenqin Sep 14, 2025
512078f
fix: fix computed has Error
nichenqin Sep 14, 2025
80869a4
fix: fix graph service
nichenqin Sep 14, 2025
efc139e
fix: fix type cast
nichenqin Sep 14, 2025
722d797
chore: add query builder query model
nichenqin Sep 14, 2025
aa31072
fix: fix rollup lookup select issue
nichenqin Sep 14, 2025
c2df25b
fix: fix delete field context
nichenqin Sep 14, 2025
6339541
fix: update link should update related lookup & rollup
nichenqin Sep 14, 2025
fa05526
fix: fix convert link field updateFromSelect
nichenqin Sep 15, 2025
d4f6ed6
fix: fix duplicate base lookup issue
nichenqin Sep 15, 2025
8989845
feat: wrap permission view
nichenqin Sep 15, 2025
6555253
fix: fix wrap permission
nichenqin Sep 15, 2025
1d22ab6
fix: fix aggregate
nichenqin Sep 15, 2025
c6d159a
fix: fix aggregate with permission
nichenqin Sep 15, 2025
c1b9981
fix: fix generate groupby
nichenqin Sep 15, 2025
f752760
fix: fix projection
nichenqin Sep 15, 2025
85977ff
Revert "fix: fix generate groupby"
nichenqin Sep 15, 2025
139eae5
fix: fix aggregate
nichenqin Sep 16, 2025
3e080f0
fix: fix wrap view projection
nichenqin Sep 16, 2025
48b5669
fix: fix base query
nichenqin Sep 16, 2025
7ee11a1
fix: fix group points order
nichenqin Sep 16, 2025
480208d
chore: remove log
nichenqin Sep 17, 2025
4413541
fix: fix formula with ?
nichenqin Sep 17, 2025
4fd668d
fix: fix has order column
nichenqin Sep 17, 2025
7bd920a
feat: aggregate use query model
nichenqin Sep 17, 2025
ea688ec
chore: share use query model
nichenqin Sep 17, 2025
74fd885
fix: formula read data from column
nichenqin Sep 17, 2025
4aedf1b
fix: fix merge issue
nichenqin Sep 17, 2025
23e635a
fix: v2 aggregation service
nichenqin Sep 18, 2025
3c3f712
fix: fix has column order issue
nichenqin Sep 18, 2025
38c5904
fix: fix computed formula field
nichenqin Sep 18, 2025
2e72498
fix: fix link conversion meta expect
nichenqin Sep 18, 2025
359ec7d
fix: fix formula bool logic
nichenqin Sep 18, 2025
d557e79
test: add some large table e2e test
nichenqin Sep 19, 2025
0a56f46
feat: timing evaluate
nichenqin Sep 22, 2025
bb27cb4
feat: enhance computed evaluation with batch processing and memory tr…
nichenqin Sep 22, 2025
22eb26b
feat: paging computed evaluate
nichenqin Sep 23, 2025
b4905e0
chore: pagination strategy
nichenqin Sep 23, 2025
d1f2f73
fix: fix computed test
nichenqin Sep 25, 2025
996124d
fix: fix alter column name
nichenqin Sep 26, 2025
ef8a24a
fix: fix tests
nichenqin Sep 26, 2025
7ec0e07
feat: init reference lookup
nichenqin Sep 22, 2025
afec53c
fix: fix reference lookup field not found request
nichenqin Sep 24, 2025
1ae567b
feat: reference lookup field
nichenqin Sep 24, 2025
b6226ce
fix: fix computed reference lookup field
nichenqin Sep 25, 2025
9e58778
fix: fix reference lookup filter change computed value
nichenqin Sep 25, 2025
f266e26
fix: update condition to include ReferenceLookup type in options chan…
nichenqin Sep 25, 2025
30c4563
fix: fix aggregate fn in reference lookup
nichenqin Sep 25, 2025
52a1312
test: add e2e test for error marking on referenced lookup or filter f…
nichenqin Sep 25, 2025
3dc8a5c
test: add end-to-end tests for reference lookup field functionality a…
nichenqin Sep 26, 2025
3ee0d8f
refactor: replace selfFields, selfTableId, and enableFieldReference w…
nichenqin Sep 28, 2025
5e4b40d
feat: enhance ReferenceLookupValue with tooltip for toggle button
nichenqin Sep 28, 2025
63603f7
feat: integrate wrapWithReference for select components and enhance f…
nichenqin Sep 28, 2025
0b8ab44
feat: add field and literal comparison matrix tests for reference loo…
nichenqin Sep 28, 2025
d0428ee
feat: add support for concatenated names, unique tier lists, and comp…
nichenqin Sep 28, 2025
3805aad
chore: fix lint issue
nichenqin Sep 28, 2025
3d2d4e0
feat: enhance computed services with preferAutoNumberPaging support a…
nichenqin Sep 28, 2025
e541a00
fix: optimize record set handling to prevent unnecessary processing o…
nichenqin Sep 28, 2025
8d4b607
feat: update string concatenation handling to treat NULL values as em…
nichenqin Sep 28, 2025
e12f257
fix: update translation keys for linking from external base to anothe…
nichenqin Sep 28, 2025
6af328c
feat: implement reference lookup validation and enhance rollup functi…
nichenqin Sep 28, 2025
a35b2a7
feat: enhance rollup options with expression label overrides
nichenqin Sep 28, 2025
a581b87
feat: enhance datetime aggregation handling in PgRecordQueryDialect a…
nichenqin Sep 29, 2025
c732c55
feat: implement reference restoration and validation in FieldOpenApiS…
nichenqin Sep 29, 2025
8e59bd5
refactor: rebane Reference Lookup ti Conditional Rollup
nichenqin Sep 29, 2025
359aff2
feat: add support for raw projections in FieldSelectVisitor and enhan…
nichenqin Sep 29, 2025
c86c4dc
feat: add tests for conditional rollup across bases in e2e spec
nichenqin Sep 29, 2025
c7a302f
feat: add descriptions for field types and enhance localization support
nichenqin Sep 29, 2025
41a6aa6
feat: require filter conditions for conditional rollup options and ad…
nichenqin Sep 29, 2025
e3765f3
chore: fix type issue
nichenqin Sep 29, 2025
7412215
feat: add default filter conditions for conditional rollup fields
nichenqin Sep 29, 2025
4362fb5
feat: enhance lookup field validation and error handling in field con…
nichenqin Sep 29, 2025
3e19c5e
feat: implement conditional rollup fields with date reference filters…
nichenqin Sep 30, 2025
46984ba
feat: add boolean field reference filter tests and enhance boolean ce…
nichenqin Sep 30, 2025
f309481
feat: enhance supported operators for field reference and improve tog…
nichenqin Sep 30, 2025
635d9d1
feat: refine rollup expression handling and filter out raw value expr…
nichenqin Sep 30, 2025
3460feb
feat: conditional lookup
nichenqin Oct 9, 2025
9e81a29
feat: update lookup options to use ILookupLinkOptions and handle null…
nichenqin Oct 10, 2025
11ad97a
feat: enhance conditional lookup and rollup handling in query dialect…
nichenqin Oct 10, 2025
94dfd3c
feat: add boolean and field reference filters for conditional lookups…
nichenqin Oct 10, 2025
b646d42
feat: implement blank-aware comparison functions for PostgreSQL and S…
nichenqin Oct 10, 2025
0bdaf85
feat: add tests for multi-layer conditional lookup chains and rollup …
nichenqin Oct 10, 2025
77e7880
feat: enhance conditional rollup and lookup handling in field CTE vis…
nichenqin Oct 10, 2025
5b72b85
feat: add average rollup function support in query dialects and relat…
nichenqin Oct 11, 2025
9445c40
feat: enhance lookup options sanitization in FieldSetting component
nichenqin Oct 11, 2025
ff3e190
feat: add interval normalization and date addition support
nichenqin Oct 11, 2025
9fe6829
feat: enhance date handling in SQLite and Postgres queries
nichenqin Oct 11, 2025
62a2287
feat: enhance count functions to support blank-aware expressions in P…
nichenqin Oct 11, 2025
da14203
feat: add support for conditional lookups in various components and u…
nichenqin Oct 11, 2025
2724d4b
feat: add Switch component and integrate it into BaseFieldValue for i…
nichenqin Oct 11, 2025
b271b25
feat: conditional lookup style
nichenqin Oct 11, 2025
27b5d31
test: add formula test
nichenqin Oct 11, 2025
6302e3f
test: add some formula test
nichenqin Oct 11, 2025
c3a21de
fix: fix link concurrent update
nichenqin Oct 11, 2025
7aef50f
test: add conditional rollup & lookup test
nichenqin Oct 13, 2025
9612622
test: add conditional rollup & lookup test
nichenqin Oct 13, 2025
c0a0414
fix: fix bulk link conversion
nichenqin Oct 13, 2025
650c31e
fix: fix bulk link conversion
nichenqin Oct 13, 2025
762a2cd
test: delete records bulk test
nichenqin Oct 13, 2025
c534d86
chore: vitest hoot timeout
nichenqin Oct 13, 2025
0af7bc2
test: add regex test
nichenqin Oct 14, 2025
5bf9f9c
test: formula checkbox if
nichenqin Oct 14, 2025
c2bfa22
fix: fix if forumla test
nichenqin Oct 14, 2025
996172d
fix: fix convert conditional lookup name
nichenqin Oct 14, 2025
89b3553
fix: fix convert field
nichenqin Oct 14, 2025
141c55e
fix: fix conditional lookup update dependency collection
nichenqin Oct 14, 2025
ac70cd2
fix: fix icon dark mode
nichenqin Oct 15, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
fail-fast: false
matrix:
node-version: [20.9.0]
database-type: [postgres, sqlite]
database-type: [postgres]
env:
CI: 1

Expand Down
102 changes: 88 additions & 14 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,45 @@
"runtimeExecutable": "sh",
"autoAttachChildProcesses": true,
"program": "./node_modules/.bin/vitest",
"args": ["run", "${workspaceFolder}/${relativeFile}", "--config", "./vitest-e2e.config.ts", "--hideSkippedTests"],
"args": [
"run",
"${workspaceFolder}/${relativeFile}",
"--config",
"./vitest-e2e.config.ts",
"--hideSkippedTests"
],
"smartStep": true,
"console": "integratedTerminal",
"skipFiles": ["<node_internals>/**", "**/node_modules/**"],
"skipFiles": [
"<node_internals>/**",
"**/node_modules/**"
],
"internalConsoleOptions": "neverOpen"
},
{
"name": "Debug vitest e2e nest backend",
"type": "node",
"request": "launch",
"cwd": "${workspaceFolder}/apps/nestjs-backend",
"runtimeExecutable": "node",
"program": "${workspaceFolder}/apps/nestjs-backend/node_modules/vitest/vitest.mjs",
"args": [
"run",
"${workspaceFolder}/${relativeFile}",
"--config",
"./vitest-e2e.config.ts",
"--hideSkippedTests",
"--no-file-parallelism",
"--reporter",
"verbose"
],
"autoAttachChildProcesses": true,
"smartStep": true,
"console": "integratedTerminal",
"skipFiles": [
"<node_internals>/**",
"**/node_modules/**"
],
"internalConsoleOptions": "neverOpen"
},
{
Expand All @@ -26,10 +61,18 @@
"runtimeExecutable": "sh",
"autoAttachChildProcesses": true,
"program": "./node_modules/.bin/vitest",
"args": ["run", "${workspaceFolder}/${relativeFile}", "--config", "./vitest.config.ts"],
"args": [
"run",
"${workspaceFolder}/${relativeFile}",
"--config",
"./vitest.config.ts"
],
"smartStep": true,
"console": "integratedTerminal",
"skipFiles": ["<node_internals>/**", "**/node_modules/**"],
"skipFiles": [
"<node_internals>/**",
"**/node_modules/**"
],
"internalConsoleOptions": "neverOpen"
},
{
Expand All @@ -40,10 +83,18 @@
"runtimeExecutable": "sh",
"autoAttachChildProcesses": true,
"program": "./node_modules/.bin/vitest",
"args": ["run", "${workspaceFolder}/${relativeFile}", "--config", "./vitest.config.ts"],
"args": [
"run",
"${workspaceFolder}/${relativeFile}",
"--config",
"./vitest.config.ts"
],
"smartStep": true,
"console": "integratedTerminal",
"skipFiles": ["<node_internals>/**", "**/node_modules/**"],
"skipFiles": [
"<node_internals>/**",
"**/node_modules/**"
],
"internalConsoleOptions": "neverOpen"
},
{
Expand All @@ -54,10 +105,18 @@
"runtimeExecutable": "sh",
"autoAttachChildProcesses": true,
"program": "./node_modules/.bin/vitest",
"args": ["run", "${workspaceFolder}/${relativeFile}", "--config", "./vitest.config.ts"],
"args": [
"run",
"${workspaceFolder}/${relativeFile}",
"--config",
"./vitest.config.ts"
],
"smartStep": true,
"console": "integratedTerminal",
"skipFiles": ["<node_internals>/**", "**/node_modules/**"],
"skipFiles": [
"<node_internals>/**",
"**/node_modules/**"
],
"internalConsoleOptions": "neverOpen"
},
{
Expand All @@ -68,25 +127,40 @@
"runtimeExecutable": "sh",
"autoAttachChildProcesses": true,
"program": "./node_modules/.bin/vitest",
"args": ["run", "${workspaceFolder}/${relativeFile}", "--config", "./vitest.config.ts"],
"args": [
"run",
"${workspaceFolder}/${relativeFile}",
"--config",
"./vitest.config.ts"
],
"smartStep": true,
"console": "integratedTerminal",
"skipFiles": ["<node_internals>/**", "**/node_modules/**"],
"skipFiles": [
"<node_internals>/**",
"**/node_modules/**"
],
"internalConsoleOptions": "neverOpen"
},
{
"name": "Debug nest backend",
"type": "node",
"request": "launch",
"runtimeExecutable": "pnpm",
"args": ["apps/nestjs-backend/src/index.ts"],
"runtimeArgs": ["start-debug"],
"outFiles": ["${workspaceFolder}/**/*.js", "!**/node_modules/**"],
"args": [
"apps/nestjs-backend/src/index.ts"
],
"runtimeArgs": [
"start-debug"
],
"outFiles": [
"${workspaceFolder}/**/*.js",
"!**/node_modules/**"
],
"cwd": "${workspaceFolder}/apps/nestjs-backend",
"internalConsoleOptions": "openOnSessionStart",
"sourceMaps": true,
"console": "internalConsole",
"outputCapture": "std"
},
]
}
}
25 changes: 24 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,29 @@
"univer",
"zustand"
],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"eslint.format.enable": true,
"eslint.alwaysShowStatus": true,
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact"
],
"[javascript]": {
"editor.formatOnSave": false
},
"[javascriptreact]": {
"editor.formatOnSave": false
},
"[typescript]": {
"editor.formatOnSave": false
},
"[typescriptreact]": {
"editor.formatOnSave": false
},
"eslint.workingDirectories": [
{
"pattern": "./apps/*/"
Expand All @@ -36,4 +59,4 @@
}
],
"vitest.maximumConfigs": 10
}
}
7 changes: 5 additions & 2 deletions apps/nestjs-backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,19 @@
},
"scripts": {
"build": "nest build",
"clean": "rimraf ./out ./coverage ./main ./dist ./tsconfig.tsbuildinfo ./node_modules/.cache",
"clean": "rimraf ./out ./coverage ./main ./dist ./tsconfig.tsbuildinfo ./node_modules/.cache .webpack-cache",
"dev": "nest start --webpackPath ./webpack.dev.js -w",
"dev:swc": "nest start --webpackPath ./webpack.swc.js -w",
"start": "nest start",
"check-dist": "es-check -v",
"start-debug": "nest start --webpackPath ./webpack.dev.js --debug -w",
"check-size": "size-limit --highlight-less",
"test": "run-s test-unit test-e2e",
"test-unit:watch": "vitest --watch",
"test-unit": "vitest run --silent --bail 1",
"test-unit-cover": "pnpm test-unit --coverage",
"pre-test-e2e": "cross-env NODE_ENV=test pnpm -F @teable/db-main-prisma prisma-db-seed -- --e2e",
"test-e2e": "pnpm pre-test-e2e && vitest run --config ./vitest-e2e.config.ts --silent --bail 1",
"test-e2e": "pnpm pre-test-e2e && vitest run --config ./vitest-e2e.config.ts --silent",
"test-e2e-cover": "pnpm test-e2e --coverage",
"typecheck": "tsc --project ./tsconfig.json --noEmit",
"lint": "eslint . --ext .ts,.js,.cjs,.mjs,.mdx --cache --cache-location ../../.cache/eslint/nestjs-backend.eslintcache",
Expand Down Expand Up @@ -100,8 +101,10 @@
"istanbul-merge": "2.0.0",
"npm-run-all2": "6.1.2",
"nyc": "15.1.0",
"pg-mem": "3.0.5",
"prettier": "3.2.5",
"rimraf": "5.0.5",
"sql-formatter": "^15.3.1",
"swc-loader": "0.2.6",
"symlink-dir": "5.2.1",
"sync-directory": "6.0.5",
Expand Down
2 changes: 2 additions & 0 deletions apps/nestjs-backend/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { ChatModule } from './features/chat/chat.module';
import { CollaboratorModule } from './features/collaborator/collaborator.module';
import { CommentOpenApiModule } from './features/comment/comment-open-api.module';
import { DashboardModule } from './features/dashboard/dashboard.module';
import { DatabaseViewModule } from './features/database-view/database-view.module';
import { ExportOpenApiModule } from './features/export/open-api/export-open-api.module';
import { FieldOpenApiModule } from './features/field/open-api/field-open-api.module';
import { HealthModule } from './features/health/health.module';
Expand Down Expand Up @@ -86,6 +87,7 @@ export const appModules = {
PluginPanelModule,
PluginContextMenuModule,
PluginChartModule,
// DatabaseViewModule,
],
providers: [InitBootstrapProvider],
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,37 @@
import { InternalServerErrorException, Logger } from '@nestjs/common';
import { InternalServerErrorException } from '@nestjs/common';
import type { FieldCore } from '@teable/core';
import { StatisticsFunc } from '@teable/core';
import type { Knex } from 'knex';
import type { IFieldInstance } from '../../features/field/model/factory';
import type { IRecordQueryAggregateContext } from '../../features/record/query-builder/record-query-builder.interface';
import type { IAggregationFunctionInterface } from './aggregation-function.interface';

export abstract class AbstractAggregationFunction implements IAggregationFunctionInterface {
private logger = new Logger(AbstractAggregationFunction.name);

protected tableColumnRef: string;

constructor(
protected readonly knex: Knex,
protected readonly dbTableName: string,
protected readonly field: IFieldInstance
protected readonly field: FieldCore,
readonly context?: IRecordQueryAggregateContext
) {
const { dbFieldName } = this.field;
const { dbFieldName, id } = field;

const selection = context?.selectionMap.get(id);
if (selection) {
this.tableColumnRef = selection as string;
} else {
this.tableColumnRef = dbFieldName;
}
}

get dbTableName() {
return this.context?.tableDbName;
}

this.tableColumnRef = `${dbFieldName}`;
get tableAlias() {
return this.context?.tableAlias;
}

compiler(builderClient: Knex.QueryBuilder, aggFunc: StatisticsFunc) {
compiler(builderClient: Knex.QueryBuilder, aggFunc: StatisticsFunc, alias: string | undefined) {
const functionHandlers = {
[StatisticsFunc.Count]: this.count,
[StatisticsFunc.Empty]: this.empty,
Expand Down Expand Up @@ -73,39 +85,41 @@ export abstract class AbstractAggregationFunction implements IAggregationFunctio
rawSql = `MAX(${this.knex.ref(`${joinTable}.value`)})`;
}

return builderClient.select(this.knex.raw(`${rawSql} AS ??`, [`${fieldId}_${aggFunc}`]));
return builderClient.select(
this.knex.raw(`${rawSql} AS ??`, [alias ?? `${fieldId}_${aggFunc}`])
);
}

count(): string {
return this.knex.raw('COUNT(*)').toQuery();
return this.knex.raw(`COUNT(*)`).toQuery();
}

empty(): string {
return this.knex.raw(`COUNT(*) - COUNT(??)`, [this.tableColumnRef]).toQuery();
return this.knex.raw(`COUNT(*) - COUNT(${this.tableColumnRef})`).toQuery();
}

filled(): string {
return this.knex.raw(`COUNT(??)`, [this.tableColumnRef]).toQuery();
return this.knex.raw(`COUNT(${this.tableColumnRef})`).toQuery();
}

unique(): string {
return this.knex.raw(`COUNT(DISTINCT ??)`, [this.tableColumnRef]).toQuery();
return this.knex.raw(`COUNT(DISTINCT ${this.tableColumnRef})`).toQuery();
}

max(): string {
return this.knex.raw(`MAX(??)`, [this.tableColumnRef]).toQuery();
return this.knex.raw(`MAX(${this.tableColumnRef})`).toQuery();
}

min(): string {
return this.knex.raw(`MIN(??)`, [this.tableColumnRef]).toQuery();
return this.knex.raw(`MIN(${this.tableColumnRef})`).toQuery();
}

sum(): string {
return this.knex.raw(`SUM(??)`, [this.tableColumnRef]).toQuery();
return this.knex.raw(`SUM(${this.tableColumnRef})`).toQuery();
}

average(): string {
return this.knex.raw(`AVG(??)`, [this.tableColumnRef]).toQuery();
return this.knex.raw(`AVG(${this.tableColumnRef})`).toQuery();
}

checked(): string {
Expand Down
Loading
Loading