@outliant/sunrise-utils 1.1.0 → 1.1.2

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/.eslintrc CHANGED
@@ -46,6 +46,7 @@
46
46
  "semi": ["error", "always"],
47
47
  "quote-props": ["error", "as-needed"],
48
48
  "space-infix-ops": "error",
49
+ "no-undef": "error",
49
50
  "object-curly-spacing": ["error", "always"],
50
51
  "indent": [
51
52
  "error",
package/CHANGELOG.md CHANGED
@@ -4,9 +4,26 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
+ #### [1.1.2](https://github.com/outliant/sunrise-utils/compare/1.1.1...1.1.2)
8
+
9
+ - chore: set departmentId to optional [`#7`](https://github.com/outliant/sunrise-utils/pull/7)
10
+
11
+ #### [1.1.1](https://github.com/outliant/sunrise-utils/compare/1.1.0...1.1.1)
12
+
13
+ > 14 April 2023
14
+
15
+ - chore: add search for projectIds [`#5`](https://github.com/outliant/sunrise-utils/pull/5)
16
+ - chore: add match_phrase_prefix search for project fields [`#6`](https://github.com/outliant/sunrise-utils/pull/6)
17
+ - chore: revert taskPipeline [`3fb9c24`](https://github.com/outliant/sunrise-utils/commit/3fb9c2486b1459a0b33050e6691963e8aa04cfcf)
18
+ - chore: update projectId filter query [`dbe2f3c`](https://github.com/outliant/sunrise-utils/commit/dbe2f3c6cc40c470d02c78911a1fc0ba30cda900)
19
+ - chore(release): 1.1.1 [`b27a11a`](https://github.com/outliant/sunrise-utils/commit/b27a11a385d0f4f20333e0a681a2b4fc7d8c276b)
20
+
7
21
  #### [1.1.0](https://github.com/outliant/sunrise-utils/compare/1.0.11...1.1.0)
8
22
 
23
+ > 13 April 2023
24
+
9
25
  - chore: support task age color #860q9c397 [`50d79a7`](https://github.com/outliant/sunrise-utils/commit/50d79a78e309c70d7eac0f5533686bd65c1167a7)
26
+ - chore(release): 1.1.0 [`73ee00e`](https://github.com/outliant/sunrise-utils/commit/73ee00e07226e06fcfbf4d8c96ba87b8970ce312)
10
27
 
11
28
  #### [1.0.11](https://github.com/outliant/sunrise-utils/compare/1.0.10...1.0.11)
12
29
 
@@ -85,6 +85,50 @@ module.exports = (query = {}, searchFields = []) => {
85
85
  min_score: 15
86
86
  }
87
87
  });
88
+
89
+ should.push({
90
+ bool: {
91
+ must: [
92
+ {
93
+ nested: {
94
+ path: 'fields',
95
+ query: {
96
+ bool: {
97
+ must: [
98
+ {
99
+ term: {
100
+ 'fields.id': {
101
+ value: projectFields[i]
102
+ }
103
+ }
104
+ },
105
+ {
106
+ bool: {
107
+ should: [
108
+ {
109
+ match: {
110
+ [`fields.text.analyzed`]: {
111
+ query: searchString,
112
+ operator: 'and'
113
+ }
114
+ }
115
+ },
116
+ {
117
+ match_phrase_prefix: {
118
+ [`fields.text.analyzed`]: searchString
119
+ }
120
+ }
121
+ ]
122
+ }
123
+ }
124
+ ]
125
+ }
126
+ }
127
+ }
128
+ }
129
+ ]
130
+ }
131
+ });
88
132
  }
89
133
  }
90
134
 
@@ -23,15 +23,18 @@ class ProjectPipeline {
23
23
  value: orgId
24
24
  }
25
25
  }
26
- },
27
- {
26
+ }
27
+ ];
28
+
29
+ if (departmentId) {
30
+ mustQuery.push({
28
31
  term: {
29
32
  department_id: {
30
33
  value: departmentId
31
34
  }
32
35
  }
33
- }
34
- ];
36
+ });
37
+ }
35
38
 
36
39
  if (query.search && query.search.length > 0) {
37
40
  const should = searchFilter(query, searchFields);
@@ -45,6 +48,20 @@ class ProjectPipeline {
45
48
  }
46
49
  }
47
50
 
51
+ if (query.projectIds && query.projectIds.length) {
52
+ const should = query.projectIds.map(projectId => {
53
+ return {
54
+ match: {
55
+ _id: projectId
56
+ }
57
+ };
58
+ });
59
+
60
+ mustQuery.push({
61
+ bool: { should }
62
+ });
63
+ }
64
+
48
65
  if (!filters.length) {
49
66
  return {
50
67
  bool: {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@outliant/sunrise-utils",
3
3
  "description": "Helper functions for project Sunrise",
4
- "version": "1.1.0",
4
+ "version": "1.1.2",
5
5
  "license": "ISC",
6
6
  "author": "Outliant",
7
7
  "main": "index.js",