@kne/fastify-account 1.0.0-alpha.15 → 1.0.0-alpha.16

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.
@@ -17,8 +17,16 @@ module.exports = fp(async (fastify, options) => {
17
17
  };
18
18
 
19
19
  const addTenantOrg = async org => {
20
- if (await models.tenantOrg.count({ where: { name: org.name } })) {
21
- throw new Error('组织名称不能重复');
20
+ if (
21
+ await models.tenantOrg.count({
22
+ where: {
23
+ name: org.name,
24
+ pid: org.pid,
25
+ tenantId: org.tenantId
26
+ }
27
+ })
28
+ ) {
29
+ throw new Error('组织名称在同一父组织下有重复');
22
30
  }
23
31
 
24
32
  return await models.tenantOrg.create({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kne/fastify-account",
3
- "version": "1.0.0-alpha.15",
3
+ "version": "1.0.0-alpha.16",
4
4
  "description": "fastify的用户管理账号等实现",
5
5
  "main": "index.js",
6
6
  "scripts": {