WIP Metadata class.

This commit is contained in:
Ahmed Bouhuolia
2019-09-08 02:41:46 +02:00
parent 70809cb05c
commit 9a8de9ca7d
29 changed files with 1707 additions and 98 deletions

View File

@@ -1,7 +1,8 @@
import bookshelf from './bookshelf';
import Metable from './Metable';
import Auth from './Auth';
const Setting = bookshelf.Model.extend({
/**
* Table name
*/
@@ -11,6 +12,23 @@ const Setting = bookshelf.Model.extend({
* Timestamp columns.
*/
hasTimestamps: false,
/**
* Extra metadata query to query with the current authenticate user.
* @param {Object} query
*/
extraMetadataQuery(query) {
if (Auth.isLogged()) {
query.where('user_id', Auth.userId());
}
},
}, {
/**
* Table name
*/
tableName: 'settings',
...Metable,
});
export default bookshelf.model('Setting', Setting);