This is my table:
@Entity('products')
export class Products {
@PrimaryGeneratedColumn()
@IsNumber()
public id: number;
@Column('decimal', {
precision: 20,
scale: 2,
transformer : {
to (value) {
return value ;
},
from (value) {
return parseFloat (value) ;
},
},
})
@IsNotEmpty()
price: number;
}
In my ormconfig file I have:
...
bigNumberStrings: false,
supportBigNumbers: true,
If I do:
return await this.repository.find();
Everything works correctly. The price field returns it as a decimal.
But if I use createQueryBuilder it brings it back as a string:
return await this.repository.createQueryBuilder("products")
.select([
'products.id AS id',
'products.price AS price'])
.getRawMany();
Please, could someone tell me how I can fix it?