I would like to have an additional column with a modified value from another column: Now I have next code like this but it doesn't work:
const { Model } = require("objection");
class TestModel extends Model {
static get tableName() {
return "testTable";
}
static get virtualAttributes() {
return ["someNewField"];
}
someNewField() {
return this.someField+'testString';
}
static get jsonSchema() {
return {
type: "object",
properties: {
someField:{ type: "string" },
},
};
}
}
module.exports = {
TestModel,
};
I got error like
"message": "Cannot query field \"someNewField\" on type \"testTable\".",
My grapql query:
{TestModels{
someNewField,
}