@things-factory/organization 6.0.138 → 6.0.139

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/organization",
3
- "version": "6.0.138",
3
+ "version": "6.0.139",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "dist-client/index.js",
6
6
  "things-factory": true,
@@ -35,5 +35,5 @@
35
35
  "@things-factory/contact": "^6.0.133",
36
36
  "@things-factory/shell": "^6.0.133"
37
37
  },
38
- "gitHead": "ca6c771a4c9f84e36f002665377ec919c0e11465"
38
+ "gitHead": "59efd5d9c1184b4ebd208a4f5dea47d23cf51cf7"
39
39
  }
@@ -3,7 +3,7 @@ import { In } from 'typeorm'
3
3
 
4
4
  import { Employee } from '../employee/employee'
5
5
  import { ApprovalLine, ApprovalLineOwnerType } from './approval-line'
6
- import { ApprovalLineItem } from './approval-line-item'
6
+ import { ApprovalLineItem, OrgMemberTargetType } from './approval-line-item'
7
7
  import { NewApprovalLine, ApprovalLinePatch } from './approval-line-type'
8
8
 
9
9
  async function getOwnerValue(
@@ -49,12 +49,24 @@ function getModelValue(patch: NewApprovalLine | ApprovalLinePatch): ApprovalLine
49
49
  return null
50
50
  }
51
51
 
52
- return model.map(m => {
53
- return {
54
- type: m.type,
55
- approver: m.approver
56
- } as ApprovalLineItem
57
- })
52
+ return model
53
+ .map(m => {
54
+ return {
55
+ type: m.type,
56
+ approver: m.approver
57
+ } as ApprovalLineItem
58
+ })
59
+ .filter(m => m.type)
60
+ .filter(m => {
61
+ switch (m.type) {
62
+ case OrgMemberTargetType.Employee:
63
+ case OrgMemberTargetType.Department:
64
+ case OrgMemberTargetType.Role:
65
+ return !!m.approver?.id
66
+ default:
67
+ return true
68
+ }
69
+ })
58
70
  }
59
71
 
60
72
  @Resolver(ApprovalLine)