Add endpoint for fetching my-team/players
This commit is contained in:
@@ -67,11 +67,12 @@ class Player extends Model {
|
||||
|
||||
async to_api() {
|
||||
return {
|
||||
player_number: this.player_number,
|
||||
player_name: this.player_name,
|
||||
player_position: this.player_position,
|
||||
team_name: this.team_name,
|
||||
image_url: this.image_url,
|
||||
number: this.player_number,
|
||||
name: this.full_name,
|
||||
position: this.fantasy_position,
|
||||
team_name: this.patch_data.patch_team_name,
|
||||
image: this.photo_url,
|
||||
stats: {}, // TODO - populate some stats!
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,6 +50,15 @@ class Team extends Model {
|
||||
return new_team
|
||||
}
|
||||
|
||||
async players() {
|
||||
const Player = this.models.get('Player')
|
||||
return Player.find({
|
||||
_id: {
|
||||
$in: this.player_ids.map(x => Player.to_object_id(x))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
async to_api() {
|
||||
const User = this.models.get('auth:User')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user