{"action":"created","issue":{"url":"https://api.github.com/repos/Vincit/objection.js/issues/164","repository_url":"https://api.github.com/repos/Vincit/objection.js","labels_url":"https://api.github.com/repos/Vincit/objection.js/issues/164/labels{/name}","comments_url":"https://api.github.com/repos/Vincit/objection.js/issues/164/comments","events_url":"https://api.github.com/repos/Vincit/objection.js/issues/164/events","html_url":"https://github.com/Vincit/objection.js/issues/164","id":165788816,"number":164,"title":"Custom Fields","user":{"login":"casalot","id":7264355,"avatar_url":"https://avatars.githubusercontent.com/u/7264355?v=3","gravatar_id":"","url":"https://api.github.com/users/casalot","html_url":"https://github.com/casalot","followers_url":"https://api.github.com/users/casalot/followers","following_url":"https://api.github.com/users/casalot/following{/other_user}","gists_url":"https://api.github.com/users/casalot/gists{/gist_id}","starred_url":"https://api.github.com/users/casalot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/casalot/subscriptions","organizations_url":"https://api.github.com/users/casalot/orgs","repos_url":"https://api.github.com/users/casalot/repos","events_url":"https://api.github.com/users/casalot/events{/privacy}","received_events_url":"https://api.github.com/users/casalot/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":15,"created_at":"2016-07-15T13:39:09Z","updated_at":"2016-07-16T17:50:10Z","closed_at":null,"body":"If I have a `Customer` table with the following columns: `customerId`, `firstName` and `lastName`,  and my model is defined as:\r\n\r\n```javascript\r\nconst Model = require('objection').Model;\r\n\r\nclass Customer extends Model {\r\n  static get tableName() {\r\n    return 'Customer';\r\n  }\r\n};\r\n\r\nmodule.exports = Customer;\r\n```\r\n\r\nIf I do:\r\n```javascript\r\n  getCustomers (req, res) {\r\n    Customer\r\n    .query()\r\n    .then(function (customers) {\r\n      res(customer);\r\n    })\r\n    .catch(function (err) {\r\n      console.log(err);\r\n    });\r\n  }\r\n```\r\nI get an object with the data as per the table.\r\n\r\nNow, if I want to create a dynamic/calculated field `fullName` on the model, which is derived as `firstName + ' ' + lastName`, how would I add it to my model, so that it is included in the `.query()` results?\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/Vincit/objection.js/issues/comments/233142464","html_url":"https://github.com/Vincit/objection.js/issues/164#issuecomment-233142464","issue_url":"https://api.github.com/repos/Vincit/objection.js/issues/164","id":233142464,"user":{"login":"koskimas","id":846508,"avatar_url":"https://avatars.githubusercontent.com/u/846508?v=3","gravatar_id":"","url":"https://api.github.com/users/koskimas","html_url":"https://github.com/koskimas","followers_url":"https://api.github.com/users/koskimas/followers","following_url":"https://api.github.com/users/koskimas/following{/other_user}","gists_url":"https://api.github.com/users/koskimas/gists{/gist_id}","starred_url":"https://api.github.com/users/koskimas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/koskimas/subscriptions","organizations_url":"https://api.github.com/users/koskimas/orgs","repos_url":"https://api.github.com/users/koskimas/repos","events_url":"https://api.github.com/users/koskimas/events{/privacy}","received_events_url":"https://api.github.com/users/koskimas/received_events","type":"User","site_admin":false},"created_at":"2016-07-16T17:50:10Z","updated_at":"2016-07-16T17:50:10Z","body":"Actually these is a bug and afterGet doesn't have the relations on that case. I'll fix that."}}
{"actor":{"display_login":"koskimas"}}