Sunday, 7 November 2021

Storing file in PostgreSQL database using NestJS

I have one form in React. It has many fields. once user click on the submit button all the field should be saved in database. It also contains one file attachment(pdf).

enter image description here

I dont know what the datatype of variable which will store file, I should take in entity class. Also what should be the database column type. I am using TypeORM for the same.

   @IsNotEmpty()
    @IsDate()
    endDate: Date;
    @Column()
    @IsNotEmpty()
    @IsString()
    personIncharge: string;

    @Column()
    @IsNotEmpty()
    @IsString()
    country: string;

    @Column()
    @IsNotEmpty()
    @IsString()
    comments: string;

    attachFile: string;  // Should I take file or string?


from Storing file in PostgreSQL database using NestJS

No comments:

Post a Comment