Start back end test for Player model

This commit is contained in:
2020-11-08 11:33:26 -06:00
parent 9d03679063
commit 84f75aecd0
5 changed files with 117 additions and 1 deletions

View File

@@ -1,5 +1,5 @@
const { Model } = require('flitter-orm')
const ActiveScope = require('./scopes/Active.scope')
/*
* Player Model
@@ -10,6 +10,8 @@ class Player extends Model {
return [...super.services, 'output', 'models', 'sports_data']
}
static scopes = [new ActiveScope()]
/*
* Define the flitter-orm schema of the model.
*/
@@ -37,6 +39,10 @@ class Player extends Model {
photo_url: String,
seed_stats: Object,
// False if the player doesn't have any week-1 stats.
// If so, they will be hidden to make the game more playable.
is_active: { type: Boolean, default: true },
}
}

View File

@@ -0,0 +1,9 @@
const Scope = require('flitter-orm/src/model/Scope')
class ActiveScope extends Scope {
async filter(to_filter) {
return to_filter.equal('is_active', true)
}
}
module.exports = exports = ActiveScope