@kne/fastify-account 1.0.0-alpha.4 → 1.0.0-alpha.6

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 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.3"
25
+ title: "@kne/fastify-account v1.0.0-alpha.4"
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.3</h1>
45
+ <h1 id="-kne-fastify-account">@kne/fastify-account v1.0.0-alpha.4</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
 
@@ -46,16 +46,12 @@ module.exports = fp(async (fastify, options) => {
46
46
  const output = [];
47
47
  const core = (list, node) => {
48
48
  const { children, other } = groupBy(list, item => (item.pid === node.id ? 'children' : 'other'));
49
- if (!(other && other.length > 0)) {
50
- return;
51
- }
52
49
  if (!(children && children.length > 0)) {
53
50
  node.id !== 0 && output.push(node);
54
51
  return;
55
52
  }
56
-
57
53
  children.forEach(node => {
58
- core(other, node);
54
+ core(other || [], node);
59
55
  });
60
56
  return output;
61
57
  };
@@ -116,8 +112,8 @@ module.exports = fp(async (fastify, options) => {
116
112
  const currentTenant = currentTenantUser && tenantList.find(({ uuid }) => uuid === currentTenantUser.tenantId);
117
113
 
118
114
  return {
119
- currentTenant: currentTenant && Object.assign({}, currentTenant, { id: currentTenant.uuid }),
120
- currentTenantUser: currentTenantUser && Object.assign({}, currentTenantUser, { id: currentTenantUser.uuid }),
115
+ currentTenant: currentTenant && Object.assign({}, currentTenant.get({ plain: true }), { id: currentTenant.uuid }),
116
+ currentTenantUser: currentTenantUser && Object.assign({}, currentTenantUser.get({ plain: true }), { id: currentTenantUser.uuid }),
121
117
  tenantList: tenantList.map(item => {
122
118
  return Object.assign({}, item.get({ plain: true }), { id: item.uuid });
123
119
  }),
@@ -148,7 +144,7 @@ module.exports = fp(async (fastify, options) => {
148
144
  const tenant = await services.tenant.getTenant({ id: user.currentTenantId });
149
145
 
150
146
  const tenantUser = await models.tenantUser.findOne({
151
- attributes: ['uuid', 'avatar', 'description', 'phone', 'email'],
147
+ attributes: ['uuid', 'avatar', 'name', 'description', 'phone', 'email'],
152
148
  include: [
153
149
  {
154
150
  attributes: ['id', 'name'],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kne/fastify-account",
3
- "version": "1.0.0-alpha.4",
3
+ "version": "1.0.0-alpha.6",
4
4
  "description": "fastify的用户管理账号等实现",
5
5
  "main": "index.js",
6
6
  "scripts": {