@things-factory/figure-service 10.1.241 → 10.1.245
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/dist-server/service/figure/figure-query.d.ts +2 -1
- package/dist-server/service/figure/figure-query.js +24 -2
- package/dist-server/service/figure/figure-query.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
- package/server/service/figure/figure-query.ts +21 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/figure-service",
|
|
3
|
-
"version": "10.1.
|
|
3
|
+
"version": "10.1.245",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"@things-factory:registry": "https://registry.npmjs.org"
|
|
@@ -27,16 +27,16 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@hatiolab/figure-model": "^0.12.1",
|
|
29
29
|
"@operato/typeorm-history": "^10.0.0",
|
|
30
|
-
"@things-factory/ai-client-base": "^10.1.
|
|
31
|
-
"@things-factory/attachment-base": "^10.1.
|
|
32
|
-
"@things-factory/auth-base": "^10.1.
|
|
30
|
+
"@things-factory/ai-client-base": "^10.1.245",
|
|
31
|
+
"@things-factory/attachment-base": "^10.1.245",
|
|
32
|
+
"@things-factory/auth-base": "^10.1.245",
|
|
33
33
|
"@things-factory/env": "^10.1.149",
|
|
34
|
-
"@things-factory/setting-base": "^10.1.
|
|
35
|
-
"@things-factory/shell": "^10.1.
|
|
34
|
+
"@things-factory/setting-base": "^10.1.245",
|
|
35
|
+
"@things-factory/shell": "^10.1.245",
|
|
36
36
|
"graphql-scalars": "^1.22.4",
|
|
37
37
|
"graphql-upload": "^15.0.2",
|
|
38
38
|
"jszip": "^3.10.1",
|
|
39
39
|
"koa-router": "^7.4.0"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "f7479631094a1c70b486485b556885b069025f88"
|
|
42
42
|
}
|
|
@@ -3,10 +3,12 @@ import { Args, Arg, Ctx, Directive, Int, Query, Resolver, UseMiddleware } from '
|
|
|
3
3
|
import { GraphQLJSON } from 'graphql-scalars'
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
|
+
countListByField,
|
|
6
7
|
Domain,
|
|
7
8
|
getQueryBuilderFromListParams,
|
|
8
9
|
getRepository,
|
|
9
10
|
ListParam,
|
|
11
|
+
ListValueCount,
|
|
10
12
|
Refusal,
|
|
11
13
|
SpeakRefusals,
|
|
12
14
|
refusalKey
|
|
@@ -24,6 +26,9 @@ import { meshSummaryOf } from './figure-mesh-store.js'
|
|
|
24
26
|
import { readableFigure, publicFigureOfName } from './figure-public.js'
|
|
25
27
|
import { figureCategories } from './figure-categories.js'
|
|
26
28
|
|
|
29
|
+
/** What a figure list finds figures by - tags too, see `figures` - and its state counts alike. */
|
|
30
|
+
const FIGURE_SEARCHABLES = ['type', 'name', 'description', 'category', 'tags']
|
|
31
|
+
|
|
27
32
|
@Resolver(Figure)
|
|
28
33
|
@UseMiddleware(SpeakRefusals)
|
|
29
34
|
export class FigureQuery {
|
|
@@ -55,7 +60,7 @@ export class FigureQuery {
|
|
|
55
60
|
본다. 「반출」로 찾으면 걸린다. 정확히 그 태그만 걸리는 것은 아니지만(이름에 「반출」이
|
|
56
61
|
든 피규어도 걸린다) 찾기로는 그것이 오히려 낫다.
|
|
57
62
|
*/
|
|
58
|
-
searchables:
|
|
63
|
+
searchables: FIGURE_SEARCHABLES
|
|
59
64
|
})
|
|
60
65
|
|
|
61
66
|
const [items, total] = await queryBuilder.getManyAndCount()
|
|
@@ -63,6 +68,20 @@ export class FigureQuery {
|
|
|
63
68
|
return { items, total }
|
|
64
69
|
}
|
|
65
70
|
|
|
71
|
+
@Directive('@privilege(category: "figure", privilege: "query", domainOwnerGranted: true)')
|
|
72
|
+
@Query(returns => [ListValueCount], { description: "How many of the domain's figures hold each state (draft, released), under the list conditions other than the state." })
|
|
73
|
+
async figureStateCounts(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<ListValueCount[]> {
|
|
74
|
+
const counted = await countListByField({
|
|
75
|
+
repository: getRepository(Figure),
|
|
76
|
+
params,
|
|
77
|
+
domain: context.state.domain,
|
|
78
|
+
alias: 'figure',
|
|
79
|
+
searchables: FIGURE_SEARCHABLES,
|
|
80
|
+
field: 'state'
|
|
81
|
+
})
|
|
82
|
+
return ['draft', 'released'].map(value => ({ value, count: counted.get(value) ?? 0 }))
|
|
83
|
+
}
|
|
84
|
+
|
|
66
85
|
/**
|
|
67
86
|
* Other domains' public figures (LV figure-server design G2): what this domain may read, package and draw besides its
|
|
68
87
|
* own and its parent's. The rows carry their domain, so a screen says whose each is. Their drafts are not opened.
|
|
@@ -76,7 +95,7 @@ export class FigureQuery {
|
|
|
76
95
|
repository: getRepository(Figure),
|
|
77
96
|
params,
|
|
78
97
|
alias: 'figure',
|
|
79
|
-
searchables:
|
|
98
|
+
searchables: FIGURE_SEARCHABLES
|
|
80
99
|
})
|
|
81
100
|
.leftJoinAndSelect('figure.domain', 'owner')
|
|
82
101
|
.andWhere('figure.public = :public', { public: true })
|