Open eldoy opened 1 year ago
Example model function in app/models/company
:
module.exports = function(app) {
const { db } = app.objects
function find($) {
const { query } = $.params
return db('company').find(query)
}
return { find }
}
Call with:
const result = await $.app.models.company.find($)
Need to expand model into app.models though, like we just reverted with plugins.... Should that be new de-facto?
Add a directories for models and data in
app
?Config is over-used for data, for instance I have this use case:
If we put this in
app/data/fields
and access like this it would be nicer:We also have use cases for shared code between actions which is not suitable for
flows
, like matchers, finders, etc...Sometimes we also need helper functions in
lib
orhelpers
:Could we generalize and just preload everything in the
app
directory? This may lead to slow startup though, so some kind of lazy-load through a proxy would be nice.