larvituser
Advanced tools
Comparing version 0.21.23 to 0.21.24
@@ -8,5 +8,13 @@ import { LogInstance } from 'larvitutils'; | ||
showInactiveOnly?: boolean; | ||
matchDateFields?: [ | ||
{ | ||
field: string; | ||
value: string | Array<string>; | ||
operation?: 'gt' | 'lt' | 'eq'; | ||
} | ||
]; | ||
matchAllFields?: Record<string, string | Array<string>>; | ||
matchAllFieldsQ?: Record<string, string | Array<string>>; | ||
matchExistingFields?: string[]; | ||
matchFieldHasValue?: string[]; | ||
offset?: string; | ||
@@ -13,0 +21,0 @@ order?: { |
@@ -54,2 +54,13 @@ "use strict"; | ||
} | ||
if (options.matchFieldHasValue && options.matchFieldHasValue.length) { | ||
sqlWhere += 'AND uuid IN (\n'; | ||
sqlWhere += 'SELECT userUuid FROM user_users_data WHERE fieldUuid IN (\n'; | ||
sqlWhere += 'SELECT uuid FROM user_data_fields WHERE\n'; | ||
for (const matchFieldHasValue of options.matchFieldHasValue) { | ||
sqlWhere += 'name = ? OR '; | ||
dbFields.push(matchFieldHasValue); | ||
} | ||
sqlWhere = sqlWhere.substring(0, sqlWhere.length - 4) + ')\n'; | ||
sqlWhere += 'AND data IS NOT NULL AND data != "")\n'; | ||
} | ||
if (options.matchAllFields && Object.keys(options.matchAllFields).length) { | ||
@@ -71,2 +82,23 @@ for (const field in options.matchAllFields) { | ||
} | ||
if (options.matchDateFields && options.matchDateFields.length) { | ||
for (const matchExistingDateField of options.matchDateFields) { | ||
const operation = matchExistingDateField.operation || 'eq'; | ||
const value = matchExistingDateField.value; | ||
const field = matchExistingDateField.field; | ||
if (!value) | ||
continue; | ||
if (!field) | ||
continue; | ||
sqlWhere += 'AND uuid IN (SELECT userUuid FROM user_users_data WHERE data '; | ||
if (operation === 'eq') | ||
sqlWhere += '= ?\n'; | ||
else if (operation === 'gt') | ||
sqlWhere += '> ?\n'; | ||
else if (operation === 'lt') | ||
sqlWhere += '< ?\n'; | ||
sqlWhere += ' AND fieldUuid = (SELECT uuid FROM user_data_fields WHERE name = ?))\n'; | ||
dbFields.push(value); | ||
dbFields.push(field); | ||
} | ||
} | ||
if (options.q) { | ||
@@ -73,0 +105,0 @@ sqlWhere += ' AND (\n'; |
{ | ||
"name": "larvituser", | ||
"version": "0.21.23", | ||
"version": "0.21.24", | ||
"author": { | ||
@@ -12,4 +12,4 @@ "name": "Mikael 'Lilleman' Göransson", | ||
"bcryptjs": "2.4.3", | ||
"larvitdbmigration": "7.0.95", | ||
"larvitutils": "5.1.77", | ||
"larvitdbmigration": "7.0.96", | ||
"larvitutils": "5.1.78", | ||
"uuid": "9.0.1" | ||
@@ -22,9 +22,9 @@ }, | ||
"@types/mocha": "10.0.6", | ||
"@types/node": "20.11.20", | ||
"@types/node": "20.11.24", | ||
"@types/uuid": "9.0.8", | ||
"@typescript-eslint/eslint-plugin": "7.0.2", | ||
"@typescript-eslint/parser": "7.0.2", | ||
"@typescript-eslint/eslint-plugin": "7.1.0", | ||
"@typescript-eslint/parser": "7.1.0", | ||
"eslint": "8.57.0", | ||
"freeport": "1.0.5", | ||
"larvitdb": "3.2.76", | ||
"larvitdb": "3.2.77", | ||
"mocha": "10.3.0", | ||
@@ -31,0 +31,0 @@ "mocha-eslint": "7.0.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
109212
1414
+ Addedlarvitdbmigration@7.0.96(transitive)
+ Addedlarvitutils@5.1.78(transitive)
- Removedlarvitdbmigration@7.0.95(transitive)
- Removedlarvitutils@5.1.76(transitive)
Updatedlarvitdbmigration@7.0.96
Updatedlarvitutils@5.1.78