I am using objection.js ORM for my node.js project. Everything is good, I want to trim all the fields before actually saving the data in the PostGres database table. I have also used mongoose in some of the projects, it allows to define {trim: true} in the model.
I am adding a sample model code for the reference:
// @flow
import Model from './Model';
import Transaction from './Transaction';
import dbMap from './dbMap';
export default class ClaimCode extends Model {
amount: number;
claimId: number;
code: string;
codeDate: Date;
presentOnAdmission: string;
throughDate: Date;
claimCodeTypeId: number;
static tableName = 'claim_code';
}
dbMap(ClaimCode, {});
Do we have a way to do the same in objection js model?