ti2 1.0.38 → 1.0.39
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/api.yml +29 -0
- package/controllers/__tests__/admin.js +7 -0
- package/controllers/admin.js +10 -0
- package/package.json +1 -1
package/api.yml
CHANGED
|
@@ -132,6 +132,20 @@ components:
|
|
|
132
132
|
type: string
|
|
133
133
|
updatedAt:
|
|
134
134
|
type: string
|
|
135
|
+
UserList:
|
|
136
|
+
type: object
|
|
137
|
+
properties:
|
|
138
|
+
users:
|
|
139
|
+
type: array
|
|
140
|
+
items:
|
|
141
|
+
type: object
|
|
142
|
+
properties:
|
|
143
|
+
userId:
|
|
144
|
+
type: string
|
|
145
|
+
createdAt:
|
|
146
|
+
type: string
|
|
147
|
+
updatedAt:
|
|
148
|
+
type: string
|
|
135
149
|
AppTokenList:
|
|
136
150
|
type: object
|
|
137
151
|
properties:
|
|
@@ -419,6 +433,21 @@ paths:
|
|
|
419
433
|
application/json:
|
|
420
434
|
schema:
|
|
421
435
|
$ref: '#/components/schemas/IntegrationList'
|
|
436
|
+
/users:
|
|
437
|
+
get:
|
|
438
|
+
security:
|
|
439
|
+
- bearerAuth: ['admin']
|
|
440
|
+
tags:
|
|
441
|
+
- admin
|
|
442
|
+
summary: list all created users
|
|
443
|
+
operationId: listUsers
|
|
444
|
+
responses:
|
|
445
|
+
200:
|
|
446
|
+
description: success
|
|
447
|
+
content:
|
|
448
|
+
application/json:
|
|
449
|
+
schema:
|
|
450
|
+
$ref: '#/components/schemas/UserList'
|
|
422
451
|
/app/resetAppKey/{appKey}:
|
|
423
452
|
get:
|
|
424
453
|
security:
|
|
@@ -59,4 +59,11 @@ describe('admin', () => {
|
|
|
59
59
|
});
|
|
60
60
|
expect(value).toBeTruthy();
|
|
61
61
|
});
|
|
62
|
+
it('the created user should be on the user list', async () => {
|
|
63
|
+
const { users } = await doApiGet({
|
|
64
|
+
url: '/users',
|
|
65
|
+
token: adminKey,
|
|
66
|
+
});
|
|
67
|
+
expect(users.find(currentUser => currentUser.userId === userId)).toBeTruthy();
|
|
68
|
+
});
|
|
62
69
|
});
|
package/controllers/admin.js
CHANGED
|
@@ -60,6 +60,15 @@ const listApps = async (req, res, next) => {
|
|
|
60
60
|
}
|
|
61
61
|
};
|
|
62
62
|
|
|
63
|
+
const listUsers = async (req, res, next) => {
|
|
64
|
+
try {
|
|
65
|
+
const users = await sqldb.User.findAll();
|
|
66
|
+
return res.json({ users });
|
|
67
|
+
} catch (err) {
|
|
68
|
+
return next(err);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
63
72
|
const createUserToken = async (req, res, next) => {
|
|
64
73
|
const {
|
|
65
74
|
body: {
|
|
@@ -140,6 +149,7 @@ module.exports = {
|
|
|
140
149
|
createUserToken,
|
|
141
150
|
deleteApp,
|
|
142
151
|
listApps,
|
|
152
|
+
listUsers,
|
|
143
153
|
migrate,
|
|
144
154
|
resetIntegrationToken,
|
|
145
155
|
};
|