nuxt-users 1.23.0 → 1.23.1
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/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
## v1.23.1
|
|
5
|
+
|
|
6
|
+
[compare changes](https://github.com/rrd108/nuxt-users/compare/v1.23.0...v1.23.1)
|
|
7
|
+
|
|
8
|
+
### 🩹 Fixes
|
|
9
|
+
|
|
10
|
+
- User patch sql error ([aa506dd](https://github.com/rrd108/nuxt-users/commit/aa506dd))
|
|
11
|
+
|
|
12
|
+
### 💅 Refactors
|
|
13
|
+
|
|
14
|
+
- Change css class name ([1bc28ba](https://github.com/rrd108/nuxt-users/commit/1bc28ba))
|
|
15
|
+
|
|
16
|
+
### ✅ Tests
|
|
17
|
+
|
|
18
|
+
- New test script added ([618b8dc](https://github.com/rrd108/nuxt-users/commit/618b8dc))
|
|
19
|
+
|
|
20
|
+
### ❤️ Contributors
|
|
21
|
+
|
|
22
|
+
- Rrd108 ([@rrd108](https://github.com/rrd108))
|
|
23
|
+
|
|
4
24
|
## v1.23.0
|
|
5
25
|
|
|
6
26
|
[compare changes](https://github.com/rrd108/nuxt-users/compare/v1.22.0...v1.23.0)
|
package/dist/module.json
CHANGED
|
@@ -72,28 +72,21 @@ export const updateUser = async (id, userData, options) => {
|
|
|
72
72
|
const db = await useDb(options);
|
|
73
73
|
const usersTable = options.tables.users;
|
|
74
74
|
const allowedFields = ["name", "email", "role", "active"];
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
for (const field of allowedFields) {
|
|
78
|
-
if (userData[field] !== void 0) {
|
|
79
|
-
updates.push(`${field} = ?`);
|
|
80
|
-
values.push(userData[field]);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
if (userData.active === false) {
|
|
84
|
-
await revokeUserTokens(id, options);
|
|
85
|
-
}
|
|
86
|
-
if (updates.length === 0) {
|
|
75
|
+
const fieldsToUpdate = allowedFields.filter((field) => userData[field] !== void 0);
|
|
76
|
+
if (fieldsToUpdate.length === 0) {
|
|
87
77
|
const currentUser = await findUserById(id, options);
|
|
88
78
|
if (!currentUser) {
|
|
89
79
|
throw new Error("User not found.");
|
|
90
80
|
}
|
|
91
81
|
return currentUser;
|
|
92
82
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
83
|
+
if (userData.active === false) {
|
|
84
|
+
await revokeUserTokens(id, options);
|
|
85
|
+
}
|
|
86
|
+
for (const field of fieldsToUpdate) {
|
|
87
|
+
await db.sql`UPDATE {${usersTable}} SET {${field}} = ${userData[field]} WHERE id = ${id}`;
|
|
88
|
+
}
|
|
89
|
+
await db.sql`UPDATE {${usersTable}} SET updated_at = CURRENT_TIMESTAMP WHERE id = ${id}`;
|
|
97
90
|
const updatedUser = await findUserById(id, options);
|
|
98
91
|
if (!updatedUser) {
|
|
99
92
|
throw new Error("Failed to retrieve updated user.");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-users",
|
|
3
|
-
"version": "1.23.
|
|
3
|
+
"version": "1.23.1",
|
|
4
4
|
"description": "A comprehensive user management module for Nuxt 3 and Nuxt 4 applications with authentication, authorization, database support, and CLI tools",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nuxt",
|
|
@@ -66,6 +66,7 @@
|
|
|
66
66
|
"lint": "eslint .",
|
|
67
67
|
"lint:fix": "eslint . --fix",
|
|
68
68
|
"pretest": "node -v | grep -q 'v22' || (echo 'Please use Node.js v22 for testing' && exit 1)",
|
|
69
|
+
"test:release": "yarn test:types && yarn test:unit && yarn test:sqlite && yarn build && yarn lint:fix",
|
|
69
70
|
"test:types": "yarn dev:prepare && vue-tsc --noEmit && cd playground && vue-tsc --noEmit",
|
|
70
71
|
"test:unit": "./scripts/test-unit.sh",
|
|
71
72
|
"test:sqlite": "./scripts/test-sqlite.sh",
|