Skip to content

Commit 0f2ebec

Browse files
committed
add virtual to types
1 parent ca2e58b commit 0f2ebec

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

index.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ declare module "@moleculer/database" {
126126
permission?: string | string[];
127127
/** Read permission required for this field */
128128
readPermission?: string | string[];
129+
/** Virtual field (not stored in DB) */
130+
virtual?: boolean;
129131
/** Population configuration */
130132
populate?:
131133
| PopulateDefinition

test/typescript/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,11 @@ const postFields: Fields = {
272272
max: 20,
273273
default: []
274274
},
275+
virtual: {
276+
type: "string",
277+
virtual: true,
278+
get: (value: any, entity: any) => "virtual"
279+
},
275280
metadata: complexObjectField,
276281
createdAt: {
277282
type: "number",

0 commit comments

Comments
 (0)