Home > Software engineering >  postgres sql database Column value is [null]
postgres sql database Column value is [null]

Time:10-27

I am am using nestjs & typeorm to query

//this is my model(interface)
    export interface Product {
        id?:number,
        
        name?:string,
    }

this is my entity.ts

@Entity('product')
export class ProductEntity{
    @PrimaryGeneratedColumn()
    id:number;

    @Column({ type:'text',nullable:true })
    name:string;

    @Column({type:'timestamp',default:() => 'CURRENT_TIMESTAMP'})
    createdAt:Date;

}

enter image description here

the name column value is Null

This is what I call using postgress,

enter image description here

did anyone know how to fix this?

CodePudding user response:

You are sending a text payload to the backend. It should be a JSON payload. Use the dropdown menu to select JSON and the issue will go away.

enter image description here

  • Related