split per app
This commit is contained in:
9
lib/db/app.js
Normal file
9
lib/db/app.js
Normal file
@ -0,0 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = (get_db) => ({
|
||||
get_all () {
|
||||
const knex = get_db ();
|
||||
return knex ('app')
|
||||
.select ();
|
||||
}
|
||||
});
|
@ -18,9 +18,11 @@ async function init (use_fake_seed) {
|
||||
await db.seed.run ({ specific: 'fake.js' });
|
||||
}
|
||||
|
||||
function get_all () {
|
||||
return db ('log')
|
||||
.select ();
|
||||
function get_db () {
|
||||
return db;
|
||||
}
|
||||
|
||||
module.exports = { init, get_all };
|
||||
const log = require ('./log') (get_db);
|
||||
const app = require ('./app') (get_db);
|
||||
|
||||
module.exports = { init, log, app };
|
||||
|
15
lib/db/log.js
Normal file
15
lib/db/log.js
Normal file
@ -0,0 +1,15 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = (get_db) => ({
|
||||
get_all (app_id) {
|
||||
const knex = get_db ();
|
||||
return knex.select (
|
||||
'id',
|
||||
'message',
|
||||
'data',
|
||||
'timestamp'
|
||||
)
|
||||
.from ('log')
|
||||
.where ({ app_id });
|
||||
}
|
||||
});
|
Reference in New Issue
Block a user