I need to generate auto value in nestjs+postgres. I am generating id using uuid but now I need to generate insuranceno as well. how can I do that?
@Entity()
class Post {
@PrimaryGeneratedColumn()
public id: number;
@Column()
public insuranceNo: string; //I need to generate this value automatically.
@Column()
public content: string; //value of this column is MAIN
}
export default Post;
value should be in INS-MAIN-001 INS-MAIN-002, INS-MAIN-003 format. MAIN is coming from content column.
is it possible in nestjs how to do it? INS is prefix