@kne/fastify-account 1.0.0-alpha.20 → 1.0.0-alpha.21
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 +6 -6
- package/index.js +0 -1
- package/libs/controllers/requestLog.js +1 -1
- package/libs/services/tenant-user.js +5 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ npm i --save @kne/fastify-account
|
|
|
22
22
|
### API
|
|
23
23
|
|
|
24
24
|
---
|
|
25
|
-
title: "@kne/fastify-account v1.0.0-alpha.
|
|
25
|
+
title: "@kne/fastify-account v1.0.0-alpha.21"
|
|
26
26
|
language_tabs:
|
|
27
27
|
- shell: Shell
|
|
28
28
|
- http: HTTP
|
|
@@ -42,7 +42,7 @@ headingLevel: 2
|
|
|
42
42
|
|
|
43
43
|
<!-- Generator: Widdershins v4.0.1 -->
|
|
44
44
|
|
|
45
|
-
<h1 id="-kne-fastify-account">@kne/fastify-account v1.0.0-alpha.
|
|
45
|
+
<h1 id="-kne-fastify-account">@kne/fastify-account v1.0.0-alpha.21</h1>
|
|
46
46
|
|
|
47
47
|
> Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.
|
|
48
48
|
|
|
@@ -2773,9 +2773,9 @@ This operation does not require authentication
|
|
|
2773
2773
|
This operation does not require authentication
|
|
2774
2774
|
</aside>
|
|
2775
2775
|
|
|
2776
|
-
##
|
|
2776
|
+
## post__api_v1_account_tenant_getTenantOperationLogList
|
|
2777
2777
|
|
|
2778
|
-
`POST /api/v1/account/
|
|
2778
|
+
`POST /api/v1/account/tenant/getTenantOperationLogList`
|
|
2779
2779
|
|
|
2780
2780
|
*获取租户操作日志列表*
|
|
2781
2781
|
|
|
@@ -2802,7 +2802,7 @@ This operation does not require authentication
|
|
|
2802
2802
|
}
|
|
2803
2803
|
```
|
|
2804
2804
|
|
|
2805
|
-
<h3 id="
|
|
2805
|
+
<h3 id="post__api_v1_account_tenant_gettenantoperationloglist-parameters">Parameters</h3>
|
|
2806
2806
|
|
|
2807
2807
|
|Name|In|Type|Required|Description|
|
|
2808
2808
|
|---|---|---|---|---|
|
|
@@ -2812,7 +2812,7 @@ This operation does not require authentication
|
|
|
2812
2812
|
|» perPage|body|number|false|none|
|
|
2813
2813
|
|» currentPage|body|number|false|none|
|
|
2814
2814
|
|
|
2815
|
-
<h3 id="
|
|
2815
|
+
<h3 id="post__api_v1_account_tenant_gettenantoperationloglist-responses">Responses</h3>
|
|
2816
2816
|
|
|
2817
2817
|
|Status|Meaning|Description|Schema|
|
|
2818
2818
|
|---|---|---|---|
|
package/index.js
CHANGED
|
@@ -7,7 +7,6 @@ const { Unauthorized, Forbidden } = require('http-errors');
|
|
|
7
7
|
|
|
8
8
|
module.exports = fp(
|
|
9
9
|
async function (fastify, options) {
|
|
10
|
-
await fastify.sequelize.addModels(path.resolve(__dirname, './models'));
|
|
11
10
|
options = merge(
|
|
12
11
|
{
|
|
13
12
|
prefix: `/api/v${packageJson.version.split('.')[0]}/account`, //如果为true,发送邮件和短信将不调用,验证码随response返回
|
|
@@ -40,7 +40,7 @@ module.exports = fp(async (fastify, options) => {
|
|
|
40
40
|
);
|
|
41
41
|
|
|
42
42
|
fastify.post(
|
|
43
|
-
`${options.prefix}/
|
|
43
|
+
`${options.prefix}/tenant/getTenantOperationLogList`,
|
|
44
44
|
{
|
|
45
45
|
onRequest: [authenticate.user, authenticate.tenant],
|
|
46
46
|
schema: {
|
|
@@ -139,12 +139,16 @@ module.exports = fp(async (fastify, options) => {
|
|
|
139
139
|
};
|
|
140
140
|
|
|
141
141
|
const getTenantUserByUserId = async ({ userInfo: user, appName }) => {
|
|
142
|
-
if (!user
|
|
142
|
+
if (!user?.currentTenantId) {
|
|
143
143
|
throw new Unauthorized('没有找到当前绑定租户');
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
const tenant = await services.tenant.getTenant({ id: user.currentTenantId });
|
|
147
147
|
|
|
148
|
+
if (!tenant) {
|
|
149
|
+
throw new Error('当前租户不能使用');
|
|
150
|
+
}
|
|
151
|
+
|
|
148
152
|
const tenantApplications = await services.application.getApplicationList({ tenantId: tenant.id, appName });
|
|
149
153
|
|
|
150
154
|
if (appName && !tenantApplications.some(item => item.code === appName)) {
|