@tachybase/module-hera 1.9.22 → 1.9.40

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.
Files changed (118) hide show
  1. package/dist/client/index.js +15 -26
  2. package/dist/externalVersion.js +8 -10
  3. package/dist/node_modules/fs-extra/package.json +1 -1
  4. package/dist/server/actions/index.d.ts +0 -2
  5. package/dist/server/actions/index.js +1 -5
  6. package/dist/server/migrations/20250102010713-add-plugin-department.d.ts +6 -0
  7. package/dist/server/{middlewares/set-department-owners.js → migrations/20250102010713-add-plugin-department.js} +22 -41
  8. package/dist/server/plugin.js +0 -2
  9. package/package.json +14 -14
  10. package/dist/client/features/departments/common/DepartmentTable.schema.d.ts +0 -50
  11. package/dist/client/features/departments/common/DepartmentTable.view.d.ts +0 -4
  12. package/dist/client/features/departments/common/FilterKeys.context.d.ts +0 -10
  13. package/dist/client/features/departments/common/InternalDepartmentTable.d.ts +0 -5
  14. package/dist/client/features/departments/common/Request.povider.d.ts +0 -1
  15. package/dist/client/features/departments/common/UserDepartmentsFieldNotSupport.d.ts +0 -2
  16. package/dist/client/features/departments/common/scopes/useDepartmentFilterActionProps.d.ts +0 -5
  17. package/dist/client/features/departments/common/scopes/useFilterActionProps.d.ts +0 -5
  18. package/dist/client/features/departments/index.d.ts +0 -5
  19. package/dist/client/features/departments/main-tab/DepartmentIndex.d.ts +0 -5
  20. package/dist/client/features/departments/main-tab/DepartmentIndex.provider.d.ts +0 -3
  21. package/dist/client/features/departments/main-tab/DepartmentManagement.component.d.ts +0 -1
  22. package/dist/client/features/departments/main-tab/DepartmentManagement.schema.d.ts +0 -10
  23. package/dist/client/features/departments/main-tab/DepartmentManagement.view.d.ts +0 -1
  24. package/dist/client/features/departments/main-tab/collections/departments.collection.d.ts +0 -128
  25. package/dist/client/features/departments/main-tab/collections/users.collection.d.ts +0 -189
  26. package/dist/client/features/departments/main-tab/components/DepartmentSelect.d.ts +0 -1
  27. package/dist/client/features/departments/main-tab/components/InternalSuperiorDepartmentSelect.d.ts +0 -1
  28. package/dist/client/features/departments/main-tab/components/SuperiorDepartmentSelect.d.ts +0 -1
  29. package/dist/client/features/departments/main-tab/context/Department.context.d.ts +0 -23
  30. package/dist/client/features/departments/main-tab/context/DepartmentsExpanded.context.d.ts +0 -17
  31. package/dist/client/features/departments/main-tab/departments-block/AddNewDepartment.schema.d.ts +0 -67
  32. package/dist/client/features/departments/main-tab/departments-block/AddNewDepartment.view.d.ts +0 -1
  33. package/dist/client/features/departments/main-tab/departments-block/DepartmentOwnersField.component.d.ts +0 -5
  34. package/dist/client/features/departments/main-tab/departments-block/DepartmentsBlock.d.ts +0 -1
  35. package/dist/client/features/departments/main-tab/departments-block/DepartmentsSearch.component.d.ts +0 -1
  36. package/dist/client/features/departments/main-tab/departments-block/DepartmentsTree.component.d.ts +0 -8
  37. package/dist/client/features/departments/main-tab/departments-block/Request.provider.d.ts +0 -1
  38. package/dist/client/features/departments/main-tab/departments-block/UnknownOwerns.schema.d.ts +0 -136
  39. package/dist/client/features/departments/main-tab/departments-block/UnknownOwerns.view.d.ts +0 -1
  40. package/dist/client/features/departments/main-tab/departments-block/schemas/schemaDepartmentEdit.d.ts +0 -62
  41. package/dist/client/features/departments/main-tab/departments-block/schemas/schemaDepartmentNewSub.d.ts +0 -57
  42. package/dist/client/features/departments/main-tab/departments-block/scopes/useCreateDepartment.d.ts +0 -3
  43. package/dist/client/features/departments/main-tab/departments-block/scopes/useUpdateDepartment.d.ts +0 -3
  44. package/dist/client/features/departments/main-tab/departments-users-block/AddMembers.schema.d.ts +0 -148
  45. package/dist/client/features/departments/main-tab/departments-users-block/AddMembers.view.d.ts +0 -1
  46. package/dist/client/features/departments/main-tab/departments-users-block/DepartmentField.component.d.ts +0 -1
  47. package/dist/client/features/departments/main-tab/departments-users-block/DepartmentsUsersBlock.d.ts +0 -1
  48. package/dist/client/features/departments/main-tab/departments-users-block/DepartmentsUsersBlock.schema.d.ts +0 -676
  49. package/dist/client/features/departments/main-tab/departments-users-block/IsOwnerField.component.d.ts +0 -1
  50. package/dist/client/features/departments/main-tab/departments-users-block/MemberActions.schema.d.ts +0 -49
  51. package/dist/client/features/departments/main-tab/departments-users-block/MemberActions.view.d.ts +0 -1
  52. package/dist/client/features/departments/main-tab/departments-users-block/RowRemoveAction.schema.d.ts +0 -16
  53. package/dist/client/features/departments/main-tab/departments-users-block/RowRemoveAction.view.d.ts +0 -1
  54. package/dist/client/features/departments/main-tab/departments-users-block/UserDepartmentsField.component.d.ts +0 -1
  55. package/dist/client/features/departments/main-tab/departments-users-block/UserSelectDepartment.schema.d.ts +0 -42
  56. package/dist/client/features/departments/main-tab/departments-users-block/UserSelectDepartment.view.d.ts +0 -1
  57. package/dist/client/features/departments/main-tab/departments-users-block/scopes/useBulkRemoveMembersAction.d.ts +0 -3
  58. package/dist/client/features/departments/main-tab/departments-users-block/scopes/useDataSource.d.ts +0 -40
  59. package/dist/client/features/departments/main-tab/departments-users-block/scopes/useMembersDataSource.d.ts +0 -6
  60. package/dist/client/features/departments/main-tab/departments-users-block/scopes/usePropsAddMember.d.ts +0 -1
  61. package/dist/client/features/departments/main-tab/departments-users-block/scopes/useRefreshActionProps.d.ts +0 -3
  62. package/dist/client/features/departments/main-tab/departments-users-block/scopes/useRemoveMemberAction.d.ts +0 -3
  63. package/dist/client/features/departments/main-tab/departments-users-block/scopes/useShowTotal.d.ts +0 -1
  64. package/dist/client/features/departments/main-tab/hooks/useDeepTree.d.ts +0 -14
  65. package/dist/client/features/departments/main-tab/hooks/useGetDepTree.d.ts +0 -18
  66. package/dist/client/features/departments/main-tab/kit.d.ts +0 -4
  67. package/dist/client/features/departments/main-tab/providers/DepartmentsResource.provider.d.ts +0 -3
  68. package/dist/client/features/departments/main-tab/providers/UserResource.provider.d.ts +0 -3
  69. package/dist/client/features/departments/role-auth/DepartmentTitle.component.d.ts +0 -1
  70. package/dist/client/features/departments/role-auth/Departments.d.ts +0 -1
  71. package/dist/client/features/departments/role-auth/Departments.schema.d.ts +0 -227
  72. package/dist/client/features/departments/role-auth/kit.d.ts +0 -4
  73. package/dist/client/features/departments/role-auth/scopes/useAddDepartments.d.ts +0 -3
  74. package/dist/client/features/departments/role-auth/scopes/useBulkRemoveDepartments.d.ts +0 -3
  75. package/dist/client/features/departments/role-auth/scopes/useDataSource.d.ts +0 -40
  76. package/dist/client/features/departments/role-auth/scopes/useDisabled.d.ts +0 -3
  77. package/dist/client/features/departments/role-auth/scopes/useRemoveDepartment.d.ts +0 -3
  78. package/dist/client/features/departments/settings/DepartmentOwnersFieldSetting.d.ts +0 -2
  79. package/dist/client/features/departments/settings/UserDepartmentsFieldSetting.d.ts +0 -2
  80. package/dist/client/features/departments/settings/UserMainDepartmentFieldSetting.d.ts +0 -2
  81. package/dist/client/features/departments/settings/items/enableLinkItem.d.ts +0 -2
  82. package/dist/client/features/departments/settings/items/modeSelectItem.d.ts +0 -2
  83. package/dist/client/features/departments/settings/items/titleFieldItem.d.ts +0 -2
  84. package/dist/client/features/departments/utils/getDepartmentStr.d.ts +0 -1
  85. package/dist/client/features/departments/utils/getUserListByDepartment.d.ts +0 -1
  86. package/dist/server/actions/departments.d.ts +0 -5
  87. package/dist/server/actions/departments.js +0 -105
  88. package/dist/server/actions/users.d.ts +0 -4
  89. package/dist/server/actions/users.js +0 -142
  90. package/dist/server/collections/departmentRoles.d.ts +0 -2
  91. package/dist/server/collections/departmentRoles.js +0 -27
  92. package/dist/server/collections/departments.d.ts +0 -29
  93. package/dist/server/collections/departments.js +0 -162
  94. package/dist/server/collections/departmentsUsers.d.ts +0 -2
  95. package/dist/server/collections/departmentsUsers.js +0 -43
  96. package/dist/server/collections/roles.d.ts +0 -2
  97. package/dist/server/collections/roles.js +0 -39
  98. package/dist/server/collections/users.d.ts +0 -55
  99. package/dist/server/collections/users.js +0 -87
  100. package/dist/server/features/departments.d.ts +0 -7
  101. package/dist/server/features/departments.js +0 -132
  102. package/dist/server/middlewares/destroy-department-check.d.ts +0 -2
  103. package/dist/server/middlewares/destroy-department-check.js +0 -53
  104. package/dist/server/middlewares/index.d.ts +0 -6
  105. package/dist/server/middlewares/index.js +0 -31
  106. package/dist/server/middlewares/list-users-include-child-department.d.ts +0 -2
  107. package/dist/server/middlewares/list-users-include-child-department.js +0 -77
  108. package/dist/server/middlewares/reset-user-departments-cache.d.ts +0 -2
  109. package/dist/server/middlewares/reset-user-departments-cache.js +0 -39
  110. package/dist/server/middlewares/set-department-owners.d.ts +0 -2
  111. package/dist/server/middlewares/set-departments-roles.d.ts +0 -2
  112. package/dist/server/middlewares/set-departments-roles.js +0 -64
  113. package/dist/server/middlewares/set-main-department.d.ts +0 -2
  114. package/dist/server/middlewares/set-main-department.js +0 -105
  115. package/dist/server/middlewares/update-department-isleaf.d.ts +0 -2
  116. package/dist/server/middlewares/update-department-isleaf.js +0 -84
  117. package/dist/server/models/department.d.ts +0 -4
  118. package/dist/server/models/department.js +0 -38
@@ -1,105 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var departments_exports = {};
19
- __export(departments_exports, {
20
- aggregateSearch: () => aggregateSearch,
21
- getAppendsOwners: () => getAppendsOwners,
22
- removeOwner: () => removeOwner,
23
- setOwner: () => setOwner
24
- });
25
- module.exports = __toCommonJS(departments_exports);
26
- const getAppendsOwners = async (ctx, next) => {
27
- const { filterByTk, appends } = ctx.action.params;
28
- const repo = ctx.db.getRepository("departments");
29
- const department = await repo.findOne({
30
- filterByTk,
31
- appends
32
- });
33
- const owners = await department.getOwners();
34
- department.setDataValue("owners", owners);
35
- ctx.body = department;
36
- await next();
37
- };
38
- const aggregateSearch = async (ctx, next) => {
39
- const { keyword, type, last = 0, limit = 10 } = ctx.action.params.values || {};
40
- let users = [];
41
- let departments = [];
42
- if (!type || type === "user") {
43
- const repo = ctx.db.getRepository("users");
44
- users = await repo.find({
45
- filter: {
46
- id: { $gt: last },
47
- $or: [
48
- { username: { $includes: keyword } },
49
- { nickname: { $includes: keyword } },
50
- { phone: { $includes: keyword } },
51
- { email: { $includes: keyword } }
52
- ]
53
- },
54
- limit
55
- });
56
- }
57
- if (!type || type === "department") {
58
- const repo = ctx.db.getRepository("departments");
59
- departments = await repo.find({
60
- filter: {
61
- id: { $gt: last },
62
- title: { $includes: keyword }
63
- },
64
- appends: ["parent(recursively=true)"],
65
- limit
66
- });
67
- }
68
- ctx.body = { users, departments };
69
- await next();
70
- };
71
- const setOwner = async (ctx, next) => {
72
- const { userId, departmentId } = ctx.action.params.values || {};
73
- const throughRepo = ctx.db.getRepository("departmentsUsers");
74
- await throughRepo.update({
75
- filter: {
76
- userId,
77
- departmentId
78
- },
79
- values: {
80
- isOwner: true
81
- }
82
- });
83
- await next();
84
- };
85
- const removeOwner = async (ctx, next) => {
86
- const { userId, departmentId } = ctx.action.params.values || {};
87
- const throughRepo = ctx.db.getRepository("departmentsUsers");
88
- await throughRepo.update({
89
- filter: {
90
- userId,
91
- departmentId
92
- },
93
- values: {
94
- isOwner: false
95
- }
96
- });
97
- await next();
98
- };
99
- // Annotate the CommonJS export names for ESM import in node:
100
- 0 && (module.exports = {
101
- aggregateSearch,
102
- getAppendsOwners,
103
- removeOwner,
104
- setOwner
105
- });
@@ -1,4 +0,0 @@
1
- import { type Context, type Next } from '@tachybase/actions';
2
- export declare const listExcludeDept: (ctx: Context, next: Next) => Promise<void>;
3
- export declare const setDepartments: (ctx: Context, next: Next) => Promise<void>;
4
- export declare const setMainDepartment: (ctx: Context, next: Next) => Promise<void>;
@@ -1,142 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var users_exports = {};
19
- __export(users_exports, {
20
- listExcludeDept: () => listExcludeDept,
21
- setDepartments: () => setDepartments,
22
- setMainDepartment: () => setMainDepartment
23
- });
24
- module.exports = __toCommonJS(users_exports);
25
- var import_actions = require("@tachybase/actions");
26
- const listExcludeDept = async (ctx, next) => {
27
- const { departmentId, page = import_actions.DEFAULT_PAGE, pageSize = import_actions.DEFAULT_PER_PAGE } = ctx.action.params;
28
- const repo = ctx.db.getRepository("users");
29
- const members = await repo.find({
30
- fields: ["id"],
31
- filter: {
32
- "departments.id": departmentId
33
- }
34
- });
35
- const memberIds = members.map((member) => member.id);
36
- if (memberIds.length) {
37
- ctx.action.mergeParams({
38
- filter: {
39
- id: {
40
- $notIn: memberIds
41
- }
42
- }
43
- });
44
- }
45
- const { filter } = ctx.action.params;
46
- const [rows, count] = await repo.findAndCount({
47
- context: ctx,
48
- offset: (page - 1) * pageSize,
49
- limit: pageSize,
50
- filter
51
- });
52
- ctx.body = {
53
- count,
54
- rows,
55
- page: Number(page),
56
- pageSize: Number(pageSize),
57
- totalPage: Math.ceil(count / pageSize)
58
- };
59
- await next();
60
- };
61
- const setDepartments = async (ctx, next) => {
62
- const { values = {} } = ctx.action.params;
63
- const { userId, departments = [] } = values;
64
- const repo = ctx.db.getRepository("users");
65
- const throughRepo = ctx.db.getRepository("departmentsUsers");
66
- const user = await repo.findOne({ filterByTk: userId });
67
- if (!user) {
68
- ctx.throw(400, ctx.t("User does not exist"));
69
- }
70
- const departmentIds = departments.map((department) => department.id);
71
- const main = departments.find((department) => department.isMain);
72
- const owners = departments.filter((department) => department.isOwner);
73
- await ctx.db.sequelize.transaction(async (t) => {
74
- await user.setDepartments(departmentIds, {
75
- through: {
76
- isMain: false,
77
- isOwner: false
78
- },
79
- transaction: t
80
- });
81
- if (main) {
82
- await throughRepo.update({
83
- filter: {
84
- userId,
85
- departmentId: main.id
86
- },
87
- values: {
88
- isMain: true
89
- },
90
- transaction: t
91
- });
92
- }
93
- if (owners.length) {
94
- await throughRepo.update({
95
- filter: {
96
- userId,
97
- departmentId: {
98
- $in: owners.map((owner) => owner.id)
99
- }
100
- },
101
- values: {
102
- isOwner: true
103
- },
104
- transaction: t
105
- });
106
- }
107
- });
108
- await next();
109
- };
110
- const setMainDepartment = async (ctx, next) => {
111
- const { userId, departmentId } = ctx.action.params.values || {};
112
- const throughRepo = ctx.db.getRepository("departmentsUsers");
113
- await ctx.db.sequelize.transaction(async (t) => {
114
- await throughRepo.update({
115
- filter: {
116
- userId,
117
- isMain: true
118
- },
119
- values: {
120
- isMain: false
121
- },
122
- transaction: t
123
- });
124
- await throughRepo.update({
125
- filter: {
126
- userId,
127
- departmentId
128
- },
129
- values: {
130
- isMain: true
131
- },
132
- transaction: t
133
- });
134
- });
135
- await next();
136
- };
137
- // Annotate the CommonJS export names for ESM import in node:
138
- 0 && (module.exports = {
139
- listExcludeDept,
140
- setDepartments,
141
- setMainDepartment
142
- });
@@ -1,2 +0,0 @@
1
- declare const _default: import("@tachybase/database").CollectionOptions;
2
- export default _default;
@@ -1,27 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var departmentRoles_exports = {};
19
- __export(departmentRoles_exports, {
20
- default: () => departmentRoles_default
21
- });
22
- module.exports = __toCommonJS(departmentRoles_exports);
23
- var import_database = require("@tachybase/database");
24
- var departmentRoles_default = (0, import_database.defineCollection)({
25
- name: "departmentsRoles",
26
- dumpRules: "required"
27
- });
@@ -1,29 +0,0 @@
1
- export declare const ownersField: {
2
- interface: string;
3
- type: string;
4
- name: string;
5
- collectionName: string;
6
- target: string;
7
- through: string;
8
- foreignKey: string;
9
- otherKey: string;
10
- targetKey: string;
11
- sourceKey: string;
12
- throughScope: {
13
- isOwner: boolean;
14
- };
15
- uiSchema: {
16
- type: string;
17
- title: string;
18
- 'x-component': string;
19
- 'x-component-props': {
20
- multiple: boolean;
21
- fieldNames: {
22
- label: string;
23
- value: string;
24
- };
25
- };
26
- };
27
- };
28
- declare const _default: import("@tachybase/database").CollectionOptions;
29
- export default _default;
@@ -1,162 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var departments_exports = {};
19
- __export(departments_exports, {
20
- default: () => departments_default,
21
- ownersField: () => ownersField
22
- });
23
- module.exports = __toCommonJS(departments_exports);
24
- var import_database = require("@tachybase/database");
25
- const ownersField = {
26
- interface: "m2m",
27
- type: "belongsToMany",
28
- name: "owners",
29
- collectionName: "departments",
30
- target: "users",
31
- through: "departmentsUsers",
32
- foreignKey: "departmentId",
33
- otherKey: "userId",
34
- targetKey: "id",
35
- sourceKey: "id",
36
- throughScope: {
37
- isOwner: true
38
- },
39
- uiSchema: {
40
- type: "m2m",
41
- title: '{{t("Owners")}}',
42
- "x-component": "DepartmentOwnersField",
43
- "x-component-props": {
44
- multiple: true,
45
- fieldNames: {
46
- label: "nickname",
47
- value: "id"
48
- }
49
- }
50
- }
51
- };
52
- var departments_default = (0, import_database.defineCollection)({
53
- name: "departments",
54
- title: '{{t("Departments")}}',
55
- dumpRules: "required",
56
- tree: "adjacency-list",
57
- template: "tree",
58
- shared: true,
59
- sortable: true,
60
- model: "DepartmentModel",
61
- createdBy: true,
62
- updatedBy: true,
63
- logging: true,
64
- fields: [
65
- {
66
- type: "bigInt",
67
- name: "id",
68
- primaryKey: true,
69
- autoIncrement: true,
70
- interface: "id",
71
- uiSchema: {
72
- type: "number",
73
- title: '{{t("ID")}}',
74
- "x-component": "InputNumber",
75
- "x-read-pretty": true
76
- }
77
- },
78
- {
79
- type: "string",
80
- name: "title",
81
- interface: "input",
82
- uiSchema: {
83
- type: "string",
84
- title: '{{t("Department name")}}',
85
- "x-component": "Input"
86
- }
87
- },
88
- {
89
- type: "boolean",
90
- name: "isLeaf"
91
- },
92
- {
93
- type: "belongsTo",
94
- name: "parent",
95
- target: "departments",
96
- foreignKey: "parentId",
97
- treeParent: true,
98
- onDelete: "CASCADE",
99
- interface: "m2o",
100
- uiSchema: {
101
- type: "m2o",
102
- title: '{{t("Superior department")}}',
103
- "x-component": "AssociationField",
104
- "x-component-props": {
105
- multiple: false,
106
- fieldNames: {
107
- label: "title",
108
- value: "id"
109
- }
110
- }
111
- }
112
- },
113
- {
114
- type: "hasMany",
115
- name: "children",
116
- target: "departments",
117
- foreignKey: "parentId",
118
- treeChildren: true,
119
- onDelete: "CASCADE"
120
- },
121
- {
122
- type: "belongsToMany",
123
- name: "members",
124
- target: "users",
125
- through: "departmentsUsers",
126
- foreignKey: "departmentId",
127
- otherKey: "userId",
128
- targetKey: "id",
129
- sourceKey: "id",
130
- onDelete: "CASCADE"
131
- },
132
- {
133
- interface: "m2m",
134
- type: "belongsToMany",
135
- name: "roles",
136
- target: "roles",
137
- through: "departmentsRoles",
138
- foreignKey: "departmentId",
139
- otherKey: "roleName",
140
- targetKey: "name",
141
- sourceKey: "id",
142
- onDelete: "CASCADE",
143
- uiSchema: {
144
- type: "m2m",
145
- title: '{{t("Roles")}}',
146
- "x-component": "AssociationField",
147
- "x-component-props": {
148
- multiple: true,
149
- fieldNames: {
150
- label: "title",
151
- value: "name"
152
- }
153
- }
154
- }
155
- },
156
- ownersField
157
- ]
158
- });
159
- // Annotate the CommonJS export names for ESM import in node:
160
- 0 && (module.exports = {
161
- ownersField
162
- });
@@ -1,2 +0,0 @@
1
- declare const _default: import("@tachybase/database").CollectionOptions;
2
- export default _default;
@@ -1,43 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var departmentsUsers_exports = {};
19
- __export(departmentsUsers_exports, {
20
- default: () => departmentsUsers_default
21
- });
22
- module.exports = __toCommonJS(departmentsUsers_exports);
23
- var import_database = require("@tachybase/database");
24
- var departmentsUsers_default = (0, import_database.defineCollection)({
25
- name: "departmentsUsers",
26
- dumpRules: "required",
27
- fields: [
28
- {
29
- type: "boolean",
30
- name: "isOwner",
31
- // Weather the user is the owner of the department
32
- allowNull: false,
33
- defaultValue: false
34
- },
35
- {
36
- type: "boolean",
37
- name: "isMain",
38
- // Weather this is the main department of the user
39
- allowNull: false,
40
- defaultValue: false
41
- }
42
- ]
43
- });
@@ -1,2 +0,0 @@
1
- declare const _default: import("@tachybase/database").CollectionDef;
2
- export default _default;
@@ -1,39 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var roles_exports = {};
19
- __export(roles_exports, {
20
- default: () => roles_default
21
- });
22
- module.exports = __toCommonJS(roles_exports);
23
- var import_database = require("@tachybase/database");
24
- var roles_default = (0, import_database.extendCollection)({
25
- name: "roles",
26
- fields: [
27
- {
28
- type: "belongsToMany",
29
- name: "departments",
30
- target: "departments",
31
- foreignKey: "roleName",
32
- otherKey: "departmentId",
33
- onDelete: "CASCADE",
34
- sourceKey: "name",
35
- targetKey: "id",
36
- through: "departmentsRoles"
37
- }
38
- ]
39
- });
@@ -1,55 +0,0 @@
1
- export declare const departmentsField: {
2
- collectionName: string;
3
- interface: string;
4
- type: string;
5
- name: string;
6
- target: string;
7
- foreignKey: string;
8
- otherKey: string;
9
- onDelete: string;
10
- sourceKey: string;
11
- targetKey: string;
12
- through: string;
13
- uiSchema: {
14
- type: string;
15
- title: string;
16
- 'x-component': string;
17
- 'x-component-props': {
18
- multiple: boolean;
19
- fieldNames: {
20
- label: string;
21
- value: string;
22
- };
23
- };
24
- };
25
- };
26
- export declare const mainDepartmentField: {
27
- collectionName: string;
28
- interface: string;
29
- type: string;
30
- name: string;
31
- target: string;
32
- foreignKey: string;
33
- otherKey: string;
34
- onDelete: string;
35
- sourceKey: string;
36
- targetKey: string;
37
- through: string;
38
- throughScope: {
39
- isMain: boolean;
40
- };
41
- uiSchema: {
42
- type: string;
43
- title: string;
44
- 'x-component': string;
45
- 'x-component-props': {
46
- multiple: boolean;
47
- fieldNames: {
48
- label: string;
49
- value: string;
50
- };
51
- };
52
- };
53
- };
54
- declare const _default: import("@tachybase/database").CollectionDef;
55
- export default _default;