Skip to content

Commit 6d7a24f

Browse files
committed
fix(json-api-nestjs-microorm): Handle defaultRaw in nullable props check and update entity properties
1 parent 3e7b3e6 commit 6d7a24f

File tree

2 files changed

+7
-3
lines changed
  • libs/json-api/json-api-nestjs-microorm/src/lib

2 files changed

+7
-3
lines changed

libs/json-api/json-api-nestjs-microorm/src/lib/mock-utils/entities/users.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,15 @@ export class Users {
7777
@Property({
7878
name: 'is_active',
7979
type: 'boolean',
80-
nullable: true,
80+
nullable: false,
8181
default: false,
8282
})
8383
public isActive!: boolean;
8484

8585
@Property({
8686
name: 'test_date',
8787
type: Date,
88-
nullable: true,
88+
nullable: false,
8989
defaultRaw: 'CURRENT_TIMESTAMP(0)',
9090
columnType: 'timestamp(0) without time zone',
9191
})

libs/json-api/json-api-nestjs-microorm/src/lib/orm-helper/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,11 @@ export const getPropsNullable = <E extends object>(
7272
.map((i) => {
7373
// @ts-ignore
7474
const props = entityMetadata.properties[i];
75-
return props.nullable || props.default !== undefined ? i : false;
75+
return props.nullable ||
76+
props.default !== undefined ||
77+
props.defaultRaw !== undefined
78+
? i
79+
: false;
7680
})
7781
.filter((i) => !!i) as unknown as EntityParam<E>['propsNullable'];
7882
};

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy