How I can use getter and setter in TypeOrm.
I saw issues in here and also here, but not found answer
For example a left my User entity
export class User {
@PrimaryGeneratedColumn()
private id: number;
@Column()
@Length(4, 20)
@IsNotEmpty()
private name: string;
@Column()
@Length(4, 100)
@IsNotEmpty()
private password: string;
public getId(): number {
return this.id;
}
public getPassword(password: string): string {
return this.password;
}
public setPassword(password: string): User {
this.password = bcrypt.hashSync(password, 8);
return this;
}
public setName(name: string): User {
this.name = name;
return this;
}
}
I use orm version 0.2.7