Skip to content

Commit 6775657

Browse files
committed
Allow updateProperties() to have now passed in
1 parent c911e54 commit 6775657

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/core/database/query/properties/update-properties.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
type ResourceShape,
88
} from '~/common';
99
import { type DbChanges } from '../../changes';
10-
import { apoc, collect, merge, type Variable, variable } from '../index';
10+
import { apoc, collect, merge, Variable, variable } from '../index';
1111
import { type PropUpdateStat, updateProperty } from './update-property';
1212

1313
export interface UpdatePropertiesOptions<
@@ -21,6 +21,7 @@ export interface UpdatePropertiesOptions<
2121
changeset?: Variable;
2222
nodeName?: string;
2323
outputStatsVar?: string;
24+
now?: DateTime | Variable;
2425
}
2526

2627
export const updateProperties =
@@ -35,6 +36,7 @@ export const updateProperties =
3536
changeset,
3637
nodeName = 'node',
3738
outputStatsVar = 'stats',
39+
now,
3840
}: UpdatePropertiesOptions<TResourceStatic, TObject>) =>
3941
<R>(query: Query<R>) => {
4042
const resource = EnhancedResource.of(resourceIn);
@@ -61,7 +63,10 @@ export const updateProperties =
6163
labels: variable('prop.labels'),
6264
changeset,
6365
nodeName,
64-
now: query.params.addParam(DateTime.local(), 'now'),
66+
now:
67+
now instanceof Variable
68+
? now
69+
: query.params.addParam(now ?? DateTime.local(), 'now'),
6570
}),
6671
)
6772
.return<{

0 commit comments

Comments
 (0)