@stamhoofd/backend 2.107.3 → 2.109.0
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/index.ts +2 -2
- package/package.json +20 -20
- package/src/crons/disable-auto-update-documents.test.ts +164 -0
- package/src/crons/disable-auto-update-documents.ts +82 -0
- package/src/endpoints/admin/members/ChargeMembersEndpoint.ts +5 -5
- package/src/endpoints/admin/registrations/ChargeRegistrationsEndpoint.ts +87 -0
- package/src/endpoints/global/members/GetMembersCountEndpoint.ts +2 -2
- package/src/endpoints/global/members/GetMembersEndpoint.ts +5 -5
- package/src/endpoints/global/registration/GetRegistrationsCountEndpoint.ts +2 -2
- package/src/endpoints/global/registration/GetRegistrationsEndpoint.ts +14 -11
- package/src/endpoints/global/registration/RegisterMembersEndpoint.ts +9 -8
- package/src/endpoints/organization/dashboard/documents/GetDocumentTemplatesCountEndpoint.ts +48 -0
- package/src/endpoints/organization/dashboard/documents/GetDocumentTemplatesEndpoint.ts +95 -19
- package/src/endpoints/organization/dashboard/documents/PatchDocumentTemplatesEndpoint.test.ts +282 -0
- package/src/endpoints/organization/dashboard/documents/{PatchDocumentTemplateEndpoint.ts → PatchDocumentTemplatesEndpoint.ts} +56 -3
- package/src/excel-loaders/members.ts +62 -8
- package/src/excel-loaders/registrations.ts +180 -9
- package/src/helpers/LimitedFilteredRequestHelper.ts +24 -0
- package/src/helpers/MemberCharger.ts +16 -4
- package/src/helpers/SQLTranslatedString.ts +14 -0
- package/src/helpers/TagHelper.test.ts +9 -9
- package/src/helpers/fetchToAsyncIterator.ts +1 -1
- package/src/helpers/outstandingBalanceJoin.ts +49 -0
- package/src/seeds/1765896674-document-update-year.test.ts +179 -0
- package/src/seeds/1765896674-document-update-year.ts +75 -0
- package/src/seeds/1766150402-document-published-at.test.ts +46 -0
- package/src/seeds/1766150402-document-published-at.ts +20 -0
- package/src/services/PaymentService.ts +14 -32
- package/src/sql-filters/base-registration-filter-compilers.ts +51 -4
- package/src/sql-filters/document-templates.ts +45 -0
- package/src/sql-filters/documents.ts +1 -1
- package/src/sql-filters/events.ts +6 -6
- package/src/sql-filters/groups.ts +7 -6
- package/src/sql-filters/members.ts +31 -26
- package/src/sql-filters/orders.ts +16 -16
- package/src/sql-filters/organizations.ts +11 -11
- package/src/sql-filters/payments.ts +10 -10
- package/src/sql-filters/registrations.ts +14 -6
- package/src/sql-sorters/document-templates.ts +79 -0
- package/src/sql-sorters/documents.ts +1 -1
- package/src/sql-sorters/members.ts +22 -0
- package/src/sql-sorters/orders.ts +5 -5
- package/src/sql-sorters/organizations.ts +3 -3
- package/src/sql-sorters/registrations.ts +186 -15
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { baseSQLFilterCompilers, createColumnFilter, SQL, SQLCast, SQLConcat,
|
|
1
|
+
import { baseSQLFilterCompilers, createColumnFilter, createExistsFilter, createWildcardColumnFilter, SQL, SQLCast, SQLConcat, SQLFilterDefinitions, SQLJsonExtract, SQLJsonUnquote, SQLScalar, SQLValueType } from '@stamhoofd/sql';
|
|
2
2
|
|
|
3
3
|
export const orderFilterCompilers: SQLFilterDefinitions = {
|
|
4
4
|
...baseSQLFilterCompilers,
|
|
@@ -26,12 +26,12 @@ export const orderFilterCompilers: SQLFilterDefinitions = {
|
|
|
26
26
|
nullable: false,
|
|
27
27
|
}),
|
|
28
28
|
timeSlotEndTime: createColumnFilter({
|
|
29
|
-
expression: SQL.
|
|
29
|
+
expression: SQL.jsonExtract(SQL.column('data'), '$.value.timeSlot.endTime'),
|
|
30
30
|
type: SQLValueType.JSONString,
|
|
31
31
|
nullable: true,
|
|
32
32
|
}),
|
|
33
33
|
timeSlotStartTime: createColumnFilter({
|
|
34
|
-
expression: SQL.
|
|
34
|
+
expression: SQL.jsonExtract(SQL.column('data'), '$.value.timeSlot.startTime'),
|
|
35
35
|
type: SQLValueType.JSONString,
|
|
36
36
|
nullable: true,
|
|
37
37
|
}),
|
|
@@ -51,17 +51,17 @@ export const orderFilterCompilers: SQLFilterDefinitions = {
|
|
|
51
51
|
nullable: false,
|
|
52
52
|
}),
|
|
53
53
|
paymentMethod: createColumnFilter({
|
|
54
|
-
expression: SQL.
|
|
54
|
+
expression: SQL.jsonExtract(SQL.column('data'), '$.value.paymentMethod'),
|
|
55
55
|
type: SQLValueType.JSONString,
|
|
56
56
|
nullable: false,
|
|
57
57
|
}),
|
|
58
58
|
checkoutMethod: createColumnFilter({
|
|
59
|
-
expression: SQL.
|
|
59
|
+
expression: SQL.jsonExtract(SQL.column('data'), '$.value.checkoutMethod.type'),
|
|
60
60
|
type: SQLValueType.JSONString,
|
|
61
61
|
nullable: true,
|
|
62
62
|
}),
|
|
63
63
|
timeSlotDate: createColumnFilter({
|
|
64
|
-
expression: SQL.
|
|
64
|
+
expression: SQL.jsonExtract(SQL.column('data'), '$.value.timeSlot.date'),
|
|
65
65
|
type: SQLValueType.JSONString,
|
|
66
66
|
nullable: true,
|
|
67
67
|
}),
|
|
@@ -73,21 +73,21 @@ export const orderFilterCompilers: SQLFilterDefinitions = {
|
|
|
73
73
|
name: createColumnFilter({
|
|
74
74
|
expression: new SQLCast(
|
|
75
75
|
new SQLConcat(
|
|
76
|
-
new SQLJsonUnquote(SQL.
|
|
76
|
+
new SQLJsonUnquote(SQL.jsonExtract(SQL.column('data'), '$.value.customer.firstName')),
|
|
77
77
|
new SQLScalar(' '),
|
|
78
|
-
new SQLJsonUnquote(SQL.
|
|
78
|
+
new SQLJsonUnquote(SQL.jsonExtract(SQL.column('data'), '$.value.customer.lastName')),
|
|
79
79
|
),
|
|
80
80
|
'CHAR'),
|
|
81
81
|
type: SQLValueType.String,
|
|
82
82
|
nullable: false,
|
|
83
83
|
}),
|
|
84
84
|
email: createColumnFilter({
|
|
85
|
-
expression: SQL.
|
|
85
|
+
expression: SQL.jsonExtract(SQL.column('data'), '$.value.customer.email'),
|
|
86
86
|
type: SQLValueType.JSONString,
|
|
87
87
|
nullable: false,
|
|
88
88
|
}),
|
|
89
89
|
phone: createColumnFilter({
|
|
90
|
-
expression: SQL.
|
|
90
|
+
expression: SQL.jsonExtract(SQL.column('data'), '$.value.customer.phone'),
|
|
91
91
|
type: SQLValueType.JSONString,
|
|
92
92
|
nullable: false,
|
|
93
93
|
}),
|
|
@@ -119,7 +119,7 @@ export const orderFilterCompilers: SQLFilterDefinitions = {
|
|
|
119
119
|
.join(
|
|
120
120
|
SQL.join(
|
|
121
121
|
SQL.jsonTable(
|
|
122
|
-
SQL.
|
|
122
|
+
SQL.jsonExtract(SQL.column('innerOrders', 'data'), '$.value.cart.items'),
|
|
123
123
|
'items',
|
|
124
124
|
)
|
|
125
125
|
.addColumn(
|
|
@@ -168,21 +168,21 @@ export const orderFilterCompilers: SQLFilterDefinitions = {
|
|
|
168
168
|
|
|
169
169
|
recordAnswers: createWildcardColumnFilter(
|
|
170
170
|
(key: string) => ({
|
|
171
|
-
expression: SQL.
|
|
171
|
+
expression: SQL.jsonExtract(SQL.column('data'), `$.value.recordAnswers.${SQLJsonExtract.escapePathComponent(key)}`, true),
|
|
172
172
|
type: SQLValueType.JSONObject,
|
|
173
173
|
nullable: true,
|
|
174
174
|
}),
|
|
175
175
|
(key: string) => ({
|
|
176
176
|
...baseSQLFilterCompilers,
|
|
177
177
|
selected: createColumnFilter({
|
|
178
|
-
expression: SQL.
|
|
178
|
+
expression: SQL.jsonExtract(SQL.column('data'), `$.value.recordAnswers.${SQLJsonExtract.escapePathComponent(key)}.selected`, true),
|
|
179
179
|
type: SQLValueType.JSONBoolean,
|
|
180
180
|
nullable: true,
|
|
181
181
|
}),
|
|
182
182
|
selectedChoice: {
|
|
183
183
|
...baseSQLFilterCompilers,
|
|
184
184
|
id: createColumnFilter({
|
|
185
|
-
expression: SQL.
|
|
185
|
+
expression: SQL.jsonExtract(SQL.column('data'), `$.value.recordAnswers.${SQLJsonExtract.escapePathComponent(key)}.selectedChoice.id`, true),
|
|
186
186
|
type: SQLValueType.JSONString,
|
|
187
187
|
nullable: true,
|
|
188
188
|
}),
|
|
@@ -190,13 +190,13 @@ export const orderFilterCompilers: SQLFilterDefinitions = {
|
|
|
190
190
|
selectedChoices: {
|
|
191
191
|
...baseSQLFilterCompilers,
|
|
192
192
|
id: createColumnFilter({
|
|
193
|
-
expression: SQL.
|
|
193
|
+
expression: SQL.jsonExtract(SQL.column('data'), `$.value.recordAnswers.${SQLJsonExtract.escapePathComponent(key)}.selectedChoices[*].id`, true),
|
|
194
194
|
type: SQLValueType.JSONArray,
|
|
195
195
|
nullable: true,
|
|
196
196
|
}),
|
|
197
197
|
},
|
|
198
198
|
value: createColumnFilter({
|
|
199
|
-
expression: SQL.
|
|
199
|
+
expression: SQL.jsonExtract(SQL.column('data'), `$.value.recordAnswers.${SQLJsonExtract.escapePathComponent(key)}.value`, true),
|
|
200
200
|
type: SQLValueType.JSONString,
|
|
201
201
|
nullable: true,
|
|
202
202
|
}),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { baseSQLFilterCompilers, createColumnFilter, createExistsFilter, SQL, SQLConcat, SQLFilterDefinitions,
|
|
1
|
+
import { baseSQLFilterCompilers, createColumnFilter, createExistsFilter, SQL, SQLConcat, SQLFilterDefinitions, SQLNow, SQLNull, SQLScalar, SQLValueType, SQLWhereEqual, SQLWhereOr, SQLWhereSign } from '@stamhoofd/sql';
|
|
2
2
|
import { SetupStepType } from '@stamhoofd/structures';
|
|
3
3
|
|
|
4
4
|
export const organizationFilterCompilers: SQLFilterDefinitions = {
|
|
@@ -29,32 +29,32 @@ export const organizationFilterCompilers: SQLFilterDefinitions = {
|
|
|
29
29
|
nullable: false,
|
|
30
30
|
}),
|
|
31
31
|
city: createColumnFilter({
|
|
32
|
-
expression: SQL.
|
|
32
|
+
expression: SQL.jsonExtract(SQL.column('organizations', 'address'), '$.value.city'),
|
|
33
33
|
type: SQLValueType.JSONString,
|
|
34
34
|
nullable: false,
|
|
35
35
|
}),
|
|
36
36
|
postalCode: createColumnFilter({
|
|
37
|
-
expression: SQL.
|
|
37
|
+
expression: SQL.jsonExtract(SQL.column('organizations', 'address'), '$.value.postalCode'),
|
|
38
38
|
type: SQLValueType.JSONString,
|
|
39
39
|
nullable: false,
|
|
40
40
|
}),
|
|
41
41
|
country: createColumnFilter({
|
|
42
|
-
expression: SQL.
|
|
42
|
+
expression: SQL.jsonExtract(SQL.column('organizations', 'address'), '$.value.country'),
|
|
43
43
|
type: SQLValueType.JSONString,
|
|
44
44
|
nullable: false,
|
|
45
45
|
}),
|
|
46
46
|
umbrellaOrganization: createColumnFilter({
|
|
47
|
-
expression: SQL.
|
|
47
|
+
expression: SQL.jsonExtract(SQL.column('organizations', 'meta'), '$.value.umbrellaOrganization'),
|
|
48
48
|
type: SQLValueType.JSONString,
|
|
49
49
|
nullable: true,
|
|
50
50
|
}),
|
|
51
51
|
type: createColumnFilter({
|
|
52
|
-
expression: SQL.
|
|
52
|
+
expression: SQL.jsonExtract(SQL.column('organizations', 'meta'), '$.value.type'),
|
|
53
53
|
type: SQLValueType.JSONString,
|
|
54
54
|
nullable: false,
|
|
55
55
|
}),
|
|
56
56
|
tags: createColumnFilter({
|
|
57
|
-
expression: SQL.
|
|
57
|
+
expression: SQL.jsonExtract(SQL.column('organizations', 'meta'), '$.value.tags'),
|
|
58
58
|
type: SQLValueType.JSONArray,
|
|
59
59
|
nullable: false,
|
|
60
60
|
}),
|
|
@@ -80,7 +80,7 @@ export const organizationFilterCompilers: SQLFilterDefinitions = {
|
|
|
80
80
|
{
|
|
81
81
|
...baseSQLFilterCompilers,
|
|
82
82
|
reviewedAt: createColumnFilter({
|
|
83
|
-
expression: SQL.
|
|
83
|
+
expression: SQL.jsonExtract(
|
|
84
84
|
SQL.column('organization_registration_periods', 'setupSteps'),
|
|
85
85
|
`$.value.steps.${setupStep}.review.date`,
|
|
86
86
|
),
|
|
@@ -140,7 +140,7 @@ export const organizationFilterCompilers: SQLFilterDefinitions = {
|
|
|
140
140
|
{
|
|
141
141
|
...baseSQLFilterCompilers,
|
|
142
142
|
type: createColumnFilter({
|
|
143
|
-
expression: SQL.
|
|
143
|
+
expression: SQL.jsonExtract(SQL.column('meta'), '$.value.type'),
|
|
144
144
|
type: SQLValueType.JSONString,
|
|
145
145
|
nullable: false,
|
|
146
146
|
}),
|
|
@@ -181,7 +181,7 @@ export const organizationFilterCompilers: SQLFilterDefinitions = {
|
|
|
181
181
|
nullable: false,
|
|
182
182
|
}),
|
|
183
183
|
email: createColumnFilter({
|
|
184
|
-
expression: SQL.
|
|
184
|
+
expression: SQL.jsonExtract(SQL.column('details'), '$.value.email'),
|
|
185
185
|
type: SQLValueType.JSONString,
|
|
186
186
|
nullable: true,
|
|
187
187
|
}),
|
|
@@ -199,7 +199,7 @@ export const organizationFilterCompilers: SQLFilterDefinitions = {
|
|
|
199
199
|
.join(
|
|
200
200
|
SQL.join(
|
|
201
201
|
SQL.jsonTable(
|
|
202
|
-
SQL.
|
|
202
|
+
SQL.jsonExtract(SQL.column('innerOrganizations', 'meta'), '$.value.companies'),
|
|
203
203
|
'companies',
|
|
204
204
|
)
|
|
205
205
|
.addColumn(
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { baseSQLFilterCompilers, createColumnFilter, createExistsFilter, SQL, SQLCast, SQLConcat, SQLJsonUnquote,
|
|
1
|
+
import { baseSQLFilterCompilers, createColumnFilter, createExistsFilter, SQL, SQLCast, SQLConcat, SQLFilterDefinitions, SQLJsonUnquote, SQLScalar, SQLValueType } from '@stamhoofd/sql';
|
|
2
2
|
import { balanceItemPaymentsCompilers } from './balance-item-payments';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -59,26 +59,26 @@ export const paymentFilterCompilers: SQLFilterDefinitions = {
|
|
|
59
59
|
customer: {
|
|
60
60
|
...baseSQLFilterCompilers,
|
|
61
61
|
email: createColumnFilter({
|
|
62
|
-
expression: SQL.
|
|
62
|
+
expression: SQL.jsonExtract(SQL.column('customer'), '$.value.email'),
|
|
63
63
|
type: SQLValueType.JSONString,
|
|
64
64
|
nullable: true,
|
|
65
65
|
}),
|
|
66
66
|
firstName: createColumnFilter({
|
|
67
|
-
expression: SQL.
|
|
67
|
+
expression: SQL.jsonExtract(SQL.column('customer'), '$.value.firstName'),
|
|
68
68
|
type: SQLValueType.JSONString,
|
|
69
69
|
nullable: true,
|
|
70
70
|
}),
|
|
71
71
|
lastName: createColumnFilter({
|
|
72
|
-
expression: SQL.
|
|
72
|
+
expression: SQL.jsonExtract(SQL.column('customer'), '$.value.lastName'),
|
|
73
73
|
type: SQLValueType.JSONString,
|
|
74
74
|
nullable: true,
|
|
75
75
|
}),
|
|
76
76
|
name: createColumnFilter({
|
|
77
77
|
expression: new SQLCast(
|
|
78
78
|
new SQLConcat(
|
|
79
|
-
new SQLJsonUnquote(SQL.
|
|
79
|
+
new SQLJsonUnquote(SQL.jsonExtract(SQL.column('customer'), '$.value.firstName')),
|
|
80
80
|
new SQLScalar(' '),
|
|
81
|
-
new SQLJsonUnquote(SQL.
|
|
81
|
+
new SQLJsonUnquote(SQL.jsonExtract(SQL.column('customer'), '$.value.lastName')),
|
|
82
82
|
),
|
|
83
83
|
'CHAR',
|
|
84
84
|
),
|
|
@@ -88,22 +88,22 @@ export const paymentFilterCompilers: SQLFilterDefinitions = {
|
|
|
88
88
|
company: {
|
|
89
89
|
...baseSQLFilterCompilers,
|
|
90
90
|
name: createColumnFilter({
|
|
91
|
-
expression: SQL.
|
|
91
|
+
expression: SQL.jsonExtract(SQL.column('customer'), '$.value.company.name'),
|
|
92
92
|
type: SQLValueType.JSONString,
|
|
93
93
|
nullable: true,
|
|
94
94
|
}),
|
|
95
95
|
VATNumber: createColumnFilter({
|
|
96
|
-
expression: SQL.
|
|
96
|
+
expression: SQL.jsonExtract(SQL.column('customer'), '$.value.company.VATNumber'),
|
|
97
97
|
type: SQLValueType.JSONString,
|
|
98
98
|
nullable: true,
|
|
99
99
|
}),
|
|
100
100
|
companyNumber: createColumnFilter({
|
|
101
|
-
expression: SQL.
|
|
101
|
+
expression: SQL.jsonExtract(SQL.column('customer'), '$.value.company.companyNumber'),
|
|
102
102
|
type: SQLValueType.JSONString,
|
|
103
103
|
nullable: true,
|
|
104
104
|
}),
|
|
105
105
|
administrationEmail: createColumnFilter({
|
|
106
|
-
expression: SQL.
|
|
106
|
+
expression: SQL.jsonExtract(SQL.column('customer'), '$.value.company.administrationEmail'),
|
|
107
107
|
type: SQLValueType.JSONString,
|
|
108
108
|
nullable: true,
|
|
109
109
|
}),
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
import { Group, Member, Registration } from '@stamhoofd/models';
|
|
1
|
+
import { Group, Member, Organization, Registration } from '@stamhoofd/models';
|
|
2
2
|
import { baseSQLFilterCompilers, createColumnFilter, createJoinedRelationFilter, SQL, SQLFilterDefinitions, SQLValueType } from '@stamhoofd/sql';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { SQLTranslatedString } from '../helpers/SQLTranslatedString.js';
|
|
4
|
+
import { baseRegistrationFilterCompilers } from './base-registration-filter-compilers.js';
|
|
5
|
+
import { memberFilterCompilers } from './members.js';
|
|
6
|
+
import { organizationFilterCompilers } from './organizations.js';
|
|
5
7
|
|
|
6
8
|
export const memberJoin = SQL.join(Member.table).where(SQL.column(Member.table, 'id'), SQL.column(Registration.table, 'memberId'));
|
|
7
9
|
|
|
8
10
|
export const groupJoin = SQL.join(Group.table).where(SQL.column(Group.table, 'id'), SQL.column(Registration.table, 'groupId'));
|
|
9
11
|
|
|
12
|
+
export const organizationJoin = SQL.join(Organization.table).where(SQL.column(Organization.table, 'id'), SQL.column(Registration.table, 'organizationId'));
|
|
13
|
+
|
|
10
14
|
export const registrationFilterCompilers: SQLFilterDefinitions = {
|
|
11
15
|
...baseSQLFilterCompilers,
|
|
12
16
|
...baseRegistrationFilterCompilers,
|
|
@@ -29,9 +33,9 @@ export const registrationFilterCompilers: SQLFilterDefinitions = {
|
|
|
29
33
|
nullable: false,
|
|
30
34
|
}),
|
|
31
35
|
name: createColumnFilter({
|
|
32
|
-
expression:
|
|
33
|
-
type: SQLValueType.
|
|
34
|
-
nullable:
|
|
36
|
+
expression: new SQLTranslatedString(SQL.column('groups', 'settings'), '$.value.name'),
|
|
37
|
+
type: SQLValueType.String,
|
|
38
|
+
nullable: true,
|
|
35
39
|
}),
|
|
36
40
|
status: createColumnFilter({
|
|
37
41
|
expression: SQL.column('groups', 'status'),
|
|
@@ -50,4 +54,8 @@ export const registrationFilterCompilers: SQLFilterDefinitions = {
|
|
|
50
54
|
}),
|
|
51
55
|
},
|
|
52
56
|
),
|
|
57
|
+
organization: createJoinedRelationFilter(
|
|
58
|
+
organizationJoin,
|
|
59
|
+
organizationFilterCompilers,
|
|
60
|
+
),
|
|
53
61
|
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { DocumentTemplate } from '@stamhoofd/models';
|
|
2
|
+
import { SQL, SQLOrderBy, SQLOrderByDirection, SQLSortDefinitions } from '@stamhoofd/sql';
|
|
3
|
+
import { Formatter } from '@stamhoofd/utility';
|
|
4
|
+
|
|
5
|
+
export const documentTemplateSorters: SQLSortDefinitions<DocumentTemplate> = {
|
|
6
|
+
// WARNING! TEST NEW SORTERS THOROUGHLY!
|
|
7
|
+
// Try to avoid creating sorters on fields that er not 1:1 with the database, that often causes pagination issues if not thought through
|
|
8
|
+
// An example: sorting on 'name' is not a good idea, because it is a concatenation of two fields.
|
|
9
|
+
// You might be tempted to use ORDER BY firstName, lastName, but that will not work as expected and it needs to be ORDER BY CONCAT(firstName, ' ', lastName)
|
|
10
|
+
// Why? Because ORDER BY firstName, lastName produces a different order dan ORDER BY CONCAT(firstName, ' ', lastName) if there are multiple people with spaces in the first name
|
|
11
|
+
// And that again causes issues with pagination because the next query will append a filter of name > 'John Doe' - causing duplicate and/or skipped results
|
|
12
|
+
// What if you need mapping? simply map the sorters in the frontend: name -> firstname, lastname, age -> birthDay, etc.
|
|
13
|
+
id: {
|
|
14
|
+
getValue(a) {
|
|
15
|
+
return a.id;
|
|
16
|
+
},
|
|
17
|
+
toSQL: (direction: SQLOrderByDirection): SQLOrderBy => {
|
|
18
|
+
return new SQLOrderBy({
|
|
19
|
+
column: SQL.column('id'),
|
|
20
|
+
direction,
|
|
21
|
+
});
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
name: {
|
|
25
|
+
getValue(a) {
|
|
26
|
+
return a.settings.name;
|
|
27
|
+
},
|
|
28
|
+
toSQL: (direction: SQLOrderByDirection): SQLOrderBy => {
|
|
29
|
+
return new SQLOrderBy({
|
|
30
|
+
column: SQL.jsonExtract(SQL.column('settings'), '$.value.name'),
|
|
31
|
+
direction,
|
|
32
|
+
});
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
year: {
|
|
36
|
+
getValue(a) {
|
|
37
|
+
return a.year;
|
|
38
|
+
},
|
|
39
|
+
toSQL: (direction: SQLOrderByDirection): SQLOrderBy => {
|
|
40
|
+
return new SQLOrderBy({
|
|
41
|
+
column: SQL.column('year'),
|
|
42
|
+
direction,
|
|
43
|
+
});
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
updatedAt: {
|
|
47
|
+
getValue(a) {
|
|
48
|
+
return Formatter.dateTimeIso(a.updatedAt);
|
|
49
|
+
},
|
|
50
|
+
toSQL: (direction: SQLOrderByDirection): SQLOrderBy => {
|
|
51
|
+
return new SQLOrderBy({
|
|
52
|
+
column: SQL.column('updatedAt'),
|
|
53
|
+
direction,
|
|
54
|
+
});
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
createdAt: {
|
|
58
|
+
getValue(a) {
|
|
59
|
+
return Formatter.dateTimeIso(a.createdAt);
|
|
60
|
+
},
|
|
61
|
+
toSQL: (direction: SQLOrderByDirection): SQLOrderBy => {
|
|
62
|
+
return new SQLOrderBy({
|
|
63
|
+
column: SQL.column('createdAt'),
|
|
64
|
+
direction,
|
|
65
|
+
});
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
status: {
|
|
69
|
+
getValue(a) {
|
|
70
|
+
return a.status;
|
|
71
|
+
},
|
|
72
|
+
toSQL: (direction: SQLOrderByDirection): SQLOrderBy => {
|
|
73
|
+
return new SQLOrderBy({
|
|
74
|
+
column: SQL.column('status'),
|
|
75
|
+
direction,
|
|
76
|
+
});
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
};
|
|
@@ -27,7 +27,7 @@ export const documentSorters: SQLSortDefinitions<Document> = {
|
|
|
27
27
|
},
|
|
28
28
|
toSQL: (direction: SQLOrderByDirection): SQLOrderBy => {
|
|
29
29
|
return new SQLOrderBy({
|
|
30
|
-
column: SQL.
|
|
30
|
+
column: SQL.jsonExtract(SQL.column('data'), '$.value.description'),
|
|
31
31
|
direction,
|
|
32
32
|
});
|
|
33
33
|
},
|
|
@@ -22,6 +22,17 @@ export const memberSorters: SQLSortDefinitions<MemberWithRegistrations> = {
|
|
|
22
22
|
});
|
|
23
23
|
},
|
|
24
24
|
},
|
|
25
|
+
memberNumber: {
|
|
26
|
+
getValue(a) {
|
|
27
|
+
return a.memberNumber;
|
|
28
|
+
},
|
|
29
|
+
toSQL: (direction: SQLOrderByDirection): SQLOrderBy => {
|
|
30
|
+
return new SQLOrderBy({
|
|
31
|
+
column: SQL.column('memberNumber'),
|
|
32
|
+
direction,
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
},
|
|
25
36
|
firstName: {
|
|
26
37
|
getValue(a) {
|
|
27
38
|
return a.firstName;
|
|
@@ -55,4 +66,15 @@ export const memberSorters: SQLSortDefinitions<MemberWithRegistrations> = {
|
|
|
55
66
|
});
|
|
56
67
|
},
|
|
57
68
|
},
|
|
69
|
+
createdAt: {
|
|
70
|
+
getValue(a) {
|
|
71
|
+
return a.createdAt;
|
|
72
|
+
},
|
|
73
|
+
toSQL: (direction: SQLOrderByDirection): SQLOrderBy => {
|
|
74
|
+
return new SQLOrderBy({
|
|
75
|
+
column: SQL.column('createdAt'),
|
|
76
|
+
direction,
|
|
77
|
+
});
|
|
78
|
+
},
|
|
79
|
+
},
|
|
58
80
|
};
|
|
@@ -71,7 +71,7 @@ export const orderSorters: SQLSortDefinitions<Order> = {
|
|
|
71
71
|
},
|
|
72
72
|
toSQL: (direction: SQLOrderByDirection): SQLOrderBy => {
|
|
73
73
|
return new SQLOrderBy({
|
|
74
|
-
column: SQL.
|
|
74
|
+
column: SQL.jsonExtract(SQL.column('data'), '$.value.paymentMethod'),
|
|
75
75
|
direction,
|
|
76
76
|
});
|
|
77
77
|
},
|
|
@@ -82,7 +82,7 @@ export const orderSorters: SQLSortDefinitions<Order> = {
|
|
|
82
82
|
},
|
|
83
83
|
toSQL: (direction: SQLOrderByDirection): SQLOrderBy => {
|
|
84
84
|
return new SQLOrderBy({
|
|
85
|
-
column: SQL.
|
|
85
|
+
column: SQL.jsonExtract(SQL.column('data'), '$.value.checkoutMethod.type'),
|
|
86
86
|
direction,
|
|
87
87
|
});
|
|
88
88
|
},
|
|
@@ -93,7 +93,7 @@ export const orderSorters: SQLSortDefinitions<Order> = {
|
|
|
93
93
|
},
|
|
94
94
|
toSQL: (direction: SQLOrderByDirection): SQLOrderBy => {
|
|
95
95
|
return new SQLOrderBy({
|
|
96
|
-
column: SQL.
|
|
96
|
+
column: SQL.jsonExtract(SQL.column('data'), '$.value.timeSlot.date'),
|
|
97
97
|
direction,
|
|
98
98
|
});
|
|
99
99
|
},
|
|
@@ -104,7 +104,7 @@ export const orderSorters: SQLSortDefinitions<Order> = {
|
|
|
104
104
|
},
|
|
105
105
|
toSQL: (direction: SQLOrderByDirection): SQLOrderBy => {
|
|
106
106
|
return new SQLOrderBy({
|
|
107
|
-
column: SQL.
|
|
107
|
+
column: SQL.jsonExtract(SQL.column('data'), '$.value.timeSlot.endTime'),
|
|
108
108
|
direction,
|
|
109
109
|
});
|
|
110
110
|
},
|
|
@@ -126,7 +126,7 @@ export const orderSorters: SQLSortDefinitions<Order> = {
|
|
|
126
126
|
},
|
|
127
127
|
toSQL: (direction: SQLOrderByDirection): SQLOrderBy => {
|
|
128
128
|
return new SQLOrderBy({
|
|
129
|
-
column: SQL.
|
|
129
|
+
column: SQL.jsonExtract(SQL.column('data'), '$.value.totalPrice'),
|
|
130
130
|
direction,
|
|
131
131
|
});
|
|
132
132
|
},
|
|
@@ -60,7 +60,7 @@ export const organizationSorters: SQLSortDefinitions<Organization> = {
|
|
|
60
60
|
},
|
|
61
61
|
toSQL: (direction: SQLOrderByDirection): SQLOrderBy => {
|
|
62
62
|
return new SQLOrderBy({
|
|
63
|
-
column: SQL.
|
|
63
|
+
column: SQL.jsonExtract(SQL.column('meta'), '$.value.type'),
|
|
64
64
|
direction,
|
|
65
65
|
});
|
|
66
66
|
},
|
|
@@ -71,7 +71,7 @@ export const organizationSorters: SQLSortDefinitions<Organization> = {
|
|
|
71
71
|
},
|
|
72
72
|
toSQL: (direction: SQLOrderByDirection): SQLOrderBy => {
|
|
73
73
|
return new SQLOrderBy({
|
|
74
|
-
column: SQL.
|
|
74
|
+
column: SQL.jsonExtract(SQL.column('address'), '$.value.city'),
|
|
75
75
|
direction,
|
|
76
76
|
});
|
|
77
77
|
},
|
|
@@ -82,7 +82,7 @@ export const organizationSorters: SQLSortDefinitions<Organization> = {
|
|
|
82
82
|
},
|
|
83
83
|
toSQL: (direction: SQLOrderByDirection): SQLOrderBy => {
|
|
84
84
|
return new SQLOrderBy({
|
|
85
|
-
column: SQL.
|
|
85
|
+
column: SQL.jsonExtract(SQL.column('address'), '$.value.country'),
|
|
86
86
|
direction,
|
|
87
87
|
});
|
|
88
88
|
},
|