- Did the unthinkable and actually achieved Peak ORM
This commit is contained in:
27
repositories/meta-school-repository.js
Normal file
27
repositories/meta-school-repository.js
Normal file
@@ -0,0 +1,27 @@
|
||||
'use strict'
|
||||
// Bookshelf
|
||||
const bookshelf = require('../database/connection').bookshelf
|
||||
|
||||
const Schools = require('./school-repository')
|
||||
|
||||
class MetaSchoolRepository {
|
||||
|
||||
constructor() {
|
||||
this.model = bookshelf.Model.extend({
|
||||
tableName: 'meta_school',
|
||||
schools() {
|
||||
return this.hasMany( Schools._model )
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
set model(model) {
|
||||
this._model = model
|
||||
}
|
||||
|
||||
get model() {
|
||||
return this._model
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = MetaSchoolRepository
|
||||
Reference in New Issue
Block a user