When I have columns with type decimal and I am using query builder for aggregation, I face an issue where the decimal values are returned as strings after executing the query.
I am looking for a way to globally set my project to recognize decimal numbers in entity as decimal numbers while executing queries, instead of treating them as strings.
Although I attempted to use a transformer with @Column(), it did not work as expected:
@Column('decimal', {
transformer: {
to(value) {
return value;
},
from(value) {
return parseFloat(value);
},
},
})
price: number;
Even if this workaround does work, I do not want to repeat the same code for all columns. I am seeking a way to configure this setting globally across my project.