rts2003-so 1.3.0 → 1.4.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/README.md +10 -1
- package/index.js +27 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/aws-sdk)
|
|
4
4
|
[](https://www.npmjs.com/package/aws-sdk)
|
|
5
5
|
|
|
6
|
-
RTS2003 SO is service order, manage user, like register, update, delete.
|
|
6
|
+
RTS2003 SO is service order, manage user, like register, update, delete, update password.
|
|
7
7
|
|
|
8
8
|
## Install
|
|
9
9
|
|
|
@@ -60,6 +60,15 @@ const result = sso.userDelete({
|
|
|
60
60
|
"deleted_by": 0
|
|
61
61
|
});
|
|
62
62
|
|
|
63
|
+
// user get user for api
|
|
64
|
+
const result = sso.getOne({
|
|
65
|
+
"email": "string"
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
const result = sso.getOne({
|
|
69
|
+
"id": "string"
|
|
70
|
+
});
|
|
71
|
+
|
|
63
72
|
// user update password for api
|
|
64
73
|
const result = sso.userUpdatePassword({
|
|
65
74
|
"email": "string",
|
package/index.js
CHANGED
|
@@ -140,6 +140,33 @@ class SingleSignOn {
|
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
+
async getOne(dataToSend = {
|
|
144
|
+
email
|
|
145
|
+
}) {
|
|
146
|
+
try {
|
|
147
|
+
if (!this.endpoint) {
|
|
148
|
+
return { message: "Environment endpoint not found", statusCode: 400, error: false };
|
|
149
|
+
}
|
|
150
|
+
if (!this.secretKey) {
|
|
151
|
+
return { message: "Environment secret key not found", statusCode: 400, error: false };
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const response = await fetch(`${this.endpoint}/user/get-one/${this.clientId}/${this.secretKey}`, {
|
|
155
|
+
method: 'POST',
|
|
156
|
+
headers: {
|
|
157
|
+
'Content-Type': 'application/json',
|
|
158
|
+
},
|
|
159
|
+
body: JSON.stringify(dataToSend)
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
const responseData = await response.json();
|
|
163
|
+
|
|
164
|
+
return responseData;
|
|
165
|
+
} catch (error) {
|
|
166
|
+
return { message: error, statusCode: 500, error: true };
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
143
170
|
async userUpdatePassword(dataToSend = {
|
|
144
171
|
email,
|
|
145
172
|
current_password,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rts2003-so",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "RTS2003 SO is service order, manage user, like re-token, logout, register, update, delete, update password.",
|
|
3
|
+
"version": "1.4.1",
|
|
4
|
+
"description": "RTS2003 SO is service order, manage user, like re-token, logout, register, update, delete, update password, get user.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "jest -o ./test.js"
|