Open vitalizis opened 4 years ago
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\".",
"message": "Cannot query field \"someNewField\" on type \"testTable\".",
I have a similar example working, but I had to add someNewField to the properties list in jsonSchema, and my someNewField() is a getter (not sure if the second part is important or just the first).
someNewField
jsonSchema
someNewField()
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:
I got error like:
"message": "Cannot query field \"someNewField\" on type \"testTable\".",