@@ -3,8 +3,8 @@ import { stripIndent } from 'common-tags';
3
3
import { node , type Query , relation } from 'cypher-query-builder' ;
4
4
import { DateTime } from 'luxon' ;
5
5
import {
6
+ EnhancedResource ,
6
7
generateId ,
7
- getDbClassLabels ,
8
8
type ID ,
9
9
NotFoundException ,
10
10
type Session ,
@@ -25,15 +25,18 @@ import { PeriodicReportService } from '../periodic-report';
25
25
import { ReportType } from '../periodic-report/dto' ;
26
26
import { type ProductStep } from '../product/dto' ;
27
27
import {
28
- ProductProgress ,
29
28
type ProductProgressInput ,
30
29
type ProgressVariant ,
31
30
type ProgressVariantByProductInput ,
32
31
type ProgressVariantByReportInput ,
33
- StepProgress ,
32
+ ProductProgress as RawProductProgress ,
33
+ StepProgress as RawStepProgress ,
34
34
type UnsecuredProductProgress ,
35
35
} from './dto' ;
36
36
37
+ const ProductProgress = EnhancedResource . of ( RawProductProgress ) ;
38
+ const StepProgress = EnhancedResource . of ( RawStepProgress ) ;
39
+
37
40
@Injectable ( )
38
41
export class ProductProgressRepository {
39
42
constructor (
@@ -169,7 +172,7 @@ export class ProductProgressRepository {
169
172
. optionalMatch ( [
170
173
node ( 'report' ) ,
171
174
relation ( 'out' , '' , 'progress' , ACTIVE ) ,
172
- node ( 'progress' , ' ProductProgress' , {
175
+ node ( 'progress' , ProductProgress . dbLabel , {
173
176
variant : variable ( 'variant' ) ,
174
177
} ) ,
175
178
relation ( 'in' , '' , 'progress' , ACTIVE ) ,
@@ -191,7 +194,7 @@ export class ProductProgressRepository {
191
194
. match ( [
192
195
node ( 'progress' ) ,
193
196
relation ( 'out' , '' , 'step' , ACTIVE ) ,
194
- node ( 'stepNode' , ' StepProgress' ) ,
197
+ node ( 'stepNode' , StepProgress . dbLabel ) ,
195
198
] )
196
199
. apply ( matchProps ( { nodeName : 'stepNode' , outputVar : 'step' } ) )
197
200
. return ( collect ( 'step' ) . as ( 'steps' ) ) ,
@@ -249,7 +252,7 @@ export class ProductProgressRepository {
249
252
. merge ( [
250
253
node ( 'product' ) ,
251
254
relation ( 'out' , 'productProgressRel' , 'progress' , ACTIVE ) ,
252
- node ( 'progress' , ' ProductProgress' , {
255
+ node ( 'progress' , ProductProgress . dbLabel , {
253
256
variant : variable ( 'variant' ) ,
254
257
} ) ,
255
258
relation ( 'in' , 'reportProgressRel' , 'progress' , ACTIVE ) ,
@@ -258,7 +261,7 @@ export class ProductProgressRepository {
258
261
. onCreate . set (
259
262
{
260
263
labels : {
261
- progress : getDbClassLabels ( ProductProgress ) ,
264
+ progress : ProductProgress . dbLabels ,
262
265
} ,
263
266
values : {
264
267
progress : { id : tempProgressId , createdAt } ,
@@ -282,14 +285,14 @@ export class ProductProgressRepository {
282
285
. merge ( [
283
286
node ( 'progress' ) ,
284
287
relation ( 'out' , 'progressStepRel' , 'step' , ACTIVE ) ,
285
- node ( 'stepNode' , ' StepProgress' , {
288
+ node ( 'stepNode' , StepProgress . dbLabel , {
286
289
step : variable ( 'stepInput.step' ) ,
287
290
} ) ,
288
291
] )
289
292
. onCreate . set (
290
293
{
291
294
labels : {
292
- stepNode : getDbClassLabels ( StepProgress ) ,
295
+ stepNode : StepProgress . dbLabels ,
293
296
} ,
294
297
values : {
295
298
stepNode : { createdAt } ,
0 commit comments