@things-factory/organization 6.2.103 → 6.2.110

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 (36) hide show
  1. package/client/pages/department/department-list-page.ts +308 -196
  2. package/client/pages/department/department-tree-page.ts +153 -403
  3. package/client/route.ts +4 -4
  4. package/client/types/department.ts +0 -8
  5. package/dist-client/pages/department/department-list-page.d.ts +12 -20
  6. package/dist-client/pages/department/department-list-page.js +308 -182
  7. package/dist-client/pages/department/department-list-page.js.map +1 -1
  8. package/dist-client/pages/department/department-tree-page.d.ts +10 -12
  9. package/dist-client/pages/department/department-tree-page.js +142 -382
  10. package/dist-client/pages/department/department-tree-page.js.map +1 -1
  11. package/dist-client/route.d.ts +1 -1
  12. package/dist-client/route.js +3 -3
  13. package/dist-client/route.js.map +1 -1
  14. package/dist-client/tsconfig.tsbuildinfo +1 -1
  15. package/dist-client/types/department.d.ts +0 -6
  16. package/dist-client/types/department.js +0 -5
  17. package/dist-client/types/department.js.map +1 -1
  18. package/dist-server/service/department/department-history.js +4 -15
  19. package/dist-server/service/department/department-history.js.map +1 -1
  20. package/dist-server/service/department/department-query.js +15 -10
  21. package/dist-server/service/department/department-query.js.map +1 -1
  22. package/dist-server/service/department/department-type.js +0 -8
  23. package/dist-server/service/department/department-type.js.map +1 -1
  24. package/dist-server/service/department/department.js +1 -15
  25. package/dist-server/service/department/department.js.map +1 -1
  26. package/dist-server/tsconfig.tsbuildinfo +1 -1
  27. package/package.json +2 -2
  28. package/server/service/department/department-history.ts +7 -31
  29. package/server/service/department/department-query.ts +13 -10
  30. package/server/service/department/department-type.ts +1 -7
  31. package/server/service/department/department.ts +0 -15
  32. package/translations/en.json +1 -0
  33. package/translations/ja.json +1 -0
  34. package/translations/ko.json +1 -0
  35. package/translations/ms.json +1 -0
  36. package/translations/zh.json +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/organization",
3
- "version": "6.2.103",
3
+ "version": "6.2.110",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "dist-client/index.js",
6
6
  "things-factory": true,
@@ -36,5 +36,5 @@
36
36
  "@things-factory/contact": "^6.2.103",
37
37
  "@things-factory/shell": "^6.2.103"
38
38
  },
39
- "gitHead": "941f06e7c042ed4da546f96cc770e803b3ee1d71"
39
+ "gitHead": "97db3f209368df2246591b42eed364e84b8e8ba1"
40
40
  }
@@ -1,37 +1,22 @@
1
1
  import { Field, ID, ObjectType } from 'type-graphql'
2
2
  import { Column, Entity, Index, ManyToOne, OneToMany, PrimaryGeneratedColumn, RelationId } from 'typeorm'
3
3
 
4
- import {
5
- HistoryActionColumn,
6
- HistoryActionType,
7
- HistoryEntityInterface,
8
- HistoryOriginalIdColumn
9
- } from '@operato/typeorm-history'
4
+ import { HistoryActionColumn, HistoryActionType, HistoryEntityInterface, HistoryOriginalIdColumn } from '@operato/typeorm-history'
10
5
  import { Role, User } from '@things-factory/auth-base'
11
6
  import { config } from '@things-factory/env'
12
7
  import { Domain } from '@things-factory/shell'
13
8
 
14
- import { Department, DepartmentStatus } from './department'
9
+ import { Department } from './department'
15
10
  import { Employee } from '../employee/employee'
16
11
 
17
12
  const ORMCONFIG = config.get('ormconfig', {})
18
13
  const DATABASE_TYPE = ORMCONFIG.type
19
14
 
20
15
  @Entity()
21
- @Index(
22
- 'ix_department_history_0',
23
- (departmentHistory: DepartmentHistory) => [departmentHistory.originalId, departmentHistory.version],
24
- { unique: true }
25
- )
26
- @Index(
27
- 'ix_department_history_1',
28
- (departmentHistory: DepartmentHistory) => [
29
- departmentHistory.domain,
30
- departmentHistory.originalId,
31
- departmentHistory.version
32
- ],
33
- { unique: true }
34
- )
16
+ @Index('ix_department_history_0', (departmentHistory: DepartmentHistory) => [departmentHistory.originalId, departmentHistory.version], { unique: true })
17
+ @Index('ix_department_history_1', (departmentHistory: DepartmentHistory) => [departmentHistory.domain, departmentHistory.originalId, departmentHistory.version], {
18
+ unique: true
19
+ })
35
20
  @ObjectType({ description: 'History Entity of Department' })
36
21
  export class DepartmentHistory implements HistoryEntityInterface<Department> {
37
22
  @PrimaryGeneratedColumn('uuid')
@@ -83,10 +68,6 @@ export class DepartmentHistory implements HistoryEntityInterface<Department> {
83
68
  @Field({ nullable: true })
84
69
  active?: boolean
85
70
 
86
- @Column({ nullable: true })
87
- @Field({ nullable: true })
88
- state?: DepartmentStatus
89
-
90
71
  @Column({ nullable: true })
91
72
  @Field({ nullable: true })
92
73
  extension?: string
@@ -125,12 +106,7 @@ export class DepartmentHistory implements HistoryEntityInterface<Department> {
125
106
 
126
107
  @HistoryActionColumn({
127
108
  nullable: false,
128
- type:
129
- DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'
130
- ? 'enum'
131
- : DATABASE_TYPE == 'oracle'
132
- ? 'varchar2'
133
- : 'smallint',
109
+ type: DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb' ? 'enum' : DATABASE_TYPE == 'oracle' ? 'varchar2' : 'smallint',
134
110
  enum: HistoryActionType
135
111
  })
136
112
  public action!: HistoryActionType
@@ -9,13 +9,20 @@ import { Employee } from '../employee/employee'
9
9
 
10
10
  @Resolver(Department)
11
11
  export class DepartmentQuery {
12
- @Query(returns => Department!, { nullable: true, description: 'To fetch a Root Department' })
13
- async departmentRoot(@Ctx() context: ResolverContext): Promise<Department> {
12
+ @Query(returns => DepartmentList, { nullable: true, description: 'To fetch a Root Departments' })
13
+ async departmentRoots(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<DepartmentList> {
14
14
  const { domain } = context.state
15
15
 
16
- return await getRepository(Department).findOne({
17
- where: { domain: { id: domain.id }, parent: { id: IsNull() } }
18
- })
16
+ const queryBuilder = getQueryBuilderFromListParams({
17
+ domain,
18
+ params,
19
+ repository: await getRepository(Department),
20
+ searchables: ['name', 'description', 'controlNo']
21
+ }).andWhere({ domain: { id: domain.id }, parent: { id: IsNull() } })
22
+
23
+ const [items, total] = await queryBuilder.getManyAndCount()
24
+
25
+ return { items, total }
19
26
  }
20
27
 
21
28
  @Query(returns => Department!, { nullable: true, description: 'To fetch a Department' })
@@ -64,11 +71,7 @@ export class DepartmentQuery {
64
71
  }
65
72
 
66
73
  @FieldResolver(type => [Department])
67
- async children(
68
- @Root() department: Department,
69
- @Args() params: ListParam,
70
- @Ctx() context: ResolverContext
71
- ): Promise<Department[]> {
74
+ async children(@Root() department: Department, @Args() params: ListParam, @Ctx() context: ResolverContext): Promise<Department[]> {
72
75
  const { domain } = context.state
73
76
 
74
77
  const queryBuilder = getQueryBuilderFromListParams({
@@ -4,7 +4,7 @@ import { ObjectType, Field, InputType, Int, ID, registerEnumType } from 'type-gr
4
4
 
5
5
  import { ObjectRef, ScalarObject } from '@things-factory/shell'
6
6
 
7
- import { Department, DepartmentStatus } from './department'
7
+ import { Department } from './department'
8
8
  import { ObjectRefForEmployee } from '../employee/employee-type'
9
9
 
10
10
  @InputType()
@@ -18,9 +18,6 @@ export class NewDepartment {
18
18
  @Field({ nullable: true })
19
19
  description?: string
20
20
 
21
- @Field(type => DepartmentStatus, { nullable: true })
22
- state?: DepartmentStatus
23
-
24
21
  @Field({ nullable: true })
25
22
  active?: boolean
26
23
 
@@ -51,9 +48,6 @@ export class DepartmentPatch {
51
48
  @Field({ nullable: true })
52
49
  description?: string
53
50
 
54
- @Field(type => DepartmentStatus, { nullable: true })
55
- state?: DepartmentStatus
56
-
57
51
  @Field({ nullable: true })
58
52
  active?: boolean
59
53
 
@@ -16,17 +16,6 @@ import { ObjectType, Field, Int, ID, registerEnumType } from 'type-graphql'
16
16
  import { Domain } from '@things-factory/shell'
17
17
  import { User } from '@things-factory/auth-base'
18
18
  import { Employee } from '../employee/employee'
19
- import { ApprovalLine } from '../approval-line/approval-line'
20
-
21
- export enum DepartmentStatus {
22
- STATUS_A = 'STATUS_A',
23
- STATUS_B = 'STATUS_B'
24
- }
25
-
26
- registerEnumType(DepartmentStatus, {
27
- name: 'DepartmentStatus',
28
- description: 'state enumeration of a department'
29
- })
30
19
 
31
20
  @Entity()
32
21
  @Index('ix_department_0', (department: Department) => [department.domain, department.name], {
@@ -92,10 +81,6 @@ export class Department {
92
81
  @Field({ nullable: true })
93
82
  active?: boolean
94
83
 
95
- @Column({ nullable: true })
96
- @Field({ nullable: true })
97
- state?: DepartmentStatus
98
-
99
84
  @Column({ nullable: true })
100
85
  @Field({ nullable: true })
101
86
  extension?: string
@@ -34,6 +34,7 @@
34
34
  "title.my-approval-line template list": "my approval line template list",
35
35
  "title.employee list": "employee list",
36
36
  "title.department list": "department list",
37
+ "title.department tree": "department hierarchy",
37
38
  "title.contact list": "contact list",
38
39
  "title.organization": "organization",
39
40
  "title.employees-by-department": "Employees By Department"
@@ -34,6 +34,7 @@
34
34
  "title.my-approval-line template list": "マイ決裁ライン テンプレート リスト",
35
35
  "title.employee list": "職員リスト",
36
36
  "title.department list": "部署リスト",
37
+ "title.department tree": "部署階層図",
37
38
  "title.contact list": "連絡先リスト",
38
39
  "title.organization": "組織",
39
40
  "title.employees-by-department": "Employees By Department"
@@ -34,6 +34,7 @@
34
34
  "title.my-approval-line template list": "나의 결재라인 템플릿 목록",
35
35
  "title.employee list": "직원 목록",
36
36
  "title.department list": "부서 목록",
37
+ "title.department tree": "부서 조직도",
37
38
  "title.contact list": "연락처 관리",
38
39
  "title.organization": "조직",
39
40
  "title.employees-by-department": "부서별 직원"
@@ -34,6 +34,7 @@
34
34
  "title.my-approval-line template list": "senarai templat garis kelulusan saya",
35
35
  "title.employee list": "senarai pekerja",
36
36
  "title.department list": "senarai jabatan",
37
+ "title.department tree": "hierarki jabatan",
37
38
  "title.contact list": "senarai kenalan",
38
39
  "title.organization": "organisasi",
39
40
  "title.employees-by-department": "Employees By Department"
@@ -34,6 +34,7 @@
34
34
  "title.my-approval-line template list": "我的审批线模板列表",
35
35
  "title.employee list": "员工列表",
36
36
  "title.department list": "部门列表",
37
+ "title.department tree": "部门层级图",
37
38
  "title.contact list": "联系人列表",
38
39
  "title.organization": "组织",
39
40
  "title.employees-by-department": "Employees By Department"