Ver Fonte

feat: add default value for entity

IlhamTahir há 1 ano atrás
pai
commit
23beaf9574
2 ficheiros alterados com 9 adições e 3 exclusões
  1. 6 2
      src/core/entity/user.entity.ts
  2. 3 1
      src/main.ts

+ 6 - 2
src/core/entity/user.entity.ts

@@ -24,10 +24,14 @@ export class User extends BaseEntity {
   })
   enabled: boolean = true;
 
-  @Column()
+  @Column({
+    nullable: true,
+  })
   trueName: string;
 
-  @Column()
+  @Column({
+    nullable: true,
+  })
   age: number;
 
   @Column({

+ 3 - 1
src/main.ts

@@ -10,7 +10,9 @@ async function bootstrap() {
     parseInt(process.env.WORKER_ID, 10),
     parseInt(process.env.DATACENTER_ID, 10),
   );
-  const app = await NestFactory.create(AppModule);
+  const app = await NestFactory.create(AppModule, {
+    logger: ['log'],
+  });
   if (['development', 'test'].includes(process.env.NODE_ENV)) {
     const config = new DocumentBuilder()
       .setTitle(process.env.APP_TITLE)